The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac, or PortHandlerArduino.
More...
#include <port_handler.h>
|
virtual | ~PortHandler () |
|
virtual bool | openPort ()=0 |
| The function that opens the port @description The function calls PortHandlerLinux::setBaudRate() to open the port. More...
|
|
virtual void | closePort ()=0 |
| The function that closes the port @description The function closes the port. More...
|
|
virtual void | clearPort ()=0 |
| The function that clears the port @description The function clears the port. More...
|
|
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 the port handler. More...
|
|
virtual char * | getPortName ()=0 |
| The function that returns port name set into the port handler @description The function returns current port name set into the port handler. More...
|
|
virtual bool | setBaudRate (const int baudrate)=0 |
| The function that sets baudrate into the port handler @description The function sets baudrate into the port handler. More...
|
|
virtual int | getBaudRate ()=0 |
| The function that returns current baudrate set into the port handler @description The function returns current baudrate set into the port handler. More...
|
|
virtual int | getBytesAvailable ()=0 |
| The function that checks how much bytes are able to be read from the port buffer @description The function checks how much bytes are able to be read from the port buffer @description and returns the number. More...
|
|
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 buffer, @description and returns a number of bytes read. More...
|
|
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 buffer, @description and returns a number of bytes which are successfully written. More...
|
|
virtual void | setPacketTimeout (uint16_t packet_length)=0 |
| The function that sets and starts stopwatch for watching packet timeout @description The function sets the stopwatch by getting current time and the time of packet timeout with packet_length. More...
|
|
virtual void | setPacketTimeout (double msec)=0 |
| The function that sets and starts stopwatch for watching packet timeout @description The function sets the stopwatch by getting current time and the time of packet timeout with msec. More...
|
|
virtual bool | isPacketTimeout ()=0 |
| The function that checks whether packet timeout is occurred @description The function checks whether current time is passed by the time of packet timeout from the time set by PortHandlerLinux::setPacketTimeout(). More...
|
|
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac, or PortHandlerArduino.
Definition at line 55 of file port_handler.h.
◆ ~PortHandler()
virtual mercury::PortHandler::~PortHandler |
( |
| ) |
|
|
inlinevirtual |
◆ clearPort()
virtual void mercury::PortHandler::clearPort |
( |
| ) |
|
|
pure virtual |
◆ closePort()
virtual void mercury::PortHandler::closePort |
( |
| ) |
|
|
pure virtual |
◆ getBaudRate()
virtual int mercury::PortHandler::getBaudRate |
( |
| ) |
|
|
pure virtual |
◆ getBytesAvailable()
virtual int mercury::PortHandler::getBytesAvailable |
( |
| ) |
|
|
pure virtual |
The function that checks how much bytes are able to be read from the port buffer @description The function checks how much bytes are able to be read from the port buffer @description and returns the number.
- Returns
- Length of read-able bytes in the port buffer
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ getPortHandler()
PortHandler * PortHandler::getPortHandler |
( |
const char * |
port_name | ) |
|
|
static |
◆ getPortName()
virtual char* mercury::PortHandler::getPortName |
( |
| ) |
|
|
pure virtual |
◆ isPacketTimeout()
virtual bool mercury::PortHandler::isPacketTimeout |
( |
| ) |
|
|
pure virtual |
◆ openPort()
virtual bool mercury::PortHandler::openPort |
( |
| ) |
|
|
pure virtual |
◆ readPort()
virtual int mercury::PortHandler::readPort |
( |
uint8_t * |
packet, |
|
|
int |
length |
|
) |
| |
|
pure virtual |
The function that reads bytes from the port buffer @description The function gets bytes from the port buffer, @description and returns a number of bytes read.
- Parameters
-
packet | Buffer for the packet received |
length | Length of the buffer for read |
- Returns
- -1
-
when error was occurred
-
or Length of bytes read
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ setBaudRate()
virtual bool mercury::PortHandler::setBaudRate |
( |
const int |
baudrate | ) |
|
|
pure virtual |
The function that sets baudrate into the port handler @description The function sets baudrate into the port handler.
- Parameters
-
- Returns
- false
-
when error was occurred during port opening
-
or true
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ setPacketTimeout() [1/2]
virtual void mercury::PortHandler::setPacketTimeout |
( |
double |
msec | ) |
|
|
pure virtual |
The function that sets and starts stopwatch for watching packet timeout @description The function sets the stopwatch by getting current time and the time of packet timeout with msec.
- Parameters
-
packet_length | Length of the packet expected to be received |
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ setPacketTimeout() [2/2]
virtual void mercury::PortHandler::setPacketTimeout |
( |
uint16_t |
packet_length | ) |
|
|
pure virtual |
The function that sets and starts stopwatch for watching packet timeout @description The function sets the stopwatch by getting current time and the time of packet timeout with packet_length.
- Parameters
-
packet_length | Length of the packet expected to be received |
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ setPortName()
virtual void mercury::PortHandler::setPortName |
( |
const char * |
port_name | ) |
|
|
pure virtual |
◆ writePort()
virtual int mercury::PortHandler::writePort |
( |
uint8_t * |
packet, |
|
|
int |
length |
|
) |
| |
|
pure virtual |
The function that writes bytes on the port buffer @description The function writes bytes on the port buffer, @description and returns a number of bytes which are successfully written.
- Parameters
-
packet | Buffer which would be written on the port buffer |
length | Length of the buffer for write |
- Returns
- -1
-
when error was occurred
-
or Length of bytes written
Implemented in mercury::PortHandlerWindows, and mercury::PortHandlerLinux.
◆ DEFAULT_BAUDRATE_
const int mercury::PortHandler::DEFAULT_BAUDRATE_ = 1000000 |
|
static |
◆ is_using_
bool mercury::PortHandler::is_using_ |
The documentation for this class was generated from the following files: