Dataflow Runtime API  3.0.3.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. More...
 
virtual ~DriverMock ()
 Destructor. More...
 
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. More...
 
uint32_t m_initializeInvokeCounter { 0U }
 Number of calls to the initialize function. More...
 
uint32_t m_readInvokeCounter { 0U }
 Number of calls to the data read function. More...
 
uint64_t m_readValue { 0U }
 Read value. More...
 
uint8_t m_readData [MAX_DATA_SIZE] {}
 Read data. More...
 
imt::base::bsp::type::ErrorCode::Id m_readReturnValue { imt::base::bsp::type::ErrorCode::OK }
 Error code of the read functions. More...
 
uint32_t m_reconfigureInvokeCounter { 0U }
 Number of calls to the reconfigure function. More...
 
imt::base::bsp::type::ErrorCode::Id m_reconfigureReturnValue { imt::base::bsp::type::ErrorCode::OK }
 Error code of the reconfigure function. More...
 
uint32_t m_startInvokeCounter { 0U }
 Number of calls to the start function. More...
 
imt::base::bsp::type::ErrorCode::Id m_startReturnValue { imt::base::bsp::type::ErrorCode::OK }
 Error code of the start function. More...
 
uint32_t m_stopInvokeCounter { 0U }
 Number of calls to the stop function. More...
 
imt::base::bsp::type::ErrorCode::Id m_stopReturnValue { imt::base::bsp::type::ErrorCode::OK }
 ErrorCode of the stop function. More...
 
std::map< size_t, handler::HighLevelValueHandlerIfc * > m_valueHandlerMap
 Map to store the registered handlers. More...
 
uint32_t m_writeInvokeCounter { 0U }
 Number of calls to the data write function. More...
 
std::vector< uint8_t * > m_writeData {}
 Vector storing the written data. More...
 
std::vector< uint64_tm_writeValue {}
 Vector storing the written values. More...
 
imt::base::bsp::type::ErrorCode::Id m_writeReturnValue { imt::base::bsp::type::ErrorCode::OK }
 Error code of the write functions. More...
 

Static Public Attributes

static const size_t MAX_DATA_SIZE = 1024U
 Maximum number of bytes to read or write. More...
 

Detailed Description

Provides a mock implementation of the BSP driver.

Constructor & Destructor Documentation

◆ DriverMock()

imt::base::bsp::mock::DriverMock::DriverMock ( )

Constructor.

◆ ~DriverMock()

virtual imt::base::bsp::mock::DriverMock::~DriverMock ( )
virtual

Destructor.

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.

Member Data Documentation

◆ m_enableInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_enableInvokeCounter { 0U }

Number of calls to the enable function.

◆ m_initializeInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_initializeInvokeCounter { 0U }

Number of calls to the initialize function.

◆ m_readData

uint8_t imt::base::bsp::mock::DriverMock::m_readData[MAX_DATA_SIZE] {}

Read data.

◆ m_readInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_readInvokeCounter { 0U }

Number of calls to the data read function.

◆ m_readReturnValue

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::m_readReturnValue { imt::base::bsp::type::ErrorCode::OK }

Error code of the read functions.

◆ m_readValue

uint64_t imt::base::bsp::mock::DriverMock::m_readValue { 0U }

Read value.

◆ m_reconfigureInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_reconfigureInvokeCounter { 0U }

Number of calls to the reconfigure function.

◆ m_reconfigureReturnValue

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::m_reconfigureReturnValue { imt::base::bsp::type::ErrorCode::OK }

Error code of the reconfigure function.

◆ m_startInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_startInvokeCounter { 0U }

Number of calls to the start function.

◆ m_startReturnValue

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::m_startReturnValue { imt::base::bsp::type::ErrorCode::OK }

Error code of the start function.

◆ m_stopInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_stopInvokeCounter { 0U }

Number of calls to the stop function.

◆ m_stopReturnValue

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::m_stopReturnValue { imt::base::bsp::type::ErrorCode::OK }

ErrorCode of the stop function.

◆ m_valueHandlerMap

std::map<size_t, handler::HighLevelValueHandlerIfc*> imt::base::bsp::mock::DriverMock::m_valueHandlerMap

Map to store the registered handlers.

◆ m_writeData

std::vector<uint8_t*> imt::base::bsp::mock::DriverMock::m_writeData {}

Vector storing the written data.

◆ m_writeInvokeCounter

uint32_t imt::base::bsp::mock::DriverMock::m_writeInvokeCounter { 0U }

Number of calls to the data write function.

◆ m_writeReturnValue

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::mock::DriverMock::m_writeReturnValue { imt::base::bsp::type::ErrorCode::OK }

Error code of the write functions.

◆ m_writeValue

std::vector<uint64_t> imt::base::bsp::mock::DriverMock::m_writeValue {}

Vector storing the written values.

◆ MAX_DATA_SIZE

const size_t imt::base::bsp::mock::DriverMock::MAX_DATA_SIZE = 1024U
static

Maximum number of bytes to read or write.


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