M
Mongolfier
Hi all,
I'm using the following class to turn WIFI adapter On and Off on my
Pocket PC 2003.
This code work fine if the WiFi is activated from the WiFi Control
Panel, but when I turn the WiFi Off and later I soft reset the PDA, I'm
not able to turn WiFi On again from my application.
Is there a way to force the WiFi to get active ?
Can be possible that after the soft-reset, this class isn't enable to
turn on the WiFi adapter because the driver is not loaded ?
In this case, how could I load the driver "tiacxwln.dll" ?
public class WLANController
{
#region DllImports etc...
private enum PowerState
{
PwrDeviceUnspecified = -1,
D0 = 0, // Full On: full power, full functionality
D1 = 1, // Low Power On: fully functional at low power/performance
D2 = 2, // Standby: partially powered with automatic wake
D3 = 3, // Sleep: partially powered with device initiated wake
D4 = 4, // Off: unpowered
PwrDeviceMaximum = 5
}
[DllImport("coredll.dll")]
private static extern int DevicePowerNotify(string name, PowerState
state, int flags);
[DllImport("coredll.dll")]
private static extern int SetDevicePower(string name, int flags,
PowerState state);
#endregion
#region Public methods
/// <summary>
/// Powers down the WLAN radio.
/// </summary>
public static void PowerDownWLANRadio()
{
try
{
DevicePowerNotify(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1",
PowerState.D4, 1);
SetDevicePower(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1", 1,
PowerState.D4);
}
catch {}
}
/// <summary>
/// Powers up the WLAN radio.
/// </summary>
public static void PowerUpWLANRadio()
{
try
{
DevicePowerNotify(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1",
PowerState.D0, 1);
SetDevicePower(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1", 1,
PowerState.D0);
//GetAdapterName can only be fetched if WLAN is on, so resorting to the
fixed name I found on my HP hx4700
}
catch {}
}
#endregion
}
Thanks
Valerio
I'm using the following class to turn WIFI adapter On and Off on my
Pocket PC 2003.
This code work fine if the WiFi is activated from the WiFi Control
Panel, but when I turn the WiFi Off and later I soft reset the PDA, I'm
not able to turn WiFi On again from my application.
Is there a way to force the WiFi to get active ?
Can be possible that after the soft-reset, this class isn't enable to
turn on the WiFi adapter because the driver is not loaded ?
In this case, how could I load the driver "tiacxwln.dll" ?
public class WLANController
{
#region DllImports etc...
private enum PowerState
{
PwrDeviceUnspecified = -1,
D0 = 0, // Full On: full power, full functionality
D1 = 1, // Low Power On: fully functional at low power/performance
D2 = 2, // Standby: partially powered with automatic wake
D3 = 3, // Sleep: partially powered with device initiated wake
D4 = 4, // Off: unpowered
PwrDeviceMaximum = 5
}
[DllImport("coredll.dll")]
private static extern int DevicePowerNotify(string name, PowerState
state, int flags);
[DllImport("coredll.dll")]
private static extern int SetDevicePower(string name, int flags,
PowerState state);
#endregion
#region Public methods
/// <summary>
/// Powers down the WLAN radio.
/// </summary>
public static void PowerDownWLANRadio()
{
try
{
DevicePowerNotify(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1",
PowerState.D4, 1);
SetDevicePower(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1", 1,
PowerState.D4);
}
catch {}
}
/// <summary>
/// Powers up the WLAN radio.
/// </summary>
public static void PowerUpWLANRadio()
{
try
{
DevicePowerNotify(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1",
PowerState.D0, 1);
SetDevicePower(@"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\TIACXWLN1", 1,
PowerState.D0);
//GetAdapterName can only be fetched if WLAN is on, so resorting to the
fixed name I found on my HP hx4700
}
catch {}
}
#endregion
}
Thanks
Valerio