Esempio n. 1
0
/**
 * Send end of command
 */
bool CmdMessenger::sendCmdEnd(bool reqAc, int ackCmdId, int timeout)
{
    bool ackReply = false;
    if (startCommand) {
        comms->print(command_separator);
        if(print_newlines)
            comms->println(); // should append BOTH \r\n
        if (reqAc) {
            ackReply = blockedTillReply(timeout, ackCmdId);
        }
    }
    pauseProcessing = false;
    startCommand   = false;
    return ackReply;
}
Esempio n. 2
0
// if the arguments in the future could be passed in as int/long/float etc
// then it might make sense to use the above writeReal????() methods
// I've removed them for now.
char* CmdMessenger::sendCmd(int cmdId, char *msg, boolean reqAc, 
			       char *replyBuff, int butSize, int timeout, 
			       int retryCount)
{
  int tryCount = 0;  
  pauseProcessing = true;
  //*comms << cmdId << field_separator << msg << endl;
  comms->print(cmdId);
  comms->print(field_separator);
  comms->print(msg);
  comms->print(command_separator);
  if(print_newlines)
    comms->println(); // should append BOTH \r\n
  if (reqAc) {    
    do {
      blockedTillReply(timeout);
      //strcpy(replyBuff, buf;
    } while( tryCount < retryCount);
  }
  
  pauseProcessing = false;
  return NULL;
}