Get Rssi Value From Windows

自古美人都是妖i 提交于 2019-12-01 11:08:54

问题


I would like to measure rssi value of modem.Is there any api to get rssi value for Windows?I used to do that with Wifi.Manager in android.But i couldn't find any api for Windows


回答1:


Using Native code is the best. You will need to use WlanQueryInterface() with wlan_intf_opcode_rssi opcode which will return RSSI value as LONG data type. From there you can convert it to dbm.

DWORD WINAPI WlanQueryInterface(
 __in        HANDLE hClientHandle,
 __in        const GUID *pInterfaceGuid,
 __in        WLAN_INTF_OPCODE OpCode,
 __reserved  PVOID pReserved,
 __out       PDWORD pdwDataSize,
 __out       PVOID *ppData,
 __out_opt   PWLAN_OPCODE_VALUE_TYPE pWlanOpcodeValueType
);

Here using opcode wlan_intf_opcode_rssi you will get RSSI value:

WLAN_INTF_OPCODE  >> wlan_intf_opcode_rssi >> LONG

Here is the C++ sample on how to start with:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms706765(v=vs.85).aspx

If you want C# Try this: How to get SSID and RSSI for Win7 using C#




回答2:


Since this question appeared on home page for review- the existing answer is outdated. There is now a Managed Wifi API available as a wrapper around the Windows Native Wifi API.

Signal strength in percentage and RSSI could be obtained as, Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);

Wlan.WlanBssEntry[] redes = wlanIface.GetNetworkBssList(); //Get the atribute that you need

foreach (Wlan.WlanBssEntry network in redes)
{
    Console.Write("Network SSID {0} RSSI {1}\n ", GetStringForSSID(network.dot11Ssid),
 network.rssi);
 } 


来源:https://stackoverflow.com/questions/10760006/get-rssi-value-from-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!