Dataflow Runtime API  3.0.3.0
Public Member Functions | Protected Member Functions | List of all members
imt::base::bsp::driver::HighLevelDriver Class Reference

Driver for a high level peripheral. More...

#include <Imt.Base.BSP/Driver/HighLevelDriver.h>

Inheritance diagram for imt::base::bsp::driver::HighLevelDriver:
imt::base::bsp::module::DriverAbs< imt::base::bsp::type::DriverType::HIGH_LEVEL_DRV >

Public Member Functions

 HighLevelDriver (const size_t indexModule, const size_t indexDriver)
 Constructor. More...
 
virtual ~HighLevelDriver (void)
 Destructor. More...
 
imt::base::bsp::type::ErrorCode::Id configure (const uint8_t *const pConfiguration, const size_t configurationSize)
 Configures the driver. More...
 
imt::base::bsp::type::ErrorCode::Id getConfiguration (uint8_t *const pBuffer, const size_t bufferSize) const
 Gets the last accepted configuration. More...
 
imt::base::bsp::type::ErrorCode::Id getConfigurationProperty (const size_t indexProperty, uint8_t *const pBuffer, const size_t bufferSize) const
 Gets a configuration property. More...
 
size_t getConfigurationSize (void) const
 Gets the number of bytes of the configuration object. More...
 
size_t getConfigurationPropertyCount (void) const
 Gets the number of properties in the configuration object. More...
 
size_t getConfigurationPropertySize (const size_t indexProperty) const
 Gets the number of bytes of a single property inside the configuration object. More...
 
size_t getValueCount (void) const
 Gets the number of endpoints in the driver. More...
 
size_t getValueSize (const size_t indexEndpoint) const
 Gets the size of the value used for a certain endpoint. More...
 
bool isValue (const size_t indexEndpoint) const
 Checks wether the endpoint exists. More...
 
imt::base::bsp::type::ErrorCode::Id readValue (const size_t indexEndpoint, uint8_t *const pBuffer, const size_t bufferSize) const
 Reads a value from the given endpoint. More...
 
imt::base::bsp::type::ErrorCode::Id writeValue (const size_t indexEndpoint, const uint8_t *const pData, const size_t dataSize) const
 Writes a value to the given endpoint. More...
 
imt::base::bsp::type::ErrorCode::Id registerValueHandler (const size_t indexEndpoint, imt::base::bsp::handler::HighLevelValueHandlerIfc *const pHandler) const
 Registers a handler for the given endpoint that is called when the value changes. More...
 
imt::base::bsp::type::ErrorCode::Id unregisterValueHandler (const size_t indexEndpoint) const
 Removes the handler for the given endpoint. More...
 
- Public Member Functions inherited from imt::base::bsp::module::DriverAbs< imt::base::bsp::type::DriverType::HIGH_LEVEL_DRV >
 DriverAbs (const size_t indexModule, const size_t indexDriver)
 Constructor. More...
 
virtual ~DriverAbs (void)
 Destructor. More...
 
void initialize (void)
 Initialize the driver. More...
 
void enable (void)
 Enable the driver. More...
 
imt::base::bsp::type::ErrorCode::Id start (void)
 Starts the driver. More...
 
imt::base::bsp::type::ErrorCode::Id stop (void)
 Stops the driver. More...
 
size_t getIndexDriver (void) const
 Gets the index of the driver inisde the module. More...
 
size_t getIndexModule (void) const
 Gets the index of the module the driver is part of. More...
 
imt::base::bsp::type::DriverType::Id getType (void) const
 Gets the type of the driver. More...
 
bool isInitialized (void) const
 Gets if the driver has been initialzied. More...
 
bool isEnabled (void) const
 Gets if the driver has been enabled. More...
 
bool isStarted (void) const
 Gets if the driver has been started. More...
 

Protected Member Functions

virtual void onInitialize (void)
 
virtual void onEnable (void)
 
virtual imt::base::bsp::type::ErrorCode::Id onStart (void)
 
virtual imt::base::bsp::type::ErrorCode::Id onStop (void)
 

Additional Inherited Members

- Static Public Attributes inherited from imt::base::bsp::module::DriverAbs< imt::base::bsp::type::DriverType::HIGH_LEVEL_DRV >
static const imt::base::bsp::type::DriverType::Id Type
 Constant holding the driver type. More...
 

Detailed Description

Driver for a high level peripheral.

This driver used a generic interface so that the BSP creator can define the number and size of the configuration properties and the values the driver provides.

Constructor & Destructor Documentation

◆ HighLevelDriver()

imt::base::bsp::driver::HighLevelDriver::HighLevelDriver ( const size_t  indexModule,
const size_t  indexDriver 
)
explicit

Constructor.

Parameters
indexModuleIndex of the module (starting at 0).
indexDriverIndex of the driver (starting at 0).

◆ ~HighLevelDriver()

virtual imt::base::bsp::driver::HighLevelDriver::~HighLevelDriver ( void  )
virtual

Destructor.

Member Function Documentation

◆ configure()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::configure ( const uint8_t *const  pConfiguration,
const size_t  configurationSize 
)

Configures the driver.

Used to change the driver configuration. The configuration is applied only if it is valid, otherwise the old configuration remains active.

Parameters
pConfigurationThe byte array containing the configuration.
configurationSizeNumber of bytes provided.
Returns
OK Configuration is changed. INVALID_ARGUMENT Null pointer passed. OUT_OF_MEMORY The provided configuration does not contain enough bytes. WRITE_ERROR Invalid configuration, current configuration remains in effect.

◆ getConfiguration()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::getConfiguration ( uint8_t *const  pBuffer,
const size_t  bufferSize 
) const

Gets the last accepted configuration.

Parameters
pBufferThe configuration is written to the buffer.
bufferSizeNumber of bytes the buffer can hold.
Returns
OK Configuration could be read. INVALID_ARGUMENT Null pointer passed. OUT_OF_MEMORY The provided buffer is too small to hold the configuration. READ_ERROR Any other unspecified error while reading the configuration.
Last accepted configuration or hardware default.

◆ getConfigurationProperty()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::getConfigurationProperty ( const size_t  indexProperty,
uint8_t *const  pBuffer,
const size_t  bufferSize 
) const

Gets a configuration property.

Parameters
indexPropertyThe index of the property to read.
pBufferThe property is written to the buffer.
bufferSizeNumber of bytes the buffer can hold.
Returns
OK Property could be read. INVALID_ARGUMENT Null pointer passed. OUT_OF_MEMORY The provided buffer is too small to hold the property. DATA_NONE The requested property is not avaliable. READ_ERROR Any other unspecified error while reading the property.
Last accepted configuration property or hardware default.

◆ getConfigurationPropertyCount()

size_t imt::base::bsp::driver::HighLevelDriver::getConfigurationPropertyCount ( void  ) const

Gets the number of properties in the configuration object.

Returns
Number of properties.

◆ getConfigurationPropertySize()

size_t imt::base::bsp::driver::HighLevelDriver::getConfigurationPropertySize ( const size_t  indexProperty) const

Gets the number of bytes of a single property inside the configuration object.

Parameters
indexPropertyThe index of the property.
Returns
Number of bytes or 0 if the property does not exist.

◆ getConfigurationSize()

size_t imt::base::bsp::driver::HighLevelDriver::getConfigurationSize ( void  ) const

Gets the number of bytes of the configuration object.

Returns
Number of bytes.

◆ getValueCount()

size_t imt::base::bsp::driver::HighLevelDriver::getValueCount ( void  ) const

Gets the number of endpoints in the driver.

Returns
Number of endpoints.

◆ getValueSize()

size_t imt::base::bsp::driver::HighLevelDriver::getValueSize ( const size_t  indexEndpoint) const

Gets the size of the value used for a certain endpoint.

Parameters
indexEndpointThe index of the endpoint.
Returns
Number of bytes the value uses or 0 if the value index is not valid.

◆ isValue()

bool imt::base::bsp::driver::HighLevelDriver::isValue ( const size_t  indexEndpoint) const

Checks wether the endpoint exists.

Parameters
indexEndpointThe index of the endpoint.
Returns
true if the driver supports the given value index, false otherwise.

◆ onEnable()

virtual void imt::base::bsp::driver::HighLevelDriver::onEnable ( void  )
protectedvirtual

◆ onInitialize()

virtual void imt::base::bsp::driver::HighLevelDriver::onInitialize ( void  )
protectedvirtual

◆ onStart()

virtual imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::onStart ( void  )
protectedvirtual

◆ onStop()

virtual imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::onStop ( void  )
protectedvirtual

◆ readValue()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::readValue ( const size_t  indexEndpoint,
uint8_t *const  pBuffer,
const size_t  bufferSize 
) const

Reads a value from the given endpoint.

Parameters
indexEndpointThe index of the endpoint that is read.
pBufferThe value of the endpoint is written to the buffer.
bufferSizeNumber of bytes the buffer can hold.
Returns
OK Value could be read. INVALID_ARGUMENT Null pointer passed. OUT_OF_MEMORY The provided buffer is too small to hold the value. DATA_NONE The requested endpoint is not avaliable. UNINITIALIZED The endpoint can not be read because it has not been initialized. INVALID_STATE Driver is not started. READ_ERROR Any other unspecified error while reading.

◆ registerValueHandler()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::registerValueHandler ( const size_t  indexEndpoint,
imt::base::bsp::handler::HighLevelValueHandlerIfc *const  pHandler 
) const

Registers a handler for the given endpoint that is called when the value changes.

Parameters
indexEndpointThe index of the endpoint the handler has to be registered for.
pHandlerThe handler.
Returns
OK The handler could be registered. INVALID_ARGUMENT Null pointer passed. DATA_EXISTS A handler has been registered already, use unregisterValueHandler first.

◆ unregisterValueHandler()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::unregisterValueHandler ( const size_t  indexEndpoint) const

Removes the handler for the given endpoint.

Parameters
indexEndpointThe index of the endpoint the handler has to be removed.
Returns
OK The handler has been removed. DATA_NONE No handler has been registered for the given value.

◆ writeValue()

imt::base::bsp::type::ErrorCode::Id imt::base::bsp::driver::HighLevelDriver::writeValue ( const size_t  indexEndpoint,
const uint8_t *const  pData,
const size_t  dataSize 
) const

Writes a value to the given endpoint.

Parameters
indexEndpointThe index of the endpoint that is written.
pDataThe value to write.
dataSizeNumber of bytes provided.
Returns
OK Value could be written. INVALID_ARGUMENT Null pointer passed or invalid data size. OUT_OF_MEMORY The provided data does not contain enough bytes for the given endpoint. DATA_NONE The requested endpoint is not avaliable. INVALID_STATE Driver is not started. WRITE_ERROR Any other unspecified error while writing.

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