teste de publish

Dependencies:   DS1820 HighSpeedAnalogIn devices mbed

Revision:
13:b9183b4bc049
Parent:
11:631bea162800
Child:
14:c0162ab2a951
--- a/diversos.cpp	Wed Aug 30 19:13:19 2017 +0000
+++ b/diversos.cpp	Mon Oct 23 15:35:18 2017 +0000
@@ -1,4 +1,5 @@
 #include "diversos.h"
+
 bool eventosRTC::segundos;
 bool eventosRTC::minutos;
 bool eventosRTC::rotina10Segundos;
@@ -115,6 +116,7 @@
      pc.printf("> %3.0f%% Progresso %5lu de %5lu\r ",((double)progresso/(double)total)*100,progresso,total);    
 }
 
+
 void commands::exec(uint8_t idConnection){
     char *ptr,*pCharFile,*ptrComando;
     char msg[100];
@@ -150,6 +152,7 @@
         ptr=strstr(ptrComando,"StartSendFile");
         if(ptr){        
             modemCom::status.timeOut=100;
+            sdCard::nBytesArquivoRecebidos = 0;
             strtok(ptr,",");//Descartando inicio
             pCharFile = strtok(NULL,",");//Selecionando nome do arquivo                   
             strcpy(sdCard::nomeArquivoEmRecebimento,pCharFile);        
@@ -171,8 +174,7 @@
                                      
         ptr=strstr(ptrComando,"StopSendFile");
         if(ptr){
-            pc.printf("Finalizando recepcao do server arquivo deviceCfg.\n");
-            modemCom::status.recebendoArquivoDoServer = false;
+            pc.printf("Finalizando recepcao de arquivo.\n");            
             checkSum16BIT_Lido = sdCard::calcCheckSum16BITFile("/sd/RAD/tempFile.bin");
             if(fileCheckSum16BIT == checkSum16BIT_Lido){
                 if(sdCard::file_rename("/sd/RAD/tempFile.bin",sdCard::nomeArquivoEmRecebimento)){
@@ -188,13 +190,16 @@
                         hardwareReset=true;
                     }
                     
+                    if(strstr(sdCard::nomeArquivoEmRecebimento,"firmware.bin")!=NULL){                                                
+                        callBootLoader = true;
+                    }                    
                 }else{
                     //modemCom::sendBufferCommandMode(2,"FileCorrupted.\r\n",strlen("FileCorrupted.\r\n"));                                        
                     sprintf(msg,"erro");
                     modemCom::sendBufferCommandMode(idConnection,msg,strlen(msg));
                     pc.printf("Recebido correto mas n foi possivel renomear arquivo.\r\n");                    
                  }
-                
+                modemCom::status.recebendoArquivoDoServer = false;    
             }else{
                 /*sprintf(diversos::msg,"File Corrupted checkSum16BIT_Lido <%lu>.\r\n",checkSum16BIT_Lido);
                 modemCom::sendBufferCommandMode(2,diversos::msg,strlen(diversos::msg));*/