Windows Phone擷取WiFi BSSID

來源:互聯網
上載者:User

標籤:

BSSID,一種特殊的Ad-hoc LAN的應用,也稱為Basic Service Set (BSS),一群電腦設定相同的BSS名稱,即可自成一個group。每個BSS都會被賦予一個BSSID,它是一個長度為48位的二進位標識符,用來識別不同的BSS。其的主要優點是它可以作為過濾之用。

BSSID 是指網站的 MAC 位址,(STA)在一個存取點,(AP)在一個基礎架構模式, BSS 是由 IEEE 802.11-1999 無線區域網路規範定義的。這個地區唯一地定義了每個 BSS 。在一個 IBSS 中,BSSID 是一個本地管理的 IEEE MAC 位址,從一個 46 位的任意編碼中產生。地址的個體/組位被設定為 0 。通用/本地地址位被設定為 1 。

以上話來自百度百科。

之前開發的時候是為了擷取手機所串連的熱點的MAC 位址,所以一直是尋找WiFi MAC 位址相關的API或者方法,但沒有成功。

 LanIdentifier Class 

位置資料可表示為 BSSID(如果網路介面卡媒體類型是無線區域網路),或不是為元組 <ChassisId, Port Number>(如果網路介面卡類型是乙太網路)。根據 LLDP 協議表示資料。

  有關如何檢索 LanIdentifier 對象表示的資料的樣本,請參見 如何檢索網路介面卡和位置資訊。  

直接貼代碼吧

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

 其中 lanIdentifier.InfrastructureId.Value 就是BSSID了,需要取出來,並且轉為16進位。

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

這擷取的就是BSSID了,至少我擷取的值與iPhone擷取的值對比是一樣的。

另外,IReadOnlyList<LanIdentifier> lanIdentifiers = NetworkInformation.GetLanIdentifiers(); Windows 8也支援。

希望對您有協助。

 

Windows Phone擷取WiFi BSSID

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.