A
a
i need to use wifi and cf reader at same time, and cf reading freezes
pda if wifi is on.
so i need to toggle wifi off/on and found some code but it is not
working:
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
}
[System.Runtime.InteropServices.DllImport("coredll.dll")]
private static extern int DevicePowerNotify(string name,
PowerState state, int flags);
[System.Runtime.InteropServices.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
}
it is not working. I think i need to change TIACXWLN1 to whatever is
on my pda. Where do i find this value? I read that it is at the
registry location
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\Suspend
but all i see there is the guid
(98C5250D-C29A-4985-AE5F-AFE5367E5006). If I try and use that only in
the code it still doesnt work.
lastly, i saw some opennetcf code which loops through adapters. It's
the .net class but i downloaded and tried to add it as a reference but
it says it's not a .net assembly.
help?
pda if wifi is on.
so i need to toggle wifi off/on and found some code but it is not
working:
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
}
[System.Runtime.InteropServices.DllImport("coredll.dll")]
private static extern int DevicePowerNotify(string name,
PowerState state, int flags);
[System.Runtime.InteropServices.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
}
it is not working. I think i need to change TIACXWLN1 to whatever is
on my pda. Where do i find this value? I read that it is at the
registry location
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\Suspend
but all i see there is the guid
(98C5250D-C29A-4985-AE5F-AFE5367E5006). If I try and use that only in
the code it still doesnt work.
lastly, i saw some opennetcf code which loops through adapters. It's
the .net class but i downloaded and tried to add it as a reference but
it says it's not a .net assembly.
help?