|
|
@@ -1272,30 +1272,48 @@ int parseDtu(char *json_string)
|
|
|
rt_sprintf(device_status.iccid,"%s",iccid->valuestring);
|
|
|
rt_kprintf("ICCID not change:%s-%s",iccid->valuestring,device_status.iccid);
|
|
|
}
|
|
|
- LOG_I("DTU时间:%s",datetime->valuestring);
|
|
|
- static char year_s[5],month_s[3],day_s[3],hour_s[3],min_s[3],sec_s[3];
|
|
|
- strncpy(year_s, datetime->valuestring, 4);
|
|
|
- strncpy(month_s,datetime->valuestring+4,2);
|
|
|
- strncpy(day_s,datetime->valuestring+6,2);
|
|
|
- strncpy(hour_s,datetime->valuestring+8,2);
|
|
|
- strncpy(min_s,datetime->valuestring+10,2);
|
|
|
- strncpy(sec_s,datetime->valuestring+12,2);
|
|
|
- if(atoi(year_s)>=2024&&atoi(year_s)<3000&&atoi(month_s)>0&&atoi(month_s)<13&&atoi(day_s)>0&&atoi(day_s)<32)
|
|
|
- {
|
|
|
- if(set_date(atoi(year_s),atoi(month_s),atoi(day_s))==RT_EOK)
|
|
|
+
|
|
|
+ if(datetime!=RT_NULL){
|
|
|
+ LOG_I("DTU时间:%s",datetime->valuestring);
|
|
|
+ int year, month, day, hour, minute, second;
|
|
|
+ sscanf(datetime->valuestring, "%4d%2d%2d%2d%2d%2d", &year, &month, &day, &hour, &minute, &second);
|
|
|
+ if(set_date(year,month,day)==RT_EOK)
|
|
|
{
|
|
|
- LOG_I("设置日期:%d年%d月%d日",atoi(year_s),atoi(month_s),atoi(day_s));
|
|
|
- if(atoi(hour_s)>0&&atoi(hour_s)<=24&&atoi(min_s)>=0&&atoi(min_s)<=60&&atoi(sec_s)>=0&&atoi(sec_s)<=60)
|
|
|
- {
|
|
|
- LOG_I("设置时间:%d时%d分%d秒",atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
- set_time(atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_E("set_date failed!");
|
|
|
- rt_hw_rtc_init();
|
|
|
+ LOG_I("设置日期:%d年%d月%d日",year,month,day);
|
|
|
+ if(hour<24&&minute>=0&&minute<60&&second>=0&&second<60)
|
|
|
+ {
|
|
|
+ LOG_I("设置时间:%d时%d分%d秒",hour,minute,second);
|
|
|
+ set_time(hour,minute,second);
|
|
|
+ }else{
|
|
|
+ LOG_E("set_date failed!");
|
|
|
+ rt_hw_rtc_init();
|
|
|
+ }
|
|
|
}
|
|
|
+// static char year_s[5],month_s[3],day_s[3],hour_s[3],min_s[3],sec_s[3];
|
|
|
+// strncpy(year_s, datetime->valuestring, 4);
|
|
|
+// strncpy(month_s,datetime->valuestring+4,2);
|
|
|
+// strncpy(day_s,datetime->valuestring+6,2);
|
|
|
+// strncpy(hour_s,datetime->valuestring+8,2);
|
|
|
+// strncpy(min_s,datetime->valuestring+10,2);
|
|
|
+// strncpy(sec_s,datetime->valuestring+12,2);
|
|
|
+// if(atoi(year_s)>=2024&&atoi(year_s)<3000&&atoi(month_s)>0&&atoi(month_s)<13&&atoi(day_s)>0&&atoi(day_s)<32)
|
|
|
+// {
|
|
|
+// if(set_date(atoi(year_s),atoi(month_s),atoi(day_s))==RT_EOK)
|
|
|
+// {
|
|
|
+// LOG_I("设置日期:%d年%d月%d日",atoi(year_s),atoi(month_s),atoi(day_s));
|
|
|
+// if(atoi(hour_s)>0&&atoi(hour_s)<=24&&atoi(min_s)>=0&&atoi(min_s)<=60&&atoi(sec_s)>=0&&atoi(sec_s)<=60)
|
|
|
+// {
|
|
|
+// LOG_I("设置时间:%d时%d分%d秒",atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
+// set_time(atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// LOG_E("set_date failed!");
|
|
|
+// rt_hw_rtc_init();
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
+
|
|
|
LOG_I("参数同步:lat:%s lng:%s",lat->valuestring,lng->valuestring);
|
|
|
//CSQ
|
|
|
if(csq!=NULL&&atoi(csq->valuestring)>=0&&atoi(csq->valuestring)<=31)
|