25 #ifndef INCLUDE_MERCURY_SDK_PORTHANDLER_H_
26 #define INCLUDE_MERCURY_SDK_PORTHANDLER_H_
28 #if defined(__linux__)
30 #elif defined(_WIN32) || defined(_WIN64)
32 #define WINDECLSPEC __declspec(dllexport)
34 #define WINDECLSPEC __declspec(dllimport)
39 #define DEPRECATED __attribute__((deprecated))
40 #elif defined(_MSC_VER)
41 #define DEPRECATED __declspec(deprecated)
43 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
58 static const int DEFAULT_BAUDRATE_ = 1000000;
64 static PortHandler *getPortHandler(
const char *port_name);
138 virtual int readPort(uint8_t *packet,
int length) = 0;
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac,...
virtual int getBytesAvailable()=0
The function that checks how much bytes are able to be read from the port buffer @description The fun...
virtual bool openPort()=0
The function that opens the port @description The function calls PortHandlerLinux::setBaudRate() to o...
virtual bool setBaudRate(const int baudrate)=0
The function that sets baudrate into the port handler @description The function sets baudrate into th...
virtual bool isPacketTimeout()=0
The function that checks whether packet timeout is occurred @description The function checks whether ...
virtual int getBaudRate()=0
The function that returns current baudrate set into the port handler @description The function return...
virtual char * getPortName()=0
The function that returns port name set into the port handler @description The function returns curre...
virtual void clearPort()=0
The function that clears the port @description The function clears the port.
bool is_using_
shows whether the port is in use
virtual int writePort(uint8_t *packet, int length)=0
The function that writes bytes on the port buffer @description The function writes bytes on the port ...
virtual void setPortName(const char *port_name)=0
The function that sets port name into the port handler @description The function sets port name into ...
virtual void closePort()=0
The function that closes the port @description The function closes the port.
virtual void setPacketTimeout(double msec)=0
The function that sets and starts stopwatch for watching packet timeout @description The function set...
virtual void setPacketTimeout(uint16_t packet_length)=0
The function that sets and starts stopwatch for watching packet timeout @description The function set...
virtual int readPort(uint8_t *packet, int length)=0
The function that reads bytes from the port buffer @description The function gets bytes from the port...