Modules-old/Microstrain/Microstrain.cpp
////////////////////////////////////////////////////////////////////////////////
// Send a packet to the IMU.
// Returns the number of bytes written.
Send a packet to the IMU.
Returns the number of bytes written.
Send a packet to the IMU . Returns the number of bytes written .
int
Microstrain::send(void *cmd, int cmd_len)
{
  int bytes;
  bytes = write(fd, cmd, cmd_len);
  if (bytes < 0)
    IMU_EXCEPT(microstrain_3dmgx3_imu::Exception, "error writing to IMU [%s]", strerror(errno));
  if (bytes != cmd_len)
    IMU_EXCEPT(microstrain_3dmgx3_imu::Exception, "whole message not written to IMU");
  if (tcdrain(fd) != 0)
    IMU_EXCEPT(microstrain_3dmgx3_imu::Exception, "tcdrain failed");
  return bytes;
}
int Microstrain :: send ( void * cmd , int cmd_len ) { int bytes ; bytes = write ( fd , cmd , cmd_len ) ; if ( bytes < 0 ) IMU_EXCEPT ( microstrain_3dmgx3_imu :: Exception , " " , strerror ( errno ) ) ; if ( bytes != cmd_len ) IMU_EXCEPT ( microstrain_3dmgx3_imu :: Exception , " " ) ; if ( tcdrain ( fd ) != 0 ) IMU_EXCEPT ( microstrain_3dmgx3_imu :: Exception , " " ) ; return bytes ; }
Send a packet to the IMU.
Send a packet to the IMU .
// Write the data to the port // Make sure the queue is drained // Synchronous IO doesnt always work