8 file_handle_ = ::open(port.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
30 cfsetispeed(&tty, (speed_t) baudrate_);
31 tty.c_cflag |= (CLOCAL | CREAD);
32 tty.c_cflag &= ~CSIZE;
34 tty.c_cflag &= ~PARENB;
35 tty.c_cflag &= ~CSTOPB;
36 tty.c_cflag &= ~CRTSCTS;
39 tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
40 tty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
41 tty.c_oflag &= ~OPOST;
54 const int max_bad_reads = 200;
57 for (indx=0; indx<size && bad_reads<max_bad_reads;)
64 buff[indx++] = incoming_byte;
71 if (bad_reads == max_bad_reads)
88 if (write_len != size)
bool send(const byte buff[], size_t size)
void connect(std::string port, int baudrate)