17 #ifndef MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
18 #define MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
20 #include <MitkIGTExports.h>
22 #include <itkObject.h>
23 #include <itkObjectFactory.h>
51 itkFactorylessNewMacro(Self)
74 BaudRate14400 = 14400,
75 BaudRate19200 = 19200,
76 BaudRate38400 = 38400,
77 BaudRate57600 = 57600,
78 BaudRate115200 = 115200,
79 BaudRate230400 = 230400,
80 BaudRate460800 = 460800,
81 BaudRate500000 = 500000,
82 BaudRate576000 = 576000,
83 BaudRate921600 = 921600,
84 BaudRate1000000 = 1000000,
85 BaudRate1152000 = 1152000,
87 BaudRate1500000 = 1500000,
88 BaudRate2000000 = 2000000,
89 BaudRate2500000 = 2500000,
90 BaudRate3000000 = 3000000,
91 BaudRate3500000 = 3500000,
92 BaudRate4000000 = 4000000
116 HardwareHandshakeOn = 1,
117 HardwareHandshakeOff = 0
125 int OpenConnection();
130 void CloseConnection();
151 int Receive(std::string& answer,
unsigned int numberOfBytes,
const char *eol=
nullptr);
162 int Send(
const std::string& input,
bool block =
false);
167 void SendBreak(
unsigned int ms = 400);
172 void ClearReceiveBuffer();
177 void ClearSendBuffer();
185 itkGetConstMacro(PortNumber, PortNumber);
198 itkSetMacro(PortNumber, PortNumber);
208 itkGetStringMacro(DeviceName);
218 itkSetStringMacro(DeviceName);
223 itkGetConstMacro(BaudRate, BaudRate);
228 itkSetMacro(BaudRate, BaudRate);
233 itkGetConstMacro(DataBits, DataBits);
238 itkSetMacro(DataBits, DataBits);
243 itkGetConstMacro(Parity, Parity);
248 itkSetMacro(Parity, Parity);
253 itkGetConstMacro(StopBits, StopBits);
258 itkSetMacro(StopBits, StopBits);
263 itkGetConstMacro(HardwareHandshake, HardwareHandshake);
268 itkSetMacro(HardwareHandshake, HardwareHandshake);
273 itkGetConstMacro(SendTimeout,
unsigned int);
280 itkSetMacro(SendTimeout,
unsigned int);
285 itkGetConstMacro(ReceiveTimeout,
unsigned int);
294 itkSetMacro(ReceiveTimeout,
unsigned int);
305 int ApplyConfiguration();
312 int ApplyConfigurationWin();
318 int ApplyConfigurationUnix();
337 HANDLE m_ComPortHandle;
338 DWORD m_PreviousMask;
339 COMMTIMEOUTS m_PreviousTimeout;
340 DCB m_PreviousDeviceControlBlock;
std::string m_DeviceName
device name that is used to connect to the serial interface (will be used if != "") ...
BaudRate m_BaudRate
baud rate of the serial interface connection
Parity m_Parity
parity mode
unsigned int m_SendTimeout
timeout for sending data to the serial interface in milliseconds
DataCollection - Class to facilitate loading/accessing structured data.
StopBits m_StopBits
number of stop bits per symbol
unsigned int m_ReceiveTimeout
timeout for receiving data from the serial interface in milliseconds
HardwareHandshake m_HardwareHandshake
whether to use hardware handshake for the connection
#define mitkClassMacroItkParent(className, SuperClassName)
PortNumber m_PortNumber
port number of the device
serial communication interface
DataBits m_DataBits
number of data bits per symbol
bool m_Connected
is set to true if a connection currently established