void Thing1Class::sendCmd(const char* pCommand) { uint8_t reSend = 0; do{ write(pCommand, strlen(pCommand)); Serial.write(pCommand); writeCRLF(); if (_serial->available() > 0) { /* Check return code from Module */ readline(rcvBuf,RCV_BUF_LEN); if (strcmp("OK",rcvBuf) == 0) { reSend = 1; } else { reSend = 0; } } }while(reSend != 1); }
/* * flushLog - write out everything in the log buffer */ static void flushLog( BOOL free ) { WORD i; int f; f = open( LogCurInfo.config.curname, O_TEXT | O_WRONLY | O_CREAT | O_APPEND, S_IREAD | S_IWRITE ); if( f < 0 ) { return; } for( i = 0; i < LinesUsed; i++ ) { write( f, BufLines[i], (unsigned)strlen( BufLines[i] ) ); writeCRLF( f ); } close( f ); if( free ) { for( i = 0; i < LinesUsed; i++ ) { MemFree( BufLines[i] ); } } LinesUsed = 0; } /* flushLog */