与APP协议通讯验证,并添加获取与修改wifi、ble设置命令
This commit is contained in:
@@ -99,24 +99,42 @@ void app_thread(void* arg)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
switch(0)
|
||||
switch(sertrf.resend_device.handle_flag)
|
||||
{
|
||||
case 0:
|
||||
case RESEND_CMD_GET_PARAM:
|
||||
sertrf_stauct_t sertrf_stauct;
|
||||
|
||||
strcpy(sertrf_stauct.ble_name, g_cfg_app->device_name_ble);
|
||||
strcpy(sertrf_stauct.wifi_ap_ssid, g_cfg_app->app_config_wifi_para.wifi_ap_ssid);
|
||||
strcpy(sertrf_stauct.wifi_ap_password, g_cfg_app->app_config_wifi_para.wifi_ap_password);
|
||||
strcpy(sertrf_stauct.wifi_sta_ssid, g_cfg_app->app_config_wifi_para.wifi_sta_ssid);
|
||||
strcpy(sertrf_stauct.wifi_sta_password, g_cfg_app->app_config_wifi_para.wifi_sta_password);
|
||||
|
||||
resend_send_data(&sertrf.resend_device, RESEND_CMD_GET_PARAM, &sertrf_stauct, sizeof(sertrf_stauct_t), 100);
|
||||
|
||||
sertrf.resend_device.handle_flag = 0;//标志位清零
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
resend_recv_data(&sertrf.resend_device,0);
|
||||
resend_recv_data(&sertrf.resend_device, 0);
|
||||
// static uint8_t count = 0;
|
||||
// count++;
|
||||
// if(count > 100)
|
||||
// {
|
||||
// // resend_send_cmd(&sertrf.resend_device, RESEND_CMD_ACK, 0);
|
||||
// resend_send_data(&sertrf.resend_device, RESEND_CMD_GET_PARAM, NULL, 0, 0);
|
||||
// // count = 0;
|
||||
// }
|
||||
// uint32_t app_size = app_device_get_rx_length(&sertrf.device);
|
||||
|
||||
// if(app_size > 0)
|
||||
// {
|
||||
// uint8_t data[app_size];
|
||||
// app_device_read(&sertrf.device, data, app_size,0);
|
||||
// // printf("data:%d:%s\n", app_size,data);
|
||||
// printf("data:%d:%s\n", app_size,data);
|
||||
// }
|
||||
os_thread_sleep(1);
|
||||
}
|
||||
@@ -263,6 +281,22 @@ void resend_user_parse(void *resend_device)
|
||||
resend_device_t* resend_parse = (resend_device_t*)resend_device;
|
||||
switch(resend_parse->rx_frame.cmd)
|
||||
{
|
||||
case RESEND_CMD_SET_PARAM:
|
||||
if(sizeof(sertrf_stauct_t) != resend_parse->rx_frame.len)
|
||||
{
|
||||
printf("RESEND_CMD_SET_PARAM len error\r\n");
|
||||
}
|
||||
sertrf_stauct_t* sertrf_stauct = (sertrf_stauct_t*)resend_parse->rx_frame.payload;
|
||||
|
||||
app_cfg_set_device_name_ble(sertrf_stauct->ble_name, strlen(sertrf_stauct->ble_name));
|
||||
app_cfg_set_wifi_ap_ssid(sertrf_stauct->wifi_ap_ssid);
|
||||
app_cfg_set_wifi_ap_password(sertrf_stauct->wifi_ap_password);
|
||||
app_cfg_set_wifi_sta_ssid(sertrf_stauct->wifi_sta_ssid);
|
||||
app_cfg_set_wifi_sta_password(sertrf_stauct->wifi_sta_password);
|
||||
resend_send_cmd(resend_device, RESEND_CMD_ACK, 0);
|
||||
os_thread_sleep(1000);
|
||||
esp_restart();
|
||||
break;
|
||||
case RESEND_CMD_OTA_START:
|
||||
{
|
||||
if(!sertrf.resend_device.status.resend_flag)
|
||||
|
||||
Reference in New Issue
Block a user