Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Construct command to turn off telemetry.
- // This is specific to my application, you could write whatever you want to your serial port.
- // Or you could read whatever you want.
- CString stop_tlm_msg;
- stop_tlm_msg = "toff\r";
- try
- {
- COMMCONFIG config;
- Serial_Port::GetDefaultConfig(3, config);
- Serial_Port port;
- port.open_port(3,
- 115200,
- Serial_Port::NoParity,
- 8,
- Serial_Port::OneStopBit,
- Serial_Port::NoFlowControl,
- false);
- port.Set0WriteTimeout();
- port.Set0ReadTimeout();
- // First stop telemetry output.
- char * sBuf1 = stop_tlm_msg.GetBuffer();
- port.Write(sBuf1, strlen(sBuf1));
- port.ClearWriteBuffer();
- port.ClearReadBuffer();
- port.Flush();
- port.close_port();
- }
- catch (CSerialException* pEx)
- {
- TRACE(_T("Serial Port Error:%s\n"), pEx->GetErrorMessage());
- pEx->Delete();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement