I am attempting to have an application for Windows Mobile CE re-connect to a specific WEP Enabled network if it becomes available. I believe that this code scans through the currently available access points to get a reference to the network I need:
// we have communicated with the server, so save the access point for future reference
INetworkInterface[] wniNet = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface wni in wniNet)
{
if (wni is WirelessNetworkInterface)
{
WirelessNetworkInterface wWireless = wni as WirelessNetworkInterface;
//if (mwniServerConnection == null)
if (string.IsNullOrEmpty(msAccessPointName))
{
MessageBox.Show("assigning: " + wWireless.AssociatedAccessPoint.ToString() + " to instance var.", "testing");
// first attempt to save the WEP enabled access point to the preferred networks
//WirelessZeroConfigNetworkInterface wWifiConnection = new WirelessZeroConfigNetworkInterface();
//wWifiConnection.AddPreferredNetwork(wWireless.AssociatedAccessPoint.ToString(),
// wWireless.InfrastructureMode,
// "9876543210",
// 1,
// wWireless.AuthenticationMode,
// WEPStatus.WEPEnabled,
// null);
mwniServerConnection = wWireless;
msAccessPointName = wWireless.AssociatedAccessPoint.ToString();
}
}
}
I am a little out of my depth having found the OpenNETCF library yesterday, I'd like to ask if there are any examples of code that can test if the network ac is available, and to connect if it is.