VectorNav C++ Library
Public Member Functions | List of all members
vn::util::MemoryPort Class Reference

Useful test class for taking place where vn::common::ISimplePort may be used. More...

#include <memoryport.h>

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

Public Member Functions

 MemoryPort ()
 Creates a new MemoryPort.
 
virtual void open ()
 Opens the simple port.
 
virtual void close ()
 Closes the simple port.
 
virtual bool isOpen ()
 Indicates if the simple port is open. More...
 
virtual void write (const char data[], size_t length)
 Writes out data to the simple port. More...
 
virtual void read (char dataBuffer[], size_t numOfBytesToRead, size_t &numOfBytesActuallyRead)
 Allows reading data from the simple port. More...
 
virtual void registerDataReceivedHandler (void *userData, DataReceivedHandler handler)
 Registers a callback method for notification when new data is received on the port. More...
 
virtual void unregisterDataReceivedHandler ()
 Unregisters the registered callback method.
 
void registerDataWrittenHandler (void *userData, DataWrittenHandler handler)
 Registers a callback method for notification when new data is written. More...
 
void unregisterDataWrittenHandler ()
 Unregisters the registered callback method.
 
void SendDataBackDoor (const uint8_t data[], size_t length)
 Sends data to the MemoryPort which can then be read by read. More...
 
void SendDataBackDoor (const char data[], size_t length)
 Sends data to the MemoryPort which can then be read by read. More...
 
void SendDataBackDoor (const std::string data)
 Sends data to the MemoryPort which can then be read by read. More...
 

Additional Inherited Members

- Public Types inherited from vn::xplat::IPort
typedef void(* DataReceivedHandler) (void *userData)
 Callback handler signature that can receive notification when new data has been received on the port. More...
 

Detailed Description

Useful test class for taking place where vn::common::ISimplePort may be used.

Member Function Documentation

virtual bool vn::util::MemoryPort::isOpen ( )
virtual

Indicates if the simple port is open.

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

Implements vn::xplat::IPort.

virtual void vn::util::MemoryPort::read ( char  dataBuffer[],
size_t  numOfBytesToRead,
size_t &  numOfBytesActuallyRead 
)
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.

Implements vn::xplat::IPort.

virtual void vn::util::MemoryPort::registerDataReceivedHandler ( void *  userData,
DataReceivedHandler  handler 
)
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.

Implements vn::xplat::IPort.

void vn::util::MemoryPort::registerDataWrittenHandler ( void *  userData,
DataWrittenHandler  handler 
)

Registers a callback method for notification when new data is written.

Parameters
[in]userDataPointer to user data, which will be provided to the callback method.
[in]handlerThe callback method.
void vn::util::MemoryPort::SendDataBackDoor ( const uint8_t  data[],
size_t  length 
)

Sends data to the MemoryPort which can then be read by read.

Parameters
[in]dataData buffer containing the data.
[in]lengthThe number of data bytes.
void vn::util::MemoryPort::SendDataBackDoor ( const char  data[],
size_t  length 
)

Sends data to the MemoryPort which can then be read by read.

Parameters
[in]dataData buffer containing the data.
[in]lengthThe number of data bytes.
void vn::util::MemoryPort::SendDataBackDoor ( const std::string  data)

Sends data to the MemoryPort which can then be read by read.

Parameters
[in]dataThe data to send.
virtual void vn::util::MemoryPort::write ( const char  data[],
size_t  length 
)
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.

Implements vn::xplat::IPort.


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