Robotiq::Serial Class
Byte-level transport to the gripper hardware — the transport extension point.
The driver talks to the hardware through an implementation of this interface: the built-in libserialport transport on a desktop, an application's own (a TCP-serial bridge, an MCU UART/DMA transport), or a scripted connection in tests. Link parameters (port, baud rate, timeout, ...) are fixed at construction of the implementation — see SerialConfig — so a connection cannot be silently reconfigured while open.
On an RTOS, read() MUST yield the CPU while awaiting bytes (e.g. interrupt/DMA completion signalled through a semaphore): it runs on the exchange thread, and a busy-wait there starves lower-priority tasks — see the caveats in ports/threadx/threadx_platform.hpp.
- See Also
makeFakeGripper() for Testing & CI Utilities without hardware; ports/threadx/ for a reference MCU Transport.
Included Headers
Members
| Public Destructor | |
| ~Serial ()=default | |
| Public Member Functions | |
| void | open ()=0 |
|
Open the configured link. More... | |
| bool | isOpen () const =0 |
| void | close ()=0 |
|
Close the link. Safe to call when already closed. More... | |
| std::vector< uint8_t > | read (size_t size, std::chrono::milliseconds timeout)=0 |
|
Read up to size bytes from the serial port. More... | |
| void | write (const std::vector< uint8_t > &data)=0 |
|
Write a sequence of bytes to the serial port. More... | |
| std::chrono::milliseconds | getTimeout () const =0 |
Public Member Functions
close()
|
Close the link. Safe to call when already closed.
getTimeout()
|
- Returns
The per-transaction read/write timeout of this connection.
isOpen()
|
- Returns
true if the link is currently open.
open()
|
Open the configured link.
- Exceptions
-
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/serialioexception">SerialIOException</a> when the port cannot be opened/configured.
read()
|
Read up to size bytes from the serial port.
- Parameters
-
size Maximum number of bytes to read.
timeout How long to wait for bytes to arrive. A zero timeout returns only what is instantly available (used to drain stale bytes before a request).
- Returns
The bytes received — possibly fewer than size, or empty when nothing arrived in time.
- Exceptions
-
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/serialioexception">SerialIOException</a> on wire-level failure.
write()
|
Write a sequence of bytes to the serial port.
- Parameters
-
data The bytes to write.
- Exceptions
-
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/serialioexception">SerialIOException</a> on timeout or wire-level failure.
The documentation for this class was generated from the following file:
- serial.hpp
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.