14

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
  • Possible duplicate of [How do I get the available wifi APs and their signal strength in .net?](https://stackoverflow.com/questions/496568/how-do-i-get-the-available-wifi-aps-and-their-signal-strength-in-net) – lmcarreiro Feb 21 '19 at 16:49

3 Answers3

15

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

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
khadija
  • 166
  • 1
  • 2
12

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);
}
Community
  • 1
  • 1
Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
2

Windows itself provides a Location API now.

GraemeF
  • 11,327
  • 5
  • 52
  • 76
  • Good idea, but no mention of WLAN tracking, they're assuming we have GPS devices... slow and inaccurate. – Robin Rodricks Nov 06 '09 at 10:41
  • The Location API is by "default" technology agnostic, meaning it can have input from any type of location source. If you want to use WLAN it is just a matter of writing a source "driver" for Windows. This will allow all Location API capable applications to tap into your source, and similarly your application can use several sources. However, you will find that for indoor positioning WLAN isn't the best available solution. – andy Nov 23 '09 at 08:42