Dataflow Runtime API  2.7.4.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
imt::base::bsp::mock::DriverMock Class Reference

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.
 

Detailed Description

Provides a mock implementation of the BSP driver.

Member Function Documentation

◆ onRead()

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.

Parameters
pDataThe array the bytes will be written to.
sizeThe maximal number of bytes to read (array size).
pBytesReadThe actual number of bytes read.
Returns
Error code.

◆ onReadValue() [1/3]

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.

Parameters
pValuePointer to the value to be set.
Returns
Error code.

◆ onReadValue() [2/3]

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.

Parameters
pValuePointer to the value to be set.
Returns
Error code.

◆ onReadValue() [3/3]

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.

Parameters
pValuePointer to the value to be set.
Returns
Error code.

◆ onRegisterValueHandler()

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.

Parameters
indexEndpointThe index of the endpoint the handler has to be registered for.
pHandlerThe handler.
Returns
Error code.

◆ onUnregisterValueHandler()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onUnregisterValueHandler ( const size_t  indexEndpoint)

Unregisters the given handler for the given endpoint.

Parameters
indexEndpointThe index of the endpoint the handler has to be unregistered from.
Returns
Error code.

◆ onWrite()

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.

Parameters
pDataArray with data to be written.
sizeNumber of bytes to write.
pBytesWrittenActual number of bytes written.
Returns
Error code.

◆ onWriteValue() [1/3]

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue ( const bool  value)

Stores the given value.

Parameters
valueValue to be written.
Returns
Error code.

◆ onWriteValue() [2/3]

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue ( const float32_t  value)

Stores the given value.

Parameters
valueValue to be written.
Returns
Error code.

◆ onWriteValue() [3/3]

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::onWriteValue ( const uint32_t  value)

Stores the given value.

Parameters
valueValue to be written.
Returns
Error code.

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