Windows phone get WiFi BSSID

Source: Internet
Author: User
Tags bssid


Original: Windows phone get WiFi BSSID




BSSID, a special Ad-hoc LAN application, also known as basic Service set (BSS), a group of computers that set the same BSS name can be self-formed. Each BSS is given a bssid, which is a 48-bit binary identifier used to identify different BSS. Its main advantage is that it can be used as a filter.

BSSID refers to the MAC address of the site, (STA) in an access point, (AP) in an infrastructure mode, and BSS is defined by the IEEE 802.11-1999 Wireless LAN specification. Each BSS is uniquely defined in this area. In a IBSS, BSSID is a locally administered IEEE MAC address that is generated from an arbitrary 46-bit encoding. The individual/group bit of the address is set to 0. The universal/local address bit is set to 1.


The above words from Baidu Encyclopedia.



It was developed in order to get the MAC address of the hotspot that the phone is connected to, so it has been the API or method to find the WiFi MAC address, but it didn't succeed.



Lanidentifier Class



The location data can be represented as BSSID (if the network adapter media type is wireless LAN), or not for tuple <chassisid, Port number> (if the network adapter type is Ethernet). Data is represented according to the LLDP protocol.



For an example of how to retrieve the data represented by the lanidentifier object, see how to retrieve network adapters and location information.



Just stick to the code.


 string GetLanIdentifierData(LanIdentifier lanIdentifier)
      {
          string lanIdentifierData = string.Empty;
          if (lanIdentifier == null)
          {
              return lanIdentifierData;
          }

          if (lanIdentifier.InfrastructureId != null)
          {
              lanIdentifierData += "Infrastructure Type: " + lanIdentifier.InfrastructureId.Type + "\n";
              lanIdentifierData += "Infrastructure Value: ";
              var infrastructureIdValue = lanIdentifier.InfrastructureId.Value;
              foreach (var value in infrastructureIdValue)
              {
                  lanIdentifierData += value + " ";
              }
          }

          if (lanIdentifier.PortId != null)
          {
              lanIdentifierData += "\nPort Type : " + lanIdentifier.PortId.Type + "\n";
              lanIdentifierData += "Port Value: ";
              var portIdValue = lanIdentifier.PortId.Value;
              foreach (var value in portIdValue)
              {
                  lanIdentifierData += value + " ";
              }
          }

          if (lanIdentifier.NetworkAdapterId != null)
          {
              lanIdentifierData += "\nNetwork Adapter Id : " + lanIdentifier.NetworkAdapterId + "\n";
          }
          return lanIdentifierData;
      }


One of the LanIdentifier.InfrastructureId.Value is BSSID, which needs to be taken out and converted into 16.


 
for (int i = 0; i < lanIdentifier.InfrastructureId.Value.Count; i++)
{
  lanIdentifierData += lanIdentifier.InfrastructureId.Value[i].ToString("X2");
}


This is bssid, at least the value I get is the same as the value the iphone gets.



In addition,ireadonlylist<lanidentifier> lanidentifiers = Networkinformation.getlanidentifiers (); Windows 8 is also supported.



Hope to help you.






Windows phone get WiFi BSSID


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.