更新 WLAN 模块,使用 TCP 协议以匹配服务端变动
This commit is contained in:
parent
2fe8e3a952
commit
0b3b6af977
@ -1,5 +1,7 @@
|
|||||||
//系统设置应用
|
//系统设置应用
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "systick.h"
|
#include "systick.h"
|
||||||
|
|
||||||
@ -68,17 +70,20 @@ void APP_Setting_Launcher(void)
|
|||||||
|
|
||||||
if (WLAN_CheckNet())
|
if (WLAN_CheckNet())
|
||||||
{
|
{
|
||||||
uint8_t temp_ip_str[20];
|
uint8_t temp_ipaddr_str[60];
|
||||||
uint8_t temp_ipaddr_str[40];
|
|
||||||
|
|
||||||
Delay_ms(50);
|
Delay_ms(2000);
|
||||||
if (WLAN_GetIP(temp_ip_str) != 1)
|
if (WLAN_GetIPAddr(temp_ipaddr_str))
|
||||||
strcpy(temp_ip_str, "查询失败");
|
{
|
||||||
Delay_ms(50);
|
char *ret = strrchr(temp_ipaddr_str, '&');
|
||||||
if (WLAN_GetIPAddr(temp_ipaddr_str) != 1)
|
*ret = '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
strcpy(temp_ipaddr_str, "查询失败");
|
strcpy(temp_ipaddr_str, "查询失败");
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(temp_str, "网络已连接\n\nIP地址:%s\nIP归属地:%s", temp_ip_str, temp_ipaddr_str);
|
sprintf(temp_str, "网络已连接\n\nIP地址及归属地:\n%s", temp_ipaddr_str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -42,7 +42,7 @@ uint8_t APP_Weather_Sync(void);
|
|||||||
*/
|
*/
|
||||||
void APP_Weather_Launcher(void)
|
void APP_Weather_Launcher(void)
|
||||||
{
|
{
|
||||||
APP_Weather_SetCity("汉中");
|
APP_Weather_SetCity("º¼ÖÝ");
|
||||||
|
|
||||||
GE_Draw_ClrAll(WHITE);
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
|
||||||
|
|||||||
@ -26,27 +26,12 @@ uint8_t WLAN_CheckNet(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t WLAN_GetIP(uint8_t *ip_str)
|
|
||||||
{
|
|
||||||
HC25_ClearReceive;
|
|
||||||
HC25_SendBuff("ip", 3);
|
|
||||||
|
|
||||||
ip_str[0] = '\0';
|
|
||||||
|
|
||||||
if (HC25_ReceiveBuffUntil(ip_str, '\n', 1000) && strcmp(ip_str, "OK") == 0)
|
|
||||||
if (HC25_ReceiveBuffUntil(ip_str, '\n', 1000))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str)
|
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str)
|
||||||
{
|
{
|
||||||
HC25_ClearReceive;
|
HC25_ClearReceive;
|
||||||
HC25_SendBuff("ipaddr", 7);
|
HC25_SendBuff("ipaddr", 7);
|
||||||
|
|
||||||
ipaddr_str[0] = '\0';
|
ipaddr_str[0] = '\0';
|
||||||
|
|
||||||
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000) && strcmp(ipaddr_str, "OK") == 0)
|
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000) && strcmp(ipaddr_str, "OK") == 0)
|
||||||
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000))
|
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000))
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
|
|
||||||
uint8_t WLAN_CheckNet(void);
|
uint8_t WLAN_CheckNet(void);
|
||||||
uint8_t WLAN_GetIP(uint8_t *ip_str);
|
|
||||||
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str);
|
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str);
|
||||||
uint8_t WLAN_GetNetClockTime(uint8_t *clock_time_str);
|
uint8_t WLAN_GetNetClockTime(uint8_t *clock_time_str);
|
||||||
uint8_t WLAN_GetWeather(uint8_t *weather_str, uint8_t *city_str);
|
uint8_t WLAN_GetWeather(uint8_t *weather_str, uint8_t *city_str);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user