CC3000能否读取信号强度,如何读取?
时间:10-02
整理:3721RD
点击:
请教大神们,我用的模块是WG1300-B0.数据可以收发,由于项目需要读取WIFI信号强度。知道的大神们,请告知。
是通过这个API来做的wlan_ioctl_get_scan_results,你看它返回的结果里面有一项是rssi。
加一个下面的结构体:
typedef struct {
unsigned long networksFound;
unsigned long scanStatus;
unsigned long isValid : 1;
signed long rssi : 7;
unsigned long securityMode : 2;
unsigned long ulSsidLen : 6;
unsigned long frameTime : 16;
char ssid[32];
unsigned char ucBssid[6];
} wifi_scan_result_t;
然后代码片段如下:
static unsigned char buffer[50];
wifi_scan_result_t *result = (wifi_scan_result_t *) buffer;
memset(buffer, 0, sizeof(buffer));
if (wlan_ioctl_get_scan_results(0, buffer) != 0)
{
return -2;
}