Search code examples
c++windowswinapiwifirssi

RSSI using Windows API


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!


Solution

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