C# – 如何访问WLAN信号强度和其他?

许多科学家已经发表论文logging如何通过WLAN连接的设备可以通过测量其信号强度,到达时间,往返时间等来跟踪。任何想法如何使用任何.NET API在Windows中访问这些值?

或者您是否知道可用于位置跟踪的软件SDK?

Solutions Collecting From Web of "C# – 如何访问WLAN信号强度和其他?"

你好,WIndows 7这是一个很好的代码,至少可以检测到所有的AP与MAC地址RSSI SSID:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using NativeWifi; class Program { static void Main(string[] args) { WlanClient client = new WlanClient(); // Wlan = new WlanClient(); try { foreach (WlanClient.WlanInterface wlanIface in client.Interfaces) { Wlan.WlanBssEntry[] wlanBssEntries = wlanIface.GetNetworkBssList(); foreach (Wlan.WlanBssEntry network in wlanBssEntries) { int rss = network.rssi; // MessageBox.Show(rss.ToString()); byte[] macAddr = network.dot11Bssid; string tMac = ""; for (int i = 0; i < macAddr.Length; i++) { tMac += macAddr[i].ToString("x2").PadLeft(2, '0').ToUpper(); } Console.WriteLine("Found network with SSID {0}.", System.Text.ASCIIEncoding.ASCII.GetString(network.dot11Ssid.SSID).ToString()); Console.WriteLine("Signal: {0}%.", network.linkQuality); Console.WriteLine("BSS Type: {0}.", network.dot11BssType); Console.WriteLine("MAC: {0}.", tMac); Console.WriteLine("RSSID:{0}", rss.ToString()); } Console.ReadLine(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } 

我希望这将是有益的享受

Managed Wifi API将提供信号强度信息。 下面是一个代码片段,它是根据我之前提出的问题改编的,

 static void Main(string[] args) { WlanClient client = new WlanClient(); foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces ) { Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList( 0 ); foreach ( Wlan.WlanAvailableNetwork network in networks ) { Console.WriteLine( "Found network with SSID {0} and Siqnal Quality {1}.", GetStringForSSID(network.dot11Ssid), network.wlanSignalQuality); } } } static string GetStringForSSID(Wlan.Dot11Ssid ssid) { return Encoding.ASCII.GetString(ssid.SSID, 0, (int) ssid.SSIDLength); } 

Windows本身现在提供了一个Location API 。