1

I am trying to get the RSSI using the windows API. So far, I have found this thread saying to use the wlan_intf_opcode_rssi with the WlanQueryInterface function. I am not too sure what the reply means on that thread and was hoping someone could clarify.

All i have managed to understand from the other thread is this:

WlanQueryInterface(hClient,
   &pInfo->InterfaceGuid,
   wlan_intf_opcode_rssi,
   NULL,
   &connectInfoSize,
   (PVOID*)&pConnectInfo,
   &opCode);

I am not sure what to do after here. Any help would be appreciated!

Community
  • 1
  • 1
Ben Evans
  • 83
  • 1
  • 5

1 Answers1

1

You're passing the wrong type of argument to WlanQueryInterface. MSDN says that the return type for wlan_intf_opcode_rssi is LONG, so you need to pass a pointer to a LONG variable, like this:

LONG rssi = 0;
DWORD dwSizeRssi = sizeof(rssi);
dwResult = WlanQueryInterface(hClient,
    &pIfInfo->InterfaceGuid,
    wlan_intf_opcode_rssi,
    NULL,
    &dwSizeRssi,
    (PVOID *)&rssi,
    &opCode);

if (dwResult == ERROR_SUCCESS)
{
    wprintf(L"RSSI = %u \n", rssi);
}
snowcrash09
  • 4,694
  • 27
  • 45
  • I know this has been some time, but I have been using your code to get the RSSI. It seems like I get far too high values (underflow?) e.g. 984188178. I tried replacing your `%u` format specifier with `%d` or `%ld`, but the issue remains the same. The return value of `WlanQueryInterface` is still `ERROR_SUCCESS ` though. Do you happen to have any clue? Thanks – gleerman May 04 '17 at 15:53