geting wifi signal level in c#

I am trying to read the wifi signal continuously to see how wifi signal level is changing for an embedded system. I read several articles in SO on how to read wifi signal level in C# such as this :

How often to poll wifi signal strength?

but when I am tring to do the same thing, I am always getting the same value. My code is as follow (simplified version):

    static void Main(string[] args)
    {
        string selectedSSDID = "BTWiFi";
        var client = new WlanClient();
        for (int i = 0; i < 1000; i++)
        {
            foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            {
                Wlan.WlanBssEntry[] wlanBssEntries = wlanIface.GetNetworkBssList();

                foreach (Wlan.WlanBssEntry network in wlanBssEntries)
                {
                    var networkSSID = Encoding.ASCII.GetString(network.dot11Ssid.SSID, 0, (int)network.dot11Ssid.SSIDLength);

                    if (selectedSSDID == networkSSID)
                    {
                        Console.Out.WriteLine(network.rssi);
                    }
                }
            }
            System.Threading.Thread.Sleep(1000);
        }
    }

when I ran this code, I would see that the signal level is always reported as one value and it doesn't change.

I used it against a embedded system which has a wifi and even when I put the device next to PC and when I moves to another room very far from the computer, if the application runs, it always report the same value, if I restart the application the value changes.

What is wrong with this code that it doesn't report correct value?

链接地址: http://www.djcxy.com/p/84972.html

上一篇: 使用三边测量法定位点

下一篇: geting wifi信号水平在c#