VectorNav C++ Library
Public Types | Public Member Functions | List of all members
vn::xplat::IPort Class Referenceabstract

Interface for a simple port. More...

#include <port.h>

Inheritance diagram for vn::xplat::IPort:
vn::util::MemoryPort vn::xplat::SerialPort

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.
 

Detailed Description

Interface for a simple port.

Member Typedef Documentation

typedef void(* vn::xplat::IPort::DataReceivedHandler) (void *userData)

Callback handler signature that can receive notification when new data has been received on the port.

Parameters
[in]userDataPointer to user data that was initially supplied when the callback was registered with registerDataReceivedHandler.

Member Function Documentation

virtual bool vn::xplat::IPort::isOpen ( )
pure virtual

Indicates if the simple port is open.

Returns
true if the serial port is open; otherwise false.

Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.

virtual void vn::xplat::IPort::read ( char  dataBuffer[],
size_t  numOfBytesToRead,
size_t &  numOfBytesActuallyRead 
)
pure virtual

Allows reading data from the simple port.

Parameters
[out]dataBufferThe data buffer to write the read data bytes to.
[in]numOfBytesToReadThe number of bytes to attempt reading from the simple port.
[out]numOfBytesActuallyReadThe number of bytes actually read from the simple port.

Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.

virtual void vn::xplat::IPort::registerDataReceivedHandler ( void *  userData,
DataReceivedHandler  handler 
)
pure virtual

Registers a callback method for notification when new data is received on the port.

Parameters
[in]userDataPointer to user data, which will be provided to the callback method.
[in]handlerThe callback method.

Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.

virtual void vn::xplat::IPort::write ( const char  data[],
size_t  length 
)
pure virtual

Writes out data to the simple port.

Parameters
[in]dataThe data array to write out.
[in]lengthThe length of the data array to write out.

Implemented in vn::xplat::SerialPort, and vn::util::MemoryPort.


The documentation for this class was generated from the following file: