检查与Windows Mobile Pocket PC的Wifi连接的可能性

时间:2014-11-11 07:41:15

标签: c# wifi opennetcf windows-mobile-5.0 smart-device-framework

我是.NET Framework 3.5的新手。目前在我的C#项目中我正在使用Smart Device Framework。 我的任务是在Windows窗体中单击按钮启用wifi连接,以(将移动设备与Web部件同步,即从Web到移动设备获取数据)

Windows Mobile 5.0 Pocket PC我看不到 WLAN连接的任何选项 settings --> Connections

以下是Windows Mobile 5.0 Pocket PC中显示的网络适配器列表,我在搜索时看到

enter image description here

我配置了NE2000兼容的以太网驱动程序。 我是否正确行事?

此外,我在项目参考中添加了OpenNETCF.net library 我从其他堆栈溢出链接和微软文档中获取了帮助: Building a Wi-Fi Discovery Application

以下是代码段:

/// Check available network interfaces
        foreach (OpenNETCF.Net.NetworkInformation.INetworkInterface networkInterface in OpenNETCF.Net.NetworkInformation.WirelessNetworkInterface.GetAllNetworkInterfaces())
        {   /// network interface i get NE20001

            if (networkInterface.Description.Equals("NE20001"))    
            {
                /// Display current configurations
                textBox1.Text += ("Description: " + networkInterface.Description + "\r\n");
                textBox1.Text += ("IP: " + networkInterface.CurrentIpAddress + "\r\n");
                textBox1.Text += ("ID: " + networkInterface.Id + "\r\n");
                textBox1.Text += ("Status: " + networkInterface.InterfaceOperationalStatus + "\r\n");
                networkInterface.Bind();

                try
                {  
                    INw = (OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface)networkInterface;    ///< Obtain wireless zero configuration interface                     }
                catch
                {
                    textBox1.Text = "Network interface is not Wireless Zero Configuration";     ///< Possible reason can be that image in WinCE 7 
                }

                accessPointCollection = INw.NearbyAccessPoints;

                textBox1.Text += ("Wireless Network available are:\r\n");
                /// Get available wireless network 
                foreach (OpenNETCF.Net.NetworkInformation.IAccessPoint iAccessPoint in accessPointCollection)
                {
                    comboBox1.Items.Add(iAccessPoint.Name);
                    textBox1.Text += (iAccessPoint.Name + " -  signal strength: " + iAccessPoint.SignalStrength + " (" + iAccessPoint.SignalStrength.Decibels + "dB)\r\n");
                }

              }
           }

我在下方获得INw值NULL,因为它没有WirelessZeroConfigNetworkInterface。

INw = (OpenNETCF.Net.NetworkInformation.WirelessZeroConfigNetworkInterface)networkInterface; 

因此,WirelessZeroConfigNetworkInterface无法使用INw.NearbyAccessPoints。


1)如何在.NET3.5中的Windows Mobile 5.0 Pocket Pc中configure WIFI connections

2)如何知道当前的Windows Mobile 5.0 Pocket Pc是否启用了wifi。

3)我上面的代码中某处出错了,启用wifi需要WirelessZeroConfigNetworkInterface吗?

任何建议都非常有用

0 个答案:

没有答案