teste de publish

Dependencies:   DS1820 HighSpeedAnalogIn devices mbed

Revision:
30:8a06a85d8807
Parent:
29:823a9da3696b
Child:
31:a1ba855c6e8a
--- a/serialPC.cpp	Thu May 24 00:42:23 2018 +0000
+++ b/serialPC.cpp	Fri May 25 23:46:10 2018 +0000
@@ -35,31 +35,15 @@
     bufIn = bufPC.get();
     
     
-    static bool recebendoDeviceCfg = false;
-    
-    if(strstr(bufIn,"cmd/StartSendDeviceCfg;>")){
-        recebendoDeviceCfg = true;            
-        return;
-    }
-    
+    static bool recebendoDeviceCfg = false;    
+       
     if(strstr(bufIn,"execAct(")){
         strtok(bufIn,"(");
         act=atoi(strtok(NULL,")"));
         boolExecAct = true;
         return;
     }
-    
-    if(strstr(bufIn,"cmd/StopSendDeviceCfg;>")){
-        recebendoDeviceCfg = false;            
-        return;
-    }    
-    
-    if(recebendoDeviceCfg){
-        sdCard::insereDadosArquivo(&sdCard::devices,bufIn,bufLength);
-        pc.printf("Caracteres inseridos %lu\n",bufLength);        
-        return;
-    }
-    
+        
     if(strstr(bufIn,"modem:")!=NULL){
         bufIn = &bufIn[6];
         pc.printf("Mensagem ao modem <%s>.\r\n",bufIn);
@@ -67,102 +51,39 @@
         pc.printf("Mesagem do modem <%s>.\r\n",bufModem.getRowBuffer());
         return;
     }      
-    
-    
-    
-    
-    if(strstr(bufIn,"exibeArquivo:config.bin")!=NULL){        
+        
+    if(strstr(bufIn,"config")!=NULL){        
         sdCard::exibeArquivo(&sdCard::config);
-        return;
     }    
     
-    if(strstr(bufIn,"resetDigitais()")!=NULL){        
-        SD_OE_R = 0;
-        osDelay(50);
-        SD_OE_R = 1;   
-        return;
-    }
-    
+    if(strstr(bufIn,"devices")!=NULL){        
+        sdCard::exibeArquivo(&sdCard::devices);
+    }    
     
     if(strstr(bufIn,"testaTudoDevices()")!=NULL){        
         testaTudoDevices();
-        return;
-    }
-    
-    if(strstr(bufIn,"excluiArquivo:tempFile.bin")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::tempFile);
-        remove("/sd/RAD/tempFile.bin");
-        return;
-    }  
-    /*
-    
-    if(strstr(bufIn,"format c:")!=NULL){        
-        pc.printf("Formatando ");
-        if(format()){
-            pc.printf("ok\r\n");
-        }else{pc.printf("nok\r\n");}
-        return;
-    }  
-    */
-    
-    if(strstr(bufIn,"exibeArquivo:tempFile.bin")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::tempFile);
-        return;
-    }
-    
-    if(strstr(bufIn,"exibeArquivo:bank0.txt")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::bank0);
-        return;
-    }
-    
-    if(strstr(bufIn,"exibeArquivo:bank1.txt")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::bank1);
-        return;
-    }
-    
-    if(strstr(bufIn,"testeEscrita")!=NULL){        
-        sdCard::abreArquivo(&sdCard::tempFile,"a");
-        fprintf(sdCard::tempFile.fp,"Linha escrita\r\n");
-        sdCard::fechaArquivo(&sdCard::tempFile);
-        return;
-    }
-    
-    if(strstr(bufIn,"exibeArquivo:currentBank.txt")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::currentBankFile);
-        return;
-    }
-    
-    if(strstr(bufIn,"enviaDadosAoServer")){
-        eventosRTC::rotinaEnvioDeDados=maxTentativasEnvioDados;
-        return;
     }
     
     ptr=strstr(bufIn,"deleteArmazenamento");
     if(ptr){
-        printf("Deletando banks.\r\n");
-        sdCard::deleteBanks(2);        
+        pc.printf("Deletando banks.\r\n");
+        sdCard::deleteBanks(2);
+    }    
+
+    if(strstr(bufIn,"enviaDadosAoServer")){
+        eventosRTC::rotinaEnvioDeDados=maxTentativasEnvioDados;
     }
-    
-    if(strstr(bufIn,"enviaArquivoDevices")){
-        arquivoEnvioPointer = &sdCard::devices;
-        return;
-    }        
+
     
     if(strstr(bufIn,"debug")){
         if(debug){debug = false;}
         else{debug = true;}
-        return;
-    }    
-    
-    if(strstr(bufIn,"excluiArquivo:config.bin")!=NULL){        
-        sdCard::excluiArquivo(&sdCard::config);
-        return;
     }
     
-    if(strstr(bufIn,"excluiArquivo:currentBank.txt")!=NULL){        
-        sdCard::excluiArquivo(&sdCard::currentBankFile);
-        return;
-    } 
+    if(strstr(bufIn,"xereta")){
+        if(xeretaModem){debug = false;}
+        else{xeretaModem = true;}
+    }        
     
     if(strstr(bufIn,"excluiArquivoPeloNome:")!=NULL){        
         strtok(bufIn,":");
@@ -173,48 +94,5 @@
     
     if(strstr(bufIn,"excluiArquivo:devices.cfg")!=NULL){        
         sdCard::excluiArquivo(&sdCard::devices);
-        return;
-    }
-    
-    if(strstr(bufIn,"conectaWifi()")!=NULL){
-        inicializaModemBool = true;
-        return;
-    }
-    
-    
-    
-    if(strstr(bufIn,"exibeArquivo:devices.cfg")!=NULL){        
-        sdCard::exibeArquivo(&sdCard::devices);
-        return;
-    }
-    
-    ptr=strstr(bufIn,"*ServerCommand*");
-    if(ptr) {
-        //naoCompreendido=false;
-        scanPtr = strtok (ptr,"\\");
-        scanPtr = strtok (NULL,">");        
-        strcpy(commands::buffer,scanPtr);
-        pc.printf("Comandos <%s>.\n",commands::buffer);
-        executaComandoServer = true;
-        //Se devo executar comando tenho que sair imediatamente.
-        return;
-    }
-     
-    if(strstr(bufIn,"writeReadingsToSD()")){
-        eventosRTC::rotinaEnvioDeDados = maxTentativasEnvioDados;
-        return;
-    }
-    
-    //bufLength
-    /*
-    stack overflow de thread...
-    if(strstr(bufIn,"execAct(")){
-        strtok(bufIn,"(");
-        bufLength = atoi(strtok(NULL,")"));
-        dispositivos[0]->execAct(bufLength);
-        return;
-    }
-    */
-    //Se chegou aqui é pq não foi uma mensagem reconhecida.
-    pc.printf("Lido do CircularBuffer PC <%s>.\r\n",bufIn);
+    }    
 }