无线信号强度

时间:2021-11-25 14:44:06
有没有办法做到通过直接调用操作系统中,现有的无线网络连接接口,查询信号强度信息。我的程序中要获得这些信号强度信息。请各位高手指点。

6 个解决方案

#1



#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include<Wlanapi.h>
#pragma comment(lib, "wlanapi.lib")

int wmain()
{
HANDLE ClientHandle;DWORD nv,i,c;PWLAN_INTERFACE_INFO_LIST ilist;PWLAN_AVAILABLE_NETWORK_LIST nlist;static char ssid[36];
if(WlanOpenHandle(1,0,&nv,&ClientHandle)==0)
{
if(WlanEnumInterfaces(ClientHandle,0,&ilist)==0)
{
for (i = 0; i < ilist->dwNumberOfItems; i++) {
wprintf(L"%s%s\n",L"Interface:",ilist->InterfaceInfo[i].strInterfaceDescription);
if(WlanGetAvailableNetworkList(ClientHandle,&ilist->InterfaceInfo[i].InterfaceGuid,0,0,&nlist)==0){
for(c=0;c<nlist->dwNumberOfItems;c++)
{
memcpy(ssid,nlist->Network[c].dot11Ssid.ucSSID,nlist->Network[c].dot11Ssid.uSSIDLength);
ssid[nlist->Network[c].dot11Ssid.uSSIDLength]=0;
printf("SSID:%s",ssid);
wprintf(L"%s%d\n",L"\nQuality:",nlist->Network[c].wlanSignalQuality);
}
WlanFreeMemory(nlist);
}
}
WlanFreeMemory(ilist);
}
getch();
WlanCloseHandle(ClientHandle,0);
}

}

#2


该回复于2011-02-16 08:49:22被版主删除

#3


remark

#4


1楼貌似很强啊

#5


先看能不能解决他的问题

#6


楼主没说 是什么系统 
linux的话  
  iwlist wlan0 scan 
就能扫描出所有wifi节点的信息,包括 信号强度

#1



#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include<Wlanapi.h>
#pragma comment(lib, "wlanapi.lib")

int wmain()
{
HANDLE ClientHandle;DWORD nv,i,c;PWLAN_INTERFACE_INFO_LIST ilist;PWLAN_AVAILABLE_NETWORK_LIST nlist;static char ssid[36];
if(WlanOpenHandle(1,0,&nv,&ClientHandle)==0)
{
if(WlanEnumInterfaces(ClientHandle,0,&ilist)==0)
{
for (i = 0; i < ilist->dwNumberOfItems; i++) {
wprintf(L"%s%s\n",L"Interface:",ilist->InterfaceInfo[i].strInterfaceDescription);
if(WlanGetAvailableNetworkList(ClientHandle,&ilist->InterfaceInfo[i].InterfaceGuid,0,0,&nlist)==0){
for(c=0;c<nlist->dwNumberOfItems;c++)
{
memcpy(ssid,nlist->Network[c].dot11Ssid.ucSSID,nlist->Network[c].dot11Ssid.uSSIDLength);
ssid[nlist->Network[c].dot11Ssid.uSSIDLength]=0;
printf("SSID:%s",ssid);
wprintf(L"%s%d\n",L"\nQuality:",nlist->Network[c].wlanSignalQuality);
}
WlanFreeMemory(nlist);
}
}
WlanFreeMemory(ilist);
}
getch();
WlanCloseHandle(ClientHandle,0);
}

}

#2


该回复于2011-02-16 08:49:22被版主删除

#3


remark

#4


1楼貌似很强啊

#5


先看能不能解决他的问题

#6


楼主没说 是什么系统 
linux的话  
  iwlist wlan0 scan 
就能扫描出所有wifi节点的信息,包括 信号强度