Tools/SuperBoard/SerialDevice.cc
//set the terminal baud rate. Argument can be either an integer (ex. 115200) or speed_t (ex. B115200)
set the terminal baud rate. Argument can be either an integer (ex.
set the terminal baud rate . Argument can be either an integer ( ex .
int SerialDevice::SetBaudRate(const int speed)
{
  speed_t tempBaud;
  if (!this->connected)
  {
    SD_LOG_ERROR("not connected to the device");
    return -1;
  }
  int nonStandardBaud = _SpeedToBaud(speed,tempBaud);
  if (nonStandardBaud == 0)
  {
    if (SetStandardBaudRate(tempBaud) != 0)
    {
      SD_LOG_ERROR("could not set standard baud rate");
      return -1;
    }
  }
  else
  {
    if (SetNonStandardBaudRate(speed) != 0)
    {
      SD_LOG_ERROR("could not set non-standard baud rate");
      return -1;
    }
  }
  return 0;
}
int SerialDevice :: SetBaudRate ( const int speed ) { speed_t tempBaud ; if ( ! this -> connected ) { SD_LOG_ERROR ( " " ) ; return -1 ; } int nonStandardBaud = _SpeedToBaud ( speed , tempBaud ) ; if ( nonStandardBaud == 0 ) { if ( SetStandardBaudRate ( tempBaud ) != 0 ) { SD_LOG_ERROR ( " " ) ; return -1 ; } } else { if ( SetNonStandardBaudRate ( speed ) != 0 ) { SD_LOG_ERROR ( " " ) ; return -1 ; } } return 0 ; }
set the terminal baud rate.
set the terminal baud rate .
//check whether we are connected to the device //convert the integer speed value to speed_t if needed