void Serial_Close_Port(void) { if(serial_port.IsOpen()) { serial_port.Close(); } }
void init_connection(SerialStream& stream) { stream.Open("/dev/ttyUSB0"); if (stream.IsOpen()){ cout << "\tStream open" << endl; } else { cout << "\tCould not open stream" << endl; exit(1); } //Connection Characteristics stream.SetBaudRate(SerialStreamBuf::BAUD_9600); stream.SetCharSize(SerialStreamBuf::CHAR_SIZE_8); stream.SetNumOfStopBits(1); stream.SetParity(SerialStreamBuf::PARITY_NONE); stream.SetFlowControl(SerialStreamBuf::FLOW_CONTROL_HARD); //?? stream.SetVMin(1000); }