特定の WEP 対応ネットワークが利用可能になった場合に、そのネットワークに Windows Mobile CE 用のアプリケーションを再接続しようとしています。このコードは、現在利用可能なアクセス ポイントをスキャンして、必要なネットワークへの参照を取得していると思います。
// 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();
}
}
}
昨日OpenNETCFライブラリを見つけたので、少し詳しく知りません。ネットワークACが利用可能かどうかをテストし、利用できる場合は接続するコードの例があるかどうかを尋ねたいと思います。