|
iodrivers_base
|
#include <TestStream.hpp>
Public Member Functions | |
| TestStream () | |
| void | pushDataToDriver (std::vector< uint8_t > const &data) |
| std::vector< uint8_t > | readDataFromDriver () |
| void | EXPECT_REPLY (std::vector< uint8_t > const &expectation, std::vector< uint8_t > const &reply) |
| void | waitRead (base::Time const &timeout) |
| void | waitWrite (base::Time const &timeout) |
| size_t | read (uint8_t *buffer, size_t buffer_size) |
| size_t | write (uint8_t const *buffer, size_t buffer_size) |
| void | clear () |
| bool | expectationsAreEmpty () |
| void | setMockMode (bool mode) |
| void | clearExpectations () |
Public Member Functions inherited from iodrivers_base::IOStream | |
| virtual | ~IOStream () |
| virtual int | getFileDescriptor () const |
A IOStream meant to be used to test iodrivers_base functionality from outside
It maintains two vectors, one the "to device" buffer and one the "from buffer" device. All communications are synchronous, that is waitRead will throw right away if no data is available. waitWrite never fails.
|
inline |
|
virtual |
Implements iodrivers_base::IOStream.
| void TestStream::clearExpectations | ( | ) |
| void TestStream::EXPECT_REPLY | ( | std::vector< uint8_t > const & | expectation, |
| std::vector< uint8_t > const & | reply | ||
| ) |
Set a expectation and reply pair and also puts the driver in mock mode. Should be used after setting up IODRIVERS_BASE_MOCK().
| expecation | is the message that is expected to be sent by the driver |
| reply | reply message to be received by the driver |
| bool TestStream::expectationsAreEmpty | ( | ) |
| void TestStream::pushDataToDriver | ( | std::vector< uint8_t > const & | data | ) |
Push data to the driver "as-if" it was coming from the device
Push data to the driver
|
virtual |
Implements iodrivers_base::IOStream.
| vector< uint8_t > TestStream::readDataFromDriver | ( | ) |
Read data that the driver sent to the device
This contains only data sent since the last call to readDataFromDriver
Read all data that the device driver has written since the last call to readDataFromDriver
| void TestStream::setMockMode | ( | bool | mode | ) |
|
virtual |
Implements iodrivers_base::IOStream.
|
virtual |
Implements iodrivers_base::IOStream.
|
virtual |
Implements iodrivers_base::IOStream.
1.8.6