獲取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);