Search code examples
c#winapiwifiwlanapi

Querying WiFi/WLAN network frequency via Native Wifi


System control panel


The system control panel shows this info.

How can I query it (using C#)?

Using interop, I got the WLAN_ASSOCIATION_ATTRIBUTES.

But they only seem to contain DOT11_PHY_TYPE dot11PhyType;.

This gives me some information, but not all.

Example:

  1. dot11PhyType is 7.
  2. 7 means dot11_phy_type_ht.
  3. dot11_phy_type_ht is 802.11n.
  4. 802.11n is 2.4 or 5 GHz?

Apparently most protocols can use multiple frequencies. So how can I get the currently used one? Should I just show the highest value in the list?

I think I'm misunderstanding something here.


Solution

  • According to the suggestion of Mike Petrichenko:

    You could try to use WlanGetNetworkBssList.

    It returns WLAN_BSS_LIST each item of that (WLAN_BSS_ENTRY) contains ulChCentrFrequency field. That is what you are looking for.