|
|
@@ -361,8 +361,27 @@ char * makeJson_ReadInfo()
|
|
|
cJSON_Delete(rJsonRoot);
|
|
|
return r;
|
|
|
}
|
|
|
+
|
|
|
+char *makeJson_ParsePhoto()
|
|
|
+{
|
|
|
+ cJSON * rJsonRoot = NULL;
|
|
|
+ rJsonRoot = cJSON_CreateObject();
|
|
|
+ if(NULL==rJsonRoot)
|
|
|
+ {
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ cJSON_AddStringToObject(rJsonRoot, "cmd", "ParsePhoto");
|
|
|
+ char * r = cJSON_PrintUnformatted(rJsonRoot);
|
|
|
+ if(NULL == r)
|
|
|
+ {
|
|
|
+ cJSON_Delete(rJsonRoot);
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+ cJSON_Delete(rJsonRoot);
|
|
|
+ return r;
|
|
|
+}
|
|
|
//{"cmd": "platform", "ext": {"type": "120.27.222.26"}}
|
|
|
-char * makeJson_platform(char *plt)
|
|
|
+char *makeJson_platform(char *plt)
|
|
|
{
|
|
|
cJSON * platform = NULL;
|
|
|
platform = cJSON_CreateObject();
|
|
|
@@ -539,6 +558,9 @@ char * makeJson()
|
|
|
else if (device_status.version_type==7) {
|
|
|
rt_sprintf(device_status.driver,"%s-%s",VERSION_BZY,device_status.driver_4g);
|
|
|
}
|
|
|
+ else if(device_status.version_type==8){
|
|
|
+ rt_sprintf(device_status.driver,"%s-%s",VERSION_XY3,device_status.driver_4g);
|
|
|
+ }
|
|
|
if(device_status.sensor_485_sta!=0)
|
|
|
{
|
|
|
if(strstr(device_status.driver,"485")==RT_NULL)
|
|
|
@@ -572,7 +594,7 @@ char * makeJson()
|
|
|
rt_sprintf(utos,"6");
|
|
|
cJSON_AddStringToObject(pSubJson,"vtype",utos);
|
|
|
}
|
|
|
- if(device_status.version_type!=6&&device_status.dtype!=7)
|
|
|
+ if(device_status.version_type!=6&&device_status.dtype!=7&&device_status.version_type!=8)
|
|
|
{
|
|
|
//光控定时
|
|
|
rt_sprintf(utos, "%d",device_status.sunBar);
|
|
|
@@ -694,15 +716,72 @@ char * makeJson()
|
|
|
rt_sprintf(utos, "%d",device_status.heatvalue);
|
|
|
cJSON_AddStringToObject(pSubJson,"set_temp",utos);
|
|
|
}
|
|
|
- if(device_status.dtype!=7)
|
|
|
+ if(device_status.dtype!=7&&device_status.dtype!=8)
|
|
|
{
|
|
|
//震动开关
|
|
|
rt_sprintf(utos, "%d",device_status.shake_ws);
|
|
|
cJSON_AddStringToObject(pSubJson,"shake",utos);
|
|
|
}
|
|
|
- //震动时间
|
|
|
- rt_sprintf(utos, "%d",device_status.shake_sec);
|
|
|
- cJSON_AddStringToObject(pSubJson,"shake_sec",utos);
|
|
|
+ if(device_status.dtype==8){
|
|
|
+ //电流(当前)
|
|
|
+ cJSON_AddStringToObject(pSubJson,"cc",device_status.power);
|
|
|
+ //电压
|
|
|
+ cJSON_AddStringToObject(pSubJson,"bv",device_status.voltage);
|
|
|
+ //电压状态-batStatus
|
|
|
+ rt_sprintf(utos, "%d",device_status.bat_status);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"bs",utos);
|
|
|
+ //工作状态
|
|
|
+ rt_sprintf(utos, "%d",device_status.work_status);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"ws",utos);
|
|
|
+ //开始时间
|
|
|
+ rt_sprintf(utos, "%d",device_status.startBar);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"st",utos);
|
|
|
+ //结束时间
|
|
|
+ rt_sprintf(utos, "%d",device_status.stopBar);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"et",utos);
|
|
|
+ //cs:充电标志位 0:非充电 1:充电
|
|
|
+ cJSON_AddStringToObject(pSubJson,"cs","0");
|
|
|
+ //rps雨控状态 0:正常 1:保护
|
|
|
+ rt_sprintf(utos, "%d",device_status.rain_status);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"rps",utos);
|
|
|
+ //定时模式
|
|
|
+ rt_sprintf(utos, "%d",device_status.timeSwitch);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"ts",utos);
|
|
|
+ //温控
|
|
|
+ rt_sprintf(utos, "%d",device_status.temp_status);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"tps",utos);
|
|
|
+ //倾倒状态
|
|
|
+ cJSON_AddStringToObject(pSubJson,"dps","0");
|
|
|
+ //cv 充电电压 单位:V 字符串类型
|
|
|
+ cJSON_AddStringToObject(pSubJson,"cv","0.0");
|
|
|
+ //volt_ct电击计数值
|
|
|
+ cJSON_AddStringToObject(pSubJson,"volt_ct","0");
|
|
|
+ //清虫间隔
|
|
|
+ cJSON_AddStringToObject(pSubJson,"clt_t","10");
|
|
|
+ //主板温度
|
|
|
+ rt_sprintf(utos, "%d.%d",Get_Temprate()/100,Get_Temprate()%100);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"bt",utos);
|
|
|
+ //volt_freq
|
|
|
+ cJSON_AddStringToObject(pSubJson,"volt_freq","3");
|
|
|
+ //barometric
|
|
|
+ cJSON_AddStringToObject(pSubJson,"barometric","0");
|
|
|
+ //wind_drec
|
|
|
+ cJSON_AddStringToObject(pSubJson,"wind_drec","0");
|
|
|
+ //wind_sped
|
|
|
+ cJSON_AddStringToObject(pSubJson,"wind_sped","0");
|
|
|
+ //cpu_temp
|
|
|
+ cJSON_AddStringToObject(pSubJson,"cpu_tmp",device_status.cpu_temp);
|
|
|
+ //camera_sta
|
|
|
+ cJSON_AddStringToObject(pSubJson,"cam_sta","0");
|
|
|
+ }else{
|
|
|
+ //震动时间
|
|
|
+ rt_sprintf(utos, "%d",device_status.shake_sec);
|
|
|
+ cJSON_AddStringToObject(pSubJson,"shake_sec",utos);
|
|
|
+ //电流(当前)
|
|
|
+ cJSON_AddStringToObject(pSubJson,"current",device_status.power);
|
|
|
+ //电压
|
|
|
+ cJSON_AddStringToObject(pSubJson,"vbat",device_status.voltage);
|
|
|
+ }
|
|
|
cJSON_AddStringToObject(pSubJson,"gps",device_status.gps); //定位状态
|
|
|
//开关状态
|
|
|
rt_sprintf(utos, "%d",device_status.ds);
|
|
|
@@ -720,10 +799,6 @@ char * makeJson()
|
|
|
cJSON_AddStringToObject(pSubJson,"lat",device_status.lat);
|
|
|
//是否为上电开机
|
|
|
cJSON_AddNumberToObject(pSubJson,"rcnt",device_status.rebootcnt);
|
|
|
- //电流(当前)
|
|
|
- cJSON_AddStringToObject(pSubJson,"current",device_status.power);
|
|
|
- //电压
|
|
|
- cJSON_AddStringToObject(pSubJson,"vbat",device_status.voltage);
|
|
|
//数据上传间隔
|
|
|
rt_sprintf(utos, "%d",device_status.dattim);
|
|
|
cJSON_AddStringToObject(pSubJson,"dat_f",utos);
|
|
|
@@ -1039,6 +1114,10 @@ int parseDtu(char *json_string)
|
|
|
{
|
|
|
DTU_Write("%s","SwversionV4");
|
|
|
}
|
|
|
+ else if (device_status.dtype==8)
|
|
|
+ {
|
|
|
+ DTU_Write("%s","SwversionV8");
|
|
|
+ }
|
|
|
#endif
|
|
|
device_status.refresh_timeout=0;
|
|
|
//driver_4g = cJSON_GetObjectItem(item_ext,"version");
|
|
|
@@ -1067,6 +1146,7 @@ int parseDtu(char *json_string)
|
|
|
HMI_WRITE("menu.eth1_sta.val=%d",atoi(value_commn->valuestring));
|
|
|
}
|
|
|
value_commn = cJSON_GetObjectItem(item_ext,"cpu_tmp");
|
|
|
+ sprintf(device_status.cpu_temp,"%s",value_commn->valuestring);
|
|
|
if(value_commn!=RT_NULL)
|
|
|
{
|
|
|
HMI_WRITE("menu.cpu_temp.txt=\"%d.%d℃\"",atoi(value_commn->valuestring)/1000,atoi(value_commn->valuestring)%1000);
|
|
|
@@ -1253,6 +1333,11 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
if(item_ext!=RT_NULL&&strstr(item_cmd->valuestring,"paramconf")!=RT_NULL)
|
|
|
{
|
|
|
+ cJSON *work_tim = cJSON_GetObjectItem(item_ext,"work_tim");
|
|
|
+ cJSON *data_tim = cJSON_GetObjectItem(item_ext,"data_tim");
|
|
|
+ cJSON *power = cJSON_GetObjectItem(item_ext,"power");
|
|
|
+ cJSON *clt_tim = cJSON_GetObjectItem(item_ext,"clt_tim");
|
|
|
+
|
|
|
if(device_status.dtype==3)
|
|
|
hst = cJSON_GetObjectItem(item_ext,"hst");
|
|
|
if(device_status.dtype==7)
|
|
|
@@ -1278,11 +1363,27 @@ int parseDtu(char *json_string)
|
|
|
|
|
|
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");
|
|
|
+
|
|
|
+ if(work_tim!=RT_NULL){
|
|
|
+ ts = cJSON_GetObjectItem(work_tim,"timctrl");
|
|
|
+ st = cJSON_GetObjectItem(work_tim,"st");
|
|
|
+ et = cJSON_GetObjectItem(work_tim,"et");
|
|
|
+ }
|
|
|
+ if(data_tim!=RT_NULL){
|
|
|
+ datt = cJSON_GetObjectItem(data_tim,"dat_f");
|
|
|
+ }
|
|
|
+ if(power!=RT_NULL){
|
|
|
+ ds = cJSON_GetObjectItem(power,"ds");
|
|
|
+ }
|
|
|
+ if(clt_tim!=RT_NULL){
|
|
|
+ cul_time = cJSON_GetObjectItem(clt_tim,"clt_t");
|
|
|
+ }
|
|
|
if(drop_sec!=NULL)
|
|
|
{
|
|
|
if(drop_sec->valueint>=1&&drop_sec->valueint<=300)
|
|
|
@@ -1294,11 +1395,11 @@ int parseDtu(char *json_string)
|
|
|
}
|
|
|
if(cul_time!=NULL)
|
|
|
{
|
|
|
- if(cul_time->valueint>=1&&cul_time->valueint<=24)
|
|
|
+ if(cul_time->valueint>=1&&cul_time->valueint<=60)
|
|
|
{
|
|
|
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);
|
|
|
+ LOG_I("下发设置培养(计数间隔)时间:%d",cul_time->valueint);
|
|
|
}
|
|
|
}
|
|
|
/*加热温度*/
|