|
|
@@ -727,24 +727,20 @@ int Parse_Cam_Param(cJSON *param_msg)
|
|
|
//JSON数据解析
|
|
|
int parseDtu(char *json_string)
|
|
|
{
|
|
|
- extern int rt_hw_rtc_init(void);
|
|
|
char* json_s = NULL;
|
|
|
cJSON* item_cmd = NULL; //嵌套ext
|
|
|
cJSON* item_focus = NULL;
|
|
|
cJSON* item_ext = NULL; //嵌套ext
|
|
|
cJSON* photo_sta = NULL;
|
|
|
- cJSON* hst = NULL; //加热温度
|
|
|
+
|
|
|
cJSON* collt = NULL; //收集时间
|
|
|
- cJSON* et = NULL; //结束时间
|
|
|
+
|
|
|
cJSON* datt = NULL; //数据上传间隔
|
|
|
- cJSON* shake_sec = NULL; //震动时间
|
|
|
+
|
|
|
cJSON* tpl = NULL; //低温保护阈值
|
|
|
- cJSON* shake = NULL; //震动开关
|
|
|
+
|
|
|
cJSON* tph = NULL; //高温保护阈值
|
|
|
- cJSON* ts = NULL; //工作模式
|
|
|
- cJSON* st = NULL; //开始时间
|
|
|
- cJSON* tt = NULL; //光控定时时长
|
|
|
- cJSON* htim = NULL; //加热时间
|
|
|
+
|
|
|
cJSON* gps = NULL; //定位状态
|
|
|
cJSON* datetime = NULL;
|
|
|
cJSON* lat = NULL;
|
|
|
@@ -758,7 +754,6 @@ int parseDtu(char *json_string)
|
|
|
cJSON* driver_4g = NULL; //版本号
|
|
|
cJSON* project = NULL; //Project
|
|
|
cJSON* ds = NULL; //设备状态
|
|
|
- cJSON* vt = NULL; //版本类型
|
|
|
cJSON* mqttcfg1 = NULL;
|
|
|
cJSON* mqttcfg2 = NULL;
|
|
|
cJSON* type =NULL;
|
|
|
@@ -892,35 +887,7 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (strstr(item_cmd->valuestring,"json_w_clock")!=RT_NULL) {
|
|
|
- rt_kprintf("查询时间配置!\n");
|
|
|
- json_s = makeJson_Warn(device_status.json_w_clock, "主动查询");
|
|
|
- DTU_Write("%s",json_s);
|
|
|
- rt_free(json_s);
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- else if (strstr(item_cmd->valuestring,"json_w_reset")!=RT_NULL) {
|
|
|
- rt_kprintf("查询重置配置!\n");
|
|
|
- json_s = makeJson_Warn(device_status.json_w_reset, "主动查询");
|
|
|
- DTU_Write("%s",json_s);
|
|
|
- rt_free(json_s);
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- else if (strstr(item_cmd->valuestring,"json_w_platform")!=RT_NULL) {
|
|
|
- rt_kprintf("查询平台配置!\n");
|
|
|
- json_s = makeJson_Warn(device_status.json_w_platform, "主动查询");
|
|
|
- DTU_Write("%s",json_s);
|
|
|
- rt_free(json_s);
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- else if (strstr(item_cmd->valuestring,"shake")!=RT_NULL)
|
|
|
- {
|
|
|
- ctr_shake(ON, 30);
|
|
|
- char *shake = makeJson_Warn("shake","control");
|
|
|
- DTU_Write("%s",shake);
|
|
|
- rt_free(shake);
|
|
|
- rt_thread_delay(2000);
|
|
|
- }
|
|
|
+
|
|
|
//远程给rtu重新上电
|
|
|
else if (strstr(item_cmd->valuestring,"ctrl")!=RT_NULL)
|
|
|
{
|
|
|
@@ -977,15 +944,6 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //水稻2000万像素的串口拍照指令
|
|
|
- else if (strstr(item_cmd->valuestring,"mvs_photo")!=RT_NULL)
|
|
|
- {
|
|
|
- HK_TakePhoto();
|
|
|
- char *photo = makeJson_Warn("mvs_takephoto","control");
|
|
|
- DTU_Write("%s",photo);
|
|
|
- rt_free(photo);
|
|
|
- rt_thread_delay(2000);
|
|
|
- }
|
|
|
else if (strstr(item_cmd->valuestring,"reboot")!=RT_NULL)
|
|
|
{
|
|
|
char *restart = makeJson_Warn("sysrem will restart","control");
|
|
|
@@ -1072,16 +1030,6 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (strstr(item_cmd->valuestring,"color")!=RT_NULL)
|
|
|
- {
|
|
|
- if(item_ext!=RT_NULL&&strstr(item_ext->valuestring,"turn")!=RT_NULL)
|
|
|
- {
|
|
|
- device_status.run_sta=5;
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_W("Unknow cmd value!");
|
|
|
- }
|
|
|
- }
|
|
|
else if (strstr(item_cmd->valuestring,"synchronization")!=RT_NULL)
|
|
|
{
|
|
|
device_status.refresh_timeout=0;
|
|
|
@@ -1207,17 +1155,6 @@ int parseDtu(char *json_string)
|
|
|
rt_sprintf(device_status.gps,"%s",gps->valuestring);
|
|
|
if(atoi(gps->valuestring)!=0)
|
|
|
{
|
|
|
- #if BOOT_ERR == 1
|
|
|
- if(atoi(gps->valuestring)==1)
|
|
|
- rt_sprintf(device_status.gps_state, "%s","GPS+BD");
|
|
|
-
|
|
|
- if(gps_inuse!=NULL){
|
|
|
- device_status.gps_inuse = atoi(gps_inuse->valuestring);
|
|
|
- }
|
|
|
- if(gps_view!=NULL){
|
|
|
- device_status.gps_view = atoi(gps_view->valuestring);
|
|
|
- }
|
|
|
- #endif
|
|
|
if(strstr(device_status.lat,lat->valuestring)==NULL)
|
|
|
{
|
|
|
memset(device_status.lat,0,sizeof(device_status.lat));
|
|
|
@@ -1296,36 +1233,20 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
if(item_ext!=RT_NULL&&strstr(item_cmd->valuestring,"paramconf")!=RT_NULL)
|
|
|
{
|
|
|
- if(device_status.dtype==3)
|
|
|
- hst = cJSON_GetObjectItem(item_ext,"hst");
|
|
|
- if(device_status.dtype==7)
|
|
|
- hst = cJSON_GetObjectItem(item_ext,"set_temp");
|
|
|
-
|
|
|
- et = cJSON_GetObjectItem(item_ext,"et");
|
|
|
datt = cJSON_GetObjectItem(item_ext,"datt");
|
|
|
-
|
|
|
- shake_sec = cJSON_GetObjectItem(item_ext,"shake_sec");
|
|
|
tpl = cJSON_GetObjectItem(item_ext,"tpl");
|
|
|
- shake = cJSON_GetObjectItem(item_ext,"shake");
|
|
|
- tph = cJSON_GetObjectItem(item_ext,"tph");
|
|
|
- ts = cJSON_GetObjectItem(item_ext,"ts");
|
|
|
- st = cJSON_GetObjectItem(item_ext,"st");
|
|
|
- tt = cJSON_GetObjectItem(item_ext,"tt");
|
|
|
- htim = cJSON_GetObjectItem(item_ext,"htim");
|
|
|
+
|
|
|
if(device_status.dtype==3)
|
|
|
ds = cJSON_GetObjectItem(item_ext,"ds");
|
|
|
- vt = cJSON_GetObjectItem(item_ext,"vt");
|
|
|
|
|
|
- if(device_status.dtype==3)
|
|
|
- collt = cJSON_GetObjectItem(item_ext,"collt");
|
|
|
|
|
|
if(device_status.dtype==7)
|
|
|
ds = cJSON_GetObjectItem(item_ext,"on_off");
|
|
|
if(device_status.dtype==7)
|
|
|
collt = cJSON_GetObjectItem(item_ext,"coll_time"); //收集(数组格式)
|
|
|
|
|
|
- cJSON* cul_time = cJSON_GetObjectItem(item_ext,"cul_time"); //培养时间1~24
|
|
|
- cJSON* drop_sec = cJSON_GetObjectItem(item_ext,"drop_time");
|
|
|
+ cJSON* coll_min = cJSON_GetObjectItem(item_ext,"coll_min"); //采集分钟,数组格式
|
|
|
+
|
|
|
cJSON* x_init_dis= cJSON_GetObjectItem(item_ext,"x_init_dis");
|
|
|
cJSON* y_init_dis= cJSON_GetObjectItem(item_ext,"y_init_dis");
|
|
|
if(x_init_dis!=NULL)
|
|
|
@@ -1346,133 +1267,69 @@ int parseDtu(char *json_string)
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(drop_sec!=NULL)
|
|
|
- {
|
|
|
- if(drop_sec->valueint>=1&&drop_sec->valueint<=300)
|
|
|
- {
|
|
|
- device_status.shake_sec = drop_sec->valueint;
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //培养时间
|
|
|
- LOG_I("下发设置滴液时间:%d",drop_sec->valueint);
|
|
|
- }
|
|
|
- }
|
|
|
- if(cul_time!=NULL)
|
|
|
- {
|
|
|
- if(cul_time->valueint>=1&&cul_time->valueint<=24)
|
|
|
- {
|
|
|
- device_status.cul_time = cul_time->valueint;
|
|
|
- ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time)); //培养时间
|
|
|
- LOG_I("下发设置培养时间:%d",cul_time->valueint);
|
|
|
- }
|
|
|
- }
|
|
|
- /*加热温度*/
|
|
|
- if(hst!=NULL)
|
|
|
- {
|
|
|
- if(hst->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(hst->valueint>=10&&hst->valueint<=150)
|
|
|
- {
|
|
|
- device_status.heatvalue = hst->valueint;
|
|
|
- ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue)); //开始时间
|
|
|
- LOG_I("加热温度hst:%d",hst->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("加热温度hst设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if(atoi(hst->valuestring)>10&&atoi(hst->valuestring)<150)
|
|
|
- {
|
|
|
- device_status.heatvalue=atoi(hst->valuestring);
|
|
|
- ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue)); //加热温度
|
|
|
- LOG_I("加热温度hst:%d",atoi(hst->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("加热温度hst设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-#if 1 //三色光源无法修改开始和结束时间
|
|
|
- if (st!=NULL)
|
|
|
- {
|
|
|
- if(st->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(st->valueint>=0&&st->valueint<=23)
|
|
|
- {
|
|
|
- device_status.startBar = st->valueint;
|
|
|
- ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar)); //开始时间
|
|
|
- LOG_I("开始时间st:%d",st->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("开始时间st设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if(atoi(st->valuestring)>=0&&atoi(st->valuestring)<=23)
|
|
|
- {
|
|
|
- device_status.startBar = atoi(st->valuestring);
|
|
|
- ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar)); //开始时间
|
|
|
- LOG_I("开始时间st:%d",atoi(st->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("开始时间st设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if(et!=NULL)
|
|
|
- {
|
|
|
- if(et->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(et->valueint>=0&&et->valueint<=23)
|
|
|
- {
|
|
|
- device_status.stopBar = et->valueint;
|
|
|
- ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar)); //结束时间
|
|
|
- LOG_I("结束时间et:%d",et->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("结束时间et设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if(et->type==cJSON_String){
|
|
|
- if(atoi(et->valuestring)>=0&&atoi(et->valuestring)<=23)
|
|
|
- {
|
|
|
- device_status.stopBar = atoi(et->valuestring);
|
|
|
- ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar)); //结束时间
|
|
|
- LOG_I("结束时间et:%d",atoi(et->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("结束时间et设置失败参数错误!!!");
|
|
|
+ if(coll_min!=NULL){
|
|
|
+ if(coll_min->type==cJSON_Array) {
|
|
|
+ // 获取数组大小
|
|
|
+ int array_size = cJSON_GetArraySize(coll_min);
|
|
|
+ // 遍历数组中的所有元素
|
|
|
+ for (int i = 0; i < array_size; i++){
|
|
|
+ cJSON *item = cJSON_GetArrayItem(coll_min, i);
|
|
|
+ if (cJSON_IsString(item) && item->valuestring != NULL) {
|
|
|
+ char *range_str = item->valuestring;
|
|
|
+ char *delimiter = strchr(range_str, '-');
|
|
|
+ if (delimiter != NULL) {
|
|
|
+ // 提取起始值和结束值
|
|
|
+ char min_st[5] = {0};
|
|
|
+ char min_et[5] = {0};
|
|
|
+ strncpy(min_st, range_str, delimiter - range_str);
|
|
|
+ strcpy(min_et, delimiter + 1);
|
|
|
+ int min_st_INT = atoi(min_st);
|
|
|
+ int min_et_INT = atoi(min_et);
|
|
|
+ if(i==0){
|
|
|
+ if(min_st_INT<60&&min_st_INT>=0){
|
|
|
+ device_status.collt_min_sh1 = min_st_INT;
|
|
|
+ ef_set_and_save_env("collt_min_sh1", min_st);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(min_et_INT<60&&min_et_INT>=0){
|
|
|
+ device_status.collt_min_eh1 = min_et_INT;
|
|
|
+ ef_set_and_save_env("collt_min_eh1", min_et);
|
|
|
+ }
|
|
|
+ LOG_W("第1段开始:%d 第1段结束:%d",device_status.collt_min_sh1,
|
|
|
+ device_status.collt_min_eh1);
|
|
|
+ }else if (i==1) {
|
|
|
+ if(min_st_INT<60&&min_st_INT>=0){
|
|
|
+ device_status.collt_min_sh2 = min_st_INT;
|
|
|
+ ef_set_and_save_env("collt_min_sh2", min_st);
|
|
|
+ }
|
|
|
+ if(min_et_INT<60&&min_et_INT>=0){
|
|
|
+ device_status.collt_min_eh2 = min_et_INT;
|
|
|
+ ef_set_and_save_env("collt_min_eh2", min_et);
|
|
|
+ }
|
|
|
+ LOG_W("第2段开始:%d 第2段结束:%d",device_status.collt_min_sh2,
|
|
|
+ device_status.collt_min_eh2);
|
|
|
+
|
|
|
+ }else if (i==2) {
|
|
|
+ if(min_st_INT<60&&min_st_INT>=0){
|
|
|
+ device_status.collt_min_sh3 = min_st_INT;
|
|
|
+ ef_set_and_save_env("collt_min_sh3", min_st);
|
|
|
+ }
|
|
|
+ if(min_et_INT<60&&min_et_INT>=0){
|
|
|
+ device_status.collt_min_eh3 = min_et_INT;
|
|
|
+ ef_set_and_save_env("collt_min_eh3", min_et);
|
|
|
+ }
|
|
|
+ LOG_W("第3段开始:%d 第3段结束:%d",device_status.collt_min_sh3,
|
|
|
+ device_status.collt_min_eh3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#endif
|
|
|
+ /*加热温度*/
|
|
|
if(collt!=NULL)
|
|
|
{
|
|
|
- if(collt->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(collt->valueint>=1&&collt->valueint<=60)
|
|
|
- {
|
|
|
- device_status.clt_time = collt->valueint;
|
|
|
- ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time)); //收集时间
|
|
|
- LOG_I("收集时间collt:%d",collt->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("收集时间collt设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (collt->type==cJSON_String) {
|
|
|
- if(atoi(collt->valuestring)>=1&&atoi(collt->valuestring)<=60)
|
|
|
- {
|
|
|
- device_status.clt_time = atoi(collt->valuestring);
|
|
|
- ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time)); //收集时间
|
|
|
- LOG_I("收集时间collt:%d",atoi(collt->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("收集时间collt设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (collt->type==cJSON_Array) {
|
|
|
+ if (collt->type==cJSON_Array) {
|
|
|
int icnt = 0;
|
|
|
for(icnt=0;icnt < cJSON_GetArraySize(collt);icnt++)
|
|
|
{
|
|
|
@@ -1585,130 +1442,7 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(shake_sec!=NULL)
|
|
|
- {
|
|
|
- if(shake_sec->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(shake_sec->valueint>=1&&shake_sec->valueint<=1000)
|
|
|
- {
|
|
|
- device_status.shake_sec = shake_sec->valueint;
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //震动时间
|
|
|
- LOG_I("震动时间shake_sec:%d",shake_sec->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("震动时间shake_sec设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (shake_sec->type==cJSON_String) {
|
|
|
- if(atoi(shake_sec->valuestring)>=1&&atoi(shake_sec->valuestring)<=1000)
|
|
|
- {
|
|
|
- device_status.shake_sec = atoi(shake_sec->valuestring);
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //震动时间
|
|
|
- LOG_I("震动时间shake_sec:%d",atoi(shake_sec->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("震动时间shake_sec设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if(shake!=NULL)
|
|
|
- {
|
|
|
- if(shake->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(shake->valueint==0||shake->valueint==1)
|
|
|
- {
|
|
|
- device_status.shake_ws = shake->valueint;
|
|
|
- ef_set_env_blob("shake_ws", &device_status.shake_ws, sizeof(device_status.shake_ws)); //震动开关
|
|
|
- LOG_I("震动开关shake:%d",shake->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("震动开关shake设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (shake->type==cJSON_String) {
|
|
|
- if(atoi(shake->valuestring)==0||atoi(shake->valuestring)==1)
|
|
|
- {
|
|
|
- device_status.shake_ws = atoi(shake->valuestring);
|
|
|
- ef_set_env_blob("shake_ws", &device_status.shake_ws, sizeof(device_status.shake_ws)); //震动开关
|
|
|
- LOG_I("震动开关shake:%d",atoi(shake->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("震动开关shake设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- if(htim!=NULL)
|
|
|
- {
|
|
|
- if(htim->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(htim->valueint>=1&&htim->valueint<=30)
|
|
|
- {
|
|
|
- device_status.heattime = htim->valueint;
|
|
|
- ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime)); //加热时间
|
|
|
- LOG_I("加热时长htim:%d",htim->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("加热时长htim设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (htim->type==cJSON_String) {
|
|
|
- if(atoi(htim->valuestring)>=1&&atoi(htim->valuestring)<=30)
|
|
|
- {
|
|
|
- device_status.heattime = atoi(htim->valuestring);
|
|
|
- ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime)); //加热时间
|
|
|
- LOG_I("加热时长htim:%d",atoi(htim->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("加热时长htim设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(ts!=NULL)
|
|
|
- {
|
|
|
- if(ts->type==cJSON_Number)
|
|
|
- {
|
|
|
- if(ts->valueint==0||ts->valueint==1)
|
|
|
- {
|
|
|
- device_status.timeSwitch = ts->valueint;
|
|
|
- ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch)); //工作模式
|
|
|
- // time_t now;
|
|
|
- // time(&now);
|
|
|
- // static struct tm nowstamp;
|
|
|
- // nowstamp =*localtime(&now);
|
|
|
- // nowstamp.tm_hour = nowstamp.tm_hour - 8;
|
|
|
- // static rt_uint32_t nowstamp_num = 0;
|
|
|
- // nowstamp_num = mktime(&nowstamp);
|
|
|
- // device_status.light_over_tim = device_status.sunBar * 3600 + nowstamp_num;
|
|
|
- LOG_I("定时模式ts:%d",ts->valueint);
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("定时模式ts设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (ts->type==cJSON_String) {
|
|
|
- if(atoi(ts->valuestring)==0||atoi(ts->valuestring)==1)
|
|
|
- {
|
|
|
-
|
|
|
- device_status.timeSwitch = atoi(ts->valuestring);
|
|
|
- ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch)); //工作模式
|
|
|
- // time_t now;
|
|
|
- // time(&now);
|
|
|
- // static struct tm nowstamp;
|
|
|
- // nowstamp =*localtime(&now);
|
|
|
- // nowstamp.tm_hour = nowstamp.tm_hour - 8;
|
|
|
- // static rt_uint32_t nowstamp_num = 0;
|
|
|
- // nowstamp_num = mktime(&nowstamp);
|
|
|
- // device_status.light_over_tim = device_status.sunBar * 3600 + nowstamp_num;
|
|
|
- LOG_I("定时模式ts:%d",atoi(ts->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_I("定时模式ts设置失败参数错误!!!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
if(tpl!=NULL)
|
|
|
{
|
|
|
if(tpl->type==cJSON_Number)
|
|
|
@@ -1790,25 +1524,6 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(vt!=NULL)
|
|
|
- {
|
|
|
- if(atoi(vt->valuestring)>=0&&atoi(vt->valuestring)<=100)
|
|
|
- {
|
|
|
- device_status.version_type = atoi(vt->valuestring);
|
|
|
- ef_set_env_blob("version_type", &device_status.version_type, sizeof(device_status.version_type));
|
|
|
- if(device_status.version_type==7)
|
|
|
- {
|
|
|
- device_status.dtype = 7;
|
|
|
- ef_set_env_blob("dtype", &device_status.dtype, sizeof(device_status.dtype));
|
|
|
- }
|
|
|
- rt_kprintf("版本类型vt:%d\n",atoi(vt->valuestring));
|
|
|
- }
|
|
|
- else {
|
|
|
- rt_kprintf("版本类型设置失败参数错误!!!\n");
|
|
|
- }
|
|
|
- }
|
|
|
- UpLoad_Data();
|
|
|
- rt_thread_delay(1000);
|
|
|
}
|
|
|
}
|
|
|
cJSON_Delete(root);
|