13 #ifndef mitkSerialCommunication_h
14 #define mitkSerialCommunication_h
16 #include <MitkIGTExports.h>
18 #include <itkObject.h>
19 #include <itkObjectFactory.h>
47 itkFactorylessNewMacro(Self);
70 BaudRate14400 = 14400,
71 BaudRate19200 = 19200,
72 BaudRate38400 = 38400,
73 BaudRate57600 = 57600,
74 BaudRate115200 = 115200,
75 BaudRate230400 = 230400,
76 BaudRate460800 = 460800,
77 BaudRate500000 = 500000,
78 BaudRate576000 = 576000,
79 BaudRate921600 = 921600,
80 BaudRate1000000 = 1000000,
81 BaudRate1152000 = 1152000,
83 BaudRate1500000 = 1500000,
84 BaudRate2000000 = 2000000,
85 BaudRate2500000 = 2500000,
86 BaudRate3000000 = 3000000,
87 BaudRate3500000 = 3500000,
88 BaudRate4000000 = 4000000
112 HardwareHandshakeOn = 1,
113 HardwareHandshakeOff = 0
126 int OpenConnection();
131 void CloseConnection();
152 int Receive(std::string& answer,
unsigned int numberOfBytes,
const char *eol=
nullptr);
163 int Send(
const std::string& input,
bool block =
false);
168 void SendBreak(
unsigned int ms = 400);
173 void ClearReceiveBuffer();
178 void ClearSendBuffer();
186 itkGetConstMacro(PortNumber, PortNumber);
199 itkSetMacro(PortNumber, PortNumber);
209 itkGetStringMacro(DeviceName);
219 itkSetStringMacro(DeviceName);
224 itkGetConstMacro(BaudRate, BaudRate);
229 itkSetMacro(BaudRate, BaudRate);
234 itkGetConstMacro(DataBits, DataBits);
239 itkSetMacro(DataBits, DataBits);
244 itkGetConstMacro(Parity, Parity);
249 itkSetMacro(Parity, Parity);
254 itkGetConstMacro(StopBits, StopBits);
259 itkSetMacro(StopBits, StopBits);
264 itkGetConstMacro(HardwareHandshake, HardwareHandshake);
269 itkSetMacro(HardwareHandshake, HardwareHandshake);
274 itkGetConstMacro(SendTimeout,
unsigned int);
281 itkSetMacro(SendTimeout,
unsigned int);
286 itkGetConstMacro(ReceiveTimeout,
unsigned int);
295 itkSetMacro(ReceiveTimeout,
unsigned int);
306 int ApplyConfiguration();
313 int ApplyConfigurationWin();
319 int ApplyConfigurationUnix();
338 HANDLE m_ComPortHandle;
339 DWORD m_PreviousMask;
340 COMMTIMEOUTS m_PreviousTimeout;
341 DCB m_PreviousDeviceControlBlock;