mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 13:38:14 +08:00
记住状态
This commit is contained in:
@@ -64,7 +64,7 @@ static int HttpGetTc1Status(httpd_request_t *req)
|
|||||||
{
|
{
|
||||||
const unsigned char* sockets = GetSocketStatus();
|
const unsigned char* sockets = GetSocketStatus();
|
||||||
char* tc1_status = malloc(256);
|
char* tc1_status = malloc(256);
|
||||||
sprintf(tc1_status, TC1_STATUS_JSON, sockets, (int)sys_config->micoSystemConfig.reserved,
|
sprintf(tc1_status, TC1_STATUS_JSON, sockets, ip_status.mode,
|
||||||
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
|
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
|
||||||
ELAND_AP_SSID, ELAND_AP_KEY, ip_status.ip, ip_status.mask, ip_status.gateway);
|
ELAND_AP_SSID, ELAND_AP_KEY, ip_status.ip, ip_status.mask, ip_status.gateway);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
char wifi_status = WIFI_STATE_NOCONNECT;
|
char wifi_status = WIFI_STATE_NOCONNECT;
|
||||||
|
|
||||||
mico_timer_t wifi_led_timer;
|
mico_timer_t wifi_led_timer;
|
||||||
IpStatus ip_status = { ELAND_AP_LOCAL_IP, ELAND_AP_LOCAL_IP, ELAND_AP_NET_MASK };
|
IpStatus ip_status = { 0, ELAND_AP_LOCAL_IP, ELAND_AP_LOCAL_IP, ELAND_AP_NET_MASK };
|
||||||
|
|
||||||
//wifi已连接获取到IP地址回调
|
//wifi已连接获取到IP地址回调
|
||||||
static void WifiGetIpCallback(IPStatusTypedef *pnet, void * arg)
|
static void WifiGetIpCallback(IPStatusTypedef *pnet, void * arg)
|
||||||
@@ -40,6 +40,7 @@ static void WifiStatusCallback(WiFiEvent status, void* arg)
|
|||||||
os_log("close ap error[%d]", status);
|
os_log("close ap error[%d]", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ip_status.mode = 1;
|
||||||
//wifi_status = WIFI_STATE_CONNECTED;
|
//wifi_status = WIFI_STATE_CONNECTED;
|
||||||
}
|
}
|
||||||
else if (status == NOTIFY_STATION_DOWN) //wifi断开
|
else if (status == NOTIFY_STATION_DOWN) //wifi断开
|
||||||
@@ -56,6 +57,10 @@ static void WifiStatusCallback(WiFiEvent status, void* arg)
|
|||||||
mico_rtos_start_timer(&wifi_led_timer);
|
mico_rtos_start_timer(&wifi_led_timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (status == NOTIFY_AP_UP)
|
||||||
|
{
|
||||||
|
ip_status.mode = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool scaned = false;
|
bool scaned = false;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ enum
|
|||||||
WIFI_STATE_CONNECTED,
|
WIFI_STATE_CONNECTED,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ELAND_AP_SSID "TC1-AP-MAC"
|
#define ELAND_AP_SSID "TC1-AP"
|
||||||
#define ELAND_AP_KEY "12345678"
|
#define ELAND_AP_KEY "12345678"
|
||||||
#define ELAND_AP_LOCAL_IP "192.168.0.1"
|
#define ELAND_AP_LOCAL_IP "192.168.0.1"
|
||||||
#define ELAND_AP_DNS_SERVER "192.168.0.1"
|
#define ELAND_AP_DNS_SERVER "192.168.0.1"
|
||||||
@@ -26,6 +26,7 @@ extern char* wifi_ret;
|
|||||||
extern char wifi_status;
|
extern char wifi_status;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
int mode; //0:AP, 1:Station
|
||||||
char ip[16];
|
char ip[16];
|
||||||
char gateway[16];
|
char gateway[16];
|
||||||
char mask[16];
|
char mask[16];
|
||||||
|
|||||||
Reference in New Issue
Block a user