I was working on to Enable/Disable it Wifi on Motorola MC17 device . After some effort I found the solution to enable/Disable it wifi Radio. I am Using Symbol.Fusion dll to get toggle wifi radio. there are some other ways also to Like P/invoke with .Net etc. here I will put both ways . you can take the reference of that. Here I am putting sourcecode for your reference.
Note: You Need To Take The Reference Of Symbol.fusion dll
public class WiFiRadio
{
WLAN myCommandModeWlan = null;
public WiFiRadio()
{
InitializeWiFi();
}
public void InitializeWiFi()
{
try
{
myCommandModeWlan = new WLAN(FusionAccessType.COMMAND_MODE);
}
catch (OperationFailureException ex)
{
System.Windows.Forms.MessageBox.Show("Command mode is in use", "WiFiMgr");
}
}
public void ToggleWiFi(bool enableWiFi)
{
try
{
if (myCommandModeWlan != null)
{
if (enableWiFi)
{
myCommandModeWlan.Adapters[0].PowerState = Adapter.PowerStates.ON;
}
else
{
myCommandModeWlan.Adapters[0].PowerState = Adapter.PowerStates.OFF;
}
}
}
catch (OperationFailureException ex)
{
System.Windows.Forms.MessageBox.Show("Command mode is in use", "WiFiMgr");
}
}
public bool GetCurrentStatus()
{
if (myCommandModeWlan.Adapters[0].PowerState == Adapter.PowerStates.ON)
{
return true;
}
else
{
return false;
}
}
}
Note: You Need To Take The Reference Of Symbol.fusion dll
Thanks for code........
ReplyDeleteuseful coding, came in handy today - thanks for this.
ReplyDeleteGreat !
ReplyDeleteThanks a lot.