C# - 如何访问 WLAN 信号强度等?

发布于 2024-08-10 10:52:22 字数 381 浏览 5 评论 0原文

许多科学家发表了论文记录设备如何连接通过 WLAN 可以通过测量其信号强度、到达时间、往返时间等进行跟踪。知道如何使用任何 .NET API 在 Windows 中访问这些值吗?

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

Many scientists have published papers documenting how devices connected via WLAN can be tracked by measuring its Signal Strength, Time Of Arrival, Round Trip Time, etc. Any idea how I can access these values in Windows using any .NET API?

Or do you know of software SDKs already available for location tracking?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏见 2024-08-17 10:52:22

你好,对于 WIndows 7,这是一个很好的代码,可以检测所有具有 MAC 地址 RSSI SSID 的 AP:

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);
        }

        }
    }  
}

我希望它会有所帮助享受

hello for WIndows 7 this is a good code wich can detect all AP with MAC adress 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);
        }

        }
    }  
}

i hope it will be helpful enjoy

廻憶裏菂餘溫 2024-08-17 10:52:22

托管 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);
}

The Managed Wifi API will provide signal strength information. Here's a code snippet adapted from a question I previously posed and was answered here:

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);
}
耳根太软 2024-08-17 10:52:22

Windows 本身现在提供了Location API

Windows itself provides a Location API now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文