![]() |
VectorNav C++ Library
|
Interface for a simple port. More...
#include <port.h>
Public Types | |
typedef void(* | DataReceivedHandler) (void *userData) |
Callback handler signature that can receive notification when new data has been received on the port. More... | |
Public Member Functions | |
virtual void | open ()=0 |
Opens the simple port. | |
virtual void | close ()=0 |
Closes the simple port. | |
virtual bool | isOpen ()=0 |
Indicates if the simple port is open. More... | |
virtual void | write (const char data[], size_t length)=0 |
Writes out data to the simple port. More... | |
virtual void | read (char dataBuffer[], size_t numOfBytesToRead, size_t &numOfBytesActuallyRead)=0 |
Allows reading data from the simple port. More... | |
virtual void | registerDataReceivedHandler (void *userData, DataReceivedHandler handler)=0 |
Registers a callback method for notification when new data is received on the port. More... | |
virtual void | unregisterDataReceivedHandler ()=0 |
Unregisters the registered callback method. | |
Interface for a simple port.
typedef void(* vn::xplat::IPort::DataReceivedHandler) (void *userData) |
Callback handler signature that can receive notification when new data has been received on the port.
[in] | userData | Pointer to user data that was initially supplied when the callback was registered with registerDataReceivedHandler. |
|
pure virtual |
Indicates if the simple port is open.
true
if the serial port is open; otherwise false
. Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.
|
pure virtual |
Allows reading data from the simple port.
[out] | dataBuffer | The data buffer to write the read data bytes to. |
[in] | numOfBytesToRead | The number of bytes to attempt reading from the simple port. |
[out] | numOfBytesActuallyRead | The number of bytes actually read from the simple port. |
Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.
|
pure virtual |
Registers a callback method for notification when new data is received on the port.
[in] | userData | Pointer to user data, which will be provided to the callback method. |
[in] | handler | The callback method. |
Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.
|
pure virtual |
Writes out data to the simple port.
[in] | data | The data array to write out. |
[in] | length | The length of the data array to write out. |
Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.