diff --git a/main.c b/main.c index 2431f4a..5eb26ef 100644 --- a/main.c +++ b/main.c @@ -59,7 +59,7 @@ int fd; int UPCASE=0; int count_value=0; int getPayloadTime=120*1000;//usecond -char softwareVersion[16]="1.1.13"; +char softwareVersion[16]="1.1.15"; char stationsn[16]="TJ251372224247";//TJ250995217957 char productid[8]="10045"; char appKey[32]="fdhQmhqhvbL1cf1K9mUqt"; @@ -695,7 +695,6 @@ int readQrcode() ret = pthread_create(&pt_handleqrcode,NULL,actHandleQrcode,input_value_copy); if(ret!=0){ LOG_I("pthread_create handleqrcode fail\n"); - system("reboot"); }else{ pthread_detach(pt_handleqrcode); } @@ -1802,8 +1801,7 @@ void *thread_mqtt_recv(void *arg){ system("reboot"); }else if(strcmp(mqtt_parm.msg_type,"1014")==0){ LOG_I("1014 update fw\n"); - system("rm -fr ota"); - system("mkdir ota"); + isSendComEnd=false; get_int_from_json_string_by_key(msg_data, "needWifi", &mqtt_parm.msg_needWifi); LOG_I("needWifi:%d\n",mqtt_parm.msg_needWifi); get_string_from_json_string_by_key_unescape(msg_data, "zipPath", mqtt_parm.msg_zipPath, sizeof(mqtt_parm.msg_zipPath)); @@ -1818,14 +1816,15 @@ void *thread_mqtt_recv(void *arg){ LOG_I("version:%s\n",mqtt_parm.msg_version); mqtt_service_reply(stationsn,mqtt_parm.msg_messageId,"ok",1,productid); char otaCmd[256]={0}; - sprintf(otaCmd,"curl -o /root/ota/tx_ota.zip %s",mqtt_parm.msg_zipPath); + sprintf(otaCmd,"curl -o /userdata/tx_ota.zip %s",mqtt_parm.msg_zipPath); //sprintf(otaCmd,"curl -o /root/tx_server https://fscdn.zto.com/cloudm/iot-device-package/7d609af2165b4d14ae318f17659b2fbf.bin"); system(otaCmd); sleep(15); - system("unzip ota/tx_ota.zip"); - system("mv tx_ota/* ota"); - system("rm -fr tx_ota"); - system("mv ota/start.sh /root"); + system("unzip /userdata/tx_ota.zip"); + //system("mv ../tx_ota/* /userdata/ota"); + //system("rm -fr /userdata/ota/tx_ota"); + system("mv /userdata/tx_ota /userdata/ota"); + system("mv /userdata/ota/ustart.sh /userdata"); system("sync"); sleep(1); system("reboot"); @@ -2227,25 +2226,25 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_watchdog,NULL,thread_feed_watchdog,NULL); if(ret!=0){ LOG_I("pthread_create watchdog fail\n"); - system("reboot"); }else{ LOG_I("pthread_create watchdog success\n"); pthread_detach(pt_watchdog); } #endif + +#if 0 ret = pthread_create(&pt_reboot,NULL,thread_reboot,NULL); if(ret!=0){ LOG_I("pthread_create reboot fail\n"); - system("reboot"); }else{ LOG_I("pthread_create reboot success\n"); pthread_detach(pt_reboot); } +#endif ret = pthread_create(&pt_uart_recv_ack,NULL,thread_uart_recv_ack,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_ack fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_ack); LOG_I("pthread_create uart_recv_ack success\n"); @@ -2254,7 +2253,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_uart_recv_data,NULL,thread_uart_recv_data,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_data fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_data); LOG_I("pthread_create uart_recv_data success\n"); @@ -2263,7 +2261,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_uart_recv_back,NULL,thread_uart_recv_back,NULL); if(ret!=0){ LOG_I("pthread_create uart_recv_back fail\n"); - system("reboot"); }else{ pthread_detach(pt_uart_recv_back); LOG_I("pthread_create uart_recv_back success\n"); @@ -2272,7 +2269,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_mqtt_recv,NULL,thread_mqtt_recv,NULL); if(ret!=0){ LOG_I("pthread_create mqtt_recv fail\n"); - system("reboot"); }else{ pthread_detach(pt_mqtt_recv); LOG_I("pthread_create mqtt_recv success\n"); @@ -2281,7 +2277,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_tagsearch,NULL,thread_tag_search_send,NULL); if(ret!=0){ LOG_I("pthread_create tag search send fail\n"); - system("reboot"); }else{ LOG_I("pthread_create tag search success\n"); pthread_detach(pt_tagsearch); @@ -2290,7 +2285,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_removeduplicatetag,NULL,thread_remove_duplicate_tag,NULL); if(ret!=0){ LOG_I("pthread_create remove duplicate tag send fail\n"); - system("reboot"); }else{ LOG_I("pthread_create remove duplicate tag success\n"); pthread_detach(pt_removeduplicatetag); @@ -2311,7 +2305,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&timeout_thread, NULL, thread_timeout_check, NULL); if(ret!=0){ LOG_I("pthread_create timeout_check fail\n"); - system("reboot"); }else{ LOG_I("pthread_create timeout_check success\n"); pthread_detach(timeout_thread); @@ -2320,7 +2313,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_ota,NULL,thread_ota,NULL); if(ret!=0){ LOG_I("pthread_create ota fail\n"); - system("reboot"); }else{ LOG_I("pthread_create ota success\n"); pthread_detach(pt_ota); @@ -2329,7 +2321,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_doota,NULL,thread_do_ota,NULL); if(ret!=0){ LOG_I("pthread_create doota fail\n"); - system("reboot"); }else{ LOG_I("pthread_create doota success\n"); pthread_detach(pt_doota); @@ -2392,7 +2383,6 @@ int main(int argc, char *argv[]) ret = pthread_create(&pt_mqtt,NULL,thread_mqtt,NULL); if(ret!=0){ LOG_I("pthread_create mqtt fail\n"); - system("reboot"); }else{ pthread_detach(pt_mqtt); LOG_I("pthread_create mqtt success\n");