Turn WIFI ON after Soft-Reset

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
 
P

Paul G. Tobey [eMVP]

How is the WiFi adapter connected to your Pocket PC? Does the adapter's
entry show up in the Network and DialUp Connections applet? Have you tried
telling it to rebind to TCP/IP after you turn the power on
(OpenNETCF.Net.Adapter has a method for this)?

Paul T.
 
M

Mongolfier

Hi Paul,
How is the WiFi adapter connected to your Pocket PC?
The WiFi adapter is integrated in the PDA Qtek 9090.
Does the adapter's entry show up in the Network and DialUp
Connections applet?
Yes, it does.
I can find out, the adpater in the Network Cards list.
Have you tried telling it to rebind to TCP/IP after you turn the
power on (OpenNETCF.Net.Adapter has a method for this)?
I just tried to use Bind e Unbind.
If I save the Adapter object and I reuse it while the app is running, it
work.
Unfortunatelly when I unbind the Adapter it disapper from the
OpenNETCF.Net.AdapterCollection.
If I restart the App with WiFi off, I'm unable to rebind the adpater
again because I cannot find the adapter in the Collection.

Any idea about, how to get the adapter object when not present in the
collection ?

I'm also looking for a way to start the WiFi adapter "tiacxwln" after a
soft reset. In fact, in case of the user Turn the WiFi Power Off from
the control panel, I'm not able to restart it again.

Which is the way PPC 2003 use to load the driver at startup ?
Where it look for to load a driver or not ?

Thanks in advance
Valerio




Paul G. Tobey [eMVP] ha scritto:
How is the WiFi adapter connected to your Pocket PC? Does the adapter's
entry show up in the Network and DialUp Connections applet? Have you tried
telling it to rebind to TCP/IP after you turn the power on
(OpenNETCF.Net.Adapter has a method for this)?

Paul T.

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
 
P

Paul G. Tobey [eMVP]

You can read the Windows CE 4.2 documentation for how and when drivers are
started. I can't cover that here.

I'd say try to do what the Adapter class does yourself: tell NDISUIO to bind
the adapter (it's just a name to NDISUIO). Since it seems that binding
works for you, I think that it's likely that this will work, too.

Paul T.

Mongolfier said:
Hi Paul,
How is the WiFi adapter connected to your Pocket PC?
The WiFi adapter is integrated in the PDA Qtek 9090.
Does the adapter's entry show up in the Network and DialUp
Connections applet?
Yes, it does.
I can find out, the adpater in the Network Cards list.
Have you tried telling it to rebind to TCP/IP after you turn the
power on (OpenNETCF.Net.Adapter has a method for this)?
I just tried to use Bind e Unbind.
If I save the Adapter object and I reuse it while the app is running, it
work.
Unfortunatelly when I unbind the Adapter it disapper from the
OpenNETCF.Net.AdapterCollection.
If I restart the App with WiFi off, I'm unable to rebind the adpater again
because I cannot find the adapter in the Collection.

Any idea about, how to get the adapter object when not present in the
collection ?

I'm also looking for a way to start the WiFi adapter "tiacxwln" after a
soft reset. In fact, in case of the user Turn the WiFi Power Off from the
control panel, I'm not able to restart it again.

Which is the way PPC 2003 use to load the driver at startup ?
Where it look for to load a driver or not ?

Thanks in advance
Valerio




Paul G. Tobey [eMVP] ha scritto:
How is the WiFi adapter connected to your Pocket PC? Does the adapter's
entry show up in the Network and DialUp Connections applet? Have you
tried telling it to rebind to TCP/IP after you turn the power on
(OpenNETCF.Net.Adapter has a method for this)?

Paul T.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top