13#ifndef mitkSerialCommunication_h
14#define mitkSerialCommunication_h
16#include <MitkIGTExports.h>
17#include "mitkCommon.h"
19#include <itkObjectFactory.h>
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();
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;
serial communication interface
itkSetMacro(StopBits, StopBits)
Set number of stop bits of the serial interface.
HardwareHandshake m_HardwareHandshake
whether to use hardware handshake for the connection
BaudRate m_BaudRate
baud rate of the serial interface connection
itkGetConstMacro(StopBits, StopBits)
Get number of stop bits of the serial interface.
unsigned int m_SendTimeout
timeout for sending data to the serial interface in milliseconds
itkSetMacro(PortNumber, PortNumber)
Set the port number of the serial interface.
itkGetConstMacro(PortNumber, PortNumber)
Get the port number of the serial interface.
itkGetConstMacro(SendTimeout, unsigned int)
returns the send timeout in milliseconds
itkSetStringMacro(DeviceName)
Set the device name.
itkSetMacro(SendTimeout, unsigned int)
set the send timeout in milliseconds
PortNumber m_PortNumber
port number of the device
itkGetConstMacro(BaudRate, BaudRate)
Get the baud rate of the serial interface.
unsigned int m_ReceiveTimeout
timeout for receiving data from the serial interface in milliseconds
mitkClassMacroItkParent(SerialCommunication, itk::Object)
itkSetMacro(DataBits, DataBits)
Set the number of data bits of the serial interface.
StopBits m_StopBits
number of stop bits per symbol
itkGetStringMacro(DeviceName)
Get the device name.
itkSetMacro(BaudRate, BaudRate)
Set the baud rate of the serial interface.
itkGetConstMacro(DataBits, DataBits)
Get the number of data bits of the serial interface.
itkGetConstMacro(ReceiveTimeout, unsigned int)
returns the receive timeout in milliseconds
itkSetMacro(HardwareHandshake, HardwareHandshake)
Set if hardware handshake should be used.
DataBits m_DataBits
number of data bits per symbol
itkFactorylessNewMacro(Self)
Parity m_Parity
parity mode
itkSetMacro(Parity, Parity)
Set the parity mode of the serial interface.
bool m_Connected
is set to true if a connection currently established
std::string m_DeviceName
device name that is used to connect to the serial interface (will be used if != "")
itkGetConstMacro(HardwareHandshake, HardwareHandshake)
returns true if hardware handshake should is used
itkGetConstMacro(Parity, Parity)
Get the parity mode of the serial interface.
itkSetMacro(ReceiveTimeout, unsigned int)
set the send timeout in milliseconds