获取WiFi信号值,有时候出现信号跳变
Wifi_Connect(my_ssid, my_password);
struct tls_curr_bss_t rssi_1;
u8 auto_reconnect1 = WIFI_AUTO_CNT_ON;
while(1)
{
tls_os_time_delay(1 * 250);
if(tls_wifi_get_state() == 3)
{
tls_wifi_get_current_bss(&rssi_1);
printf("DBSignal = %d\n",rssi_1.rssi);
}
else
{
tls_wifi_auto_connect_flag(WIFI_AUTO_CNT_FLAG_SET,&auto_reconnect1);
printf("auto connect\n");
}
}
/*****************************************************************************
*
* File Name : main.c
*
* Description: main
*
* Copyright (c) 2014 Winner Micro Electronic Design Co., Ltd.
* All rights reserved.
*
* Author : dave
*
* Date : 2014-6-14
*****************************************************************************/
#include "wm_include.h"
#include "string.h"
void UserMain(void)
{
printf("\n user task \n");
struct tls_curr_bss_t rssi;
u8 auto_reconnect = 0xff;
if(auto_reconnect != WIFI_AUTO_CNT_ON)
{
auto_reconnect = WIFI_AUTO_CNT_ON;
tls_wifi_auto_connect_flag(WIFI_AUTO_CNT_FLAG_SET, &auto_reconnect);
tls_wifi_connect((u8 *)"w600", strlen("w600"), (u8 *)"12345678", strlen("12345678"));
printf("--->WIFI_AUTO_CNT_FLAG_SET ON\n");
}
while(1)
{
tls_os_time_delay(HZ*1);
tls_wifi_get_current_bss(&rssi);
printf("--->rssi = -%d\n",rssi.rssi);
}
#if DEMO_CONSOLE
CreateDemoTask();
#endif
//用户自己的task
}
请问获取WiFi信号强度调用哪个函数?
获取当前AP的信号强度,前提你要先连上:
void tls_wifi_get_current_bss(struct tls_curr_bss_t* bss);
获取周边所有的AP的信号强度,用与扫描附近的热点:
int tls_wifi_get_scan_rslt(u8* buf, u32 buffer_size);