5

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

cyo
  • 193
  • 2
  • 4
  • 17

2 Answers2

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#

Community
  • 1
  • 1
AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65
  • Isn't there any Java api?I am much more familiar Java – cyo May 25 '12 at 19:56
  • I know J2ME has API to get this value directly however not sure any for desktop.. If you are language dependent, its best to phrase clearly in your question. – AvkashChauhan May 25 '12 at 20:00
  • 2
    Check this out http://stackoverflow.com/questions/7142485/to-read-rssi-from-wifi-sensor, it talks about PlaceLab sourceforge page and Soptter.dll with Java Wrapper.. – AvkashChauhan May 25 '12 at 20:10
  • I couldn't use this Interface.In this link http://msdn.microsoft.com/en-us/library/windows/desktop/ms706765(v=vs.85).aspx there is a sample but it only shows connected wireless infos.I want to see all enable wirelesses rssi values – cyo May 30 '12 at 13:42
  • That is very easy. you just need to use WlanEnumInterfaces API to enumerate all the currently enabled wireless on local machine. Here is the sample code: http://msdn.microsoft.com/en-us/library/windows/desktop/ms706716(v=vs.85).aspx – AvkashChauhan May 30 '12 at 18:48
  • Actually this link http://stackoverflow.com/questions/1192376/wlan-api-for-getting-signal-strenth really help.It find all networks but after that i should find each result's rssi using WlanQueryInterface. dwResult = WlanGetAvailableNetworkList(hClient, &pIfInfo->InterfaceGuid, 0, NULL, &pBssList); After that pBssList-->rssi doesn't work – cyo May 31 '12 at 07:34
0

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);
 } 
Abdullah Leghari
  • 2,332
  • 3
  • 24
  • 40