![]() |
Dataflow Runtime API
2.7.4.0
|
Provides a mock implementation of the BSP driver. More...
#include <Imt.Base.BSP.Mock/DriverMock.h>
Public Member Functions | |
DriverMock () | |
Constructor. | |
virtual | ~DriverMock () |
Destructor. | |
imt::base::bsp::type::ErrorCode::Id | onRead (uint8_t *pData, const size_t size, uint8_t *const pBytesRead) |
Copies the read data to the given array, sets the number of bytes read and increments the read counter. More... | |
imt::base::bsp::type::ErrorCode::Id | onReadValue (bool *const pValue) |
Sets the value of the given pointer to true if the read value is greater than 0, false otherwhise. More... | |
imt::base::bsp::type::ErrorCode::Id | onReadValue (uint32_t *const pValue) |
Sets the value of the given pointer to the read value. More... | |
imt::base::bsp::type::ErrorCode::Id | onReadValue (float32_t *const pValue) |
Sets the value of the given pointer to the read value. More... | |
imt::base::bsp::type::ErrorCode::Id | onRegisterValueHandler (const size_t indexEndpoint, handler::HighLevelValueHandlerIfc *const pHandler) |
Registers the given handler for the given endpoint. More... | |
imt::base::bsp::type::ErrorCode::Id | onWrite (const uint8_t pData[], const uint32_t size, uint8_t *const pBytesWritten) |
Stores the data given by an array and increments the write counter. More... | |
imt::base::bsp::type::ErrorCode::Id | onWriteValue (const bool value) |
Stores the given value. More... | |
imt::base::bsp::type::ErrorCode::Id | onWriteValue (const uint32_t value) |
Stores the given value. More... | |
imt::base::bsp::type::ErrorCode::Id | onWriteValue (const float32_t value) |
Stores the given value. More... | |
imt::base::bsp::type::ErrorCode::Id | onUnregisterValueHandler (const size_t indexEndpoint) |
Unregisters the given handler for the given endpoint. More... | |
Public Attributes | |
uint32_t | m_enableInvokeCounter { 0U } |
Number of calls to the enable function. | |
uint32_t | m_initializeInvokeCounter { 0U } |
Number of calls to the initialize function. | |
uint32_t | m_readInvokeCounter { 0U } |
Number of calls to the data read function. | |
uint64_t | m_readValue { 0U } |
Read value. | |
uint8_t | m_readData [MAX_DATA_SIZE] {} |
Read data. | |
imt::base::bsp::type::ErrorCode::Id | m_readReturnValue { imt::base::bsp::type::ErrorCode::OK } |
Error code of the read functions. | |
uint32_t | m_reconfigureInvokeCounter { 0U } |
Number of calls to the reconfigure function. | |
imt::base::bsp::type::ErrorCode::Id | m_reconfigureReturnValue { imt::base::bsp::type::ErrorCode::OK } |
Error code of the reconfigure function. | |
uint32_t | m_startInvokeCounter { 0U } |
Number of calls to the start function. | |
imt::base::bsp::type::ErrorCode::Id | m_startReturnValue { imt::base::bsp::type::ErrorCode::OK } |
Error code of the start function. | |
uint32_t | m_stopInvokeCounter { 0U } |
Number of calls to the stop function. | |
imt::base::bsp::type::ErrorCode::Id | m_stopReturnValue { imt::base::bsp::type::ErrorCode::OK } |
ErrorCode of the stop function. | |
std::map< size_t, handler::HighLevelValueHandlerIfc * > | m_valueHandlerMap |
Map to store the registered handlers. | |
uint32_t | m_writeInvokeCounter { 0U } |
Number of calls to the data write function. | |
std::vector< uint8_t * > | m_writeData {} |
Vector storing the written data. | |
std::vector< uint64_t > | m_writeValue {} |
Vector storing the written values. | |
imt::base::bsp::type::ErrorCode::Id | m_writeReturnValue { imt::base::bsp::type::ErrorCode::OK } |
Error code of the write functions. | |
Static Public Attributes | |
static const size_t | MAX_DATA_SIZE = 1024U |
Maximum number of bytes to read or write. | |
Provides a mock implementation of the BSP driver.
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onRead | ( | uint8_t * | pData, |
const size_t | size, | ||
uint8_t *const | pBytesRead | ||
) |
Copies the read data to the given array, sets the number of bytes read and increments the read counter.
pData | The array the bytes will be written to. |
size | The maximal number of bytes to read (array size). |
pBytesRead | The actual number of bytes read. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onReadValue | ( | bool *const | pValue | ) |
Sets the value of the given pointer to true if the read value is greater than 0, false otherwhise.
pValue | Pointer to the value to be set. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onReadValue | ( | float32_t *const | pValue | ) |
Sets the value of the given pointer to the read value.
pValue | Pointer to the value to be set. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onReadValue | ( | uint32_t *const | pValue | ) |
Sets the value of the given pointer to the read value.
pValue | Pointer to the value to be set. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onRegisterValueHandler | ( | const size_t | indexEndpoint, |
handler::HighLevelValueHandlerIfc *const | pHandler | ||
) |
Registers the given handler for the given endpoint.
indexEndpoint | The index of the endpoint the handler has to be registered for. |
pHandler | The handler. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onUnregisterValueHandler | ( | const size_t | indexEndpoint | ) |
Unregisters the given handler for the given endpoint.
indexEndpoint | The index of the endpoint the handler has to be unregistered from. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWrite | ( | const uint8_t | pData[], |
const uint32_t | size, | ||
uint8_t *const | pBytesWritten | ||
) |
Stores the data given by an array and increments the write counter.
pData | Array with data to be written. |
size | Number of bytes to write. |
pBytesWritten | Actual number of bytes written. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue | ( | const bool | value | ) |
Stores the given value.
value | Value to be written. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue | ( | const float32_t | value | ) |
Stores the given value.
value | Value to be written. |
imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue | ( | const uint32_t | value | ) |
Stores the given value.
value | Value to be written. |