|
Dawn Framework 1.0
Universal data acquisition framework for embedded systems
|
Base class for OBJTYPE_ANY configuration objects. More...
#include <common.hxx>
Public Types | |
| enum | { } |
| enum | { CMD_RESET = 0 , CMD_TRIGGER1 = 1 , CMD_TRIGGER2 = 2 , CMD_TRIGGER3 = 3 } |
| Control command identifiers for control() More... | |
| enum | |
| Default descriptor validation failure codes. More... | |
| enum | EObjectState { STATE_STOPPED = 0 , STATE_RUNNING = 1 } |
| Object operational state returned by getState() More... | |
Public Member Functions | |
| virtual int | configure () |
| Configure object from descriptor data. | |
| virtual int | deinit () |
| De-initialize object. | |
| bool | getCfgFlag () const |
| Check if configuration flag is set. | |
| uint16_t | getCls () const |
| Get object class field. | |
| CDescObject & | getDesc () |
| Get descriptor object for this object. | |
| uint8_t | getDtype () const |
| Get data type field. | |
| size_t | getDtypeSize () const |
| Get size of this object's data type. | |
| uint8_t | getFlags () const |
| Get type-specific flags field. | |
| SObjectId::UObjectId | getId () const |
| Get object identifier as union structure. | |
| SObjectId::ObjectId | getIdV () const |
| Get object identifier as raw 32-bit value. | |
| int | getObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len) |
| Get object configuration item. | |
| uint16_t | getPriv () const |
| Get instance/private data field. | |
| virtual EObjectState | getState () const |
| Get current operational state. | |
| uint8_t | getType () const |
| Get object type field. | |
| virtual bool | hasThread () const |
| Check if a background thread is active. | |
| virtual int | init () |
| One-time initialize object after bindings are resolved. | |
| int | setObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len) |
| Set object configuration item. | |
| int | start () |
| Start object. | |
| int | stop () |
| Stop object. | |
| virtual int | trigger (uint8_t cmd) |
| Execute a trigger command. | |
Static Public Member Functions | |
| static SObjectCfg::ObjectCfgId | cfgId (uint16_t cls, uint8_t dtype, bool rw, uint16_t size, uint8_t id) |
| Build a config-item id for a dev object. | |
| static int | descValidDefault (const uint32_t *data, size_t len) |
| Default descriptor validation method. | |
| static int | validateDesc (const uint32_t *desc, size_t len) |
| Validate entire descriptor. | |
Protected Member Functions | |
| virtual int | doStart () |
| Start implementation hook. | |
| virtual int | doStop () |
| Stop implementation hook. | |
| virtual int | onSetObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len) |
| Pre-update hook for runtime configuration writes. | |
Base class for OBJTYPE_ANY configuration objects.
SYSTEM objects hold a subsystem's settings as configuration items and own their lifecycle (start/stop). They are not data points: there is no getData/setData. Parameters are reached through a Config IO (which proxies getObjConfig/setObjConfig); start()/stop() can be driven by a Control IO.
Class 0 is the descriptor metadata object, so SYSTEM object classes start at SYSTEM_CLASS_FIRST. Multiple instances of one class differ by the priv field.
Definition at line 24 of file common.hxx.
| anonymous enum |
| Enumerator | |
|---|---|
| SYSTEM_CLASS_LTE | LTE / cellular connectivity settings. |
| SYSTEM_CLASS_GNSS | GNSS coexistence manager (policy) |
| SYSTEM_CLASS_LAST | 9-bit class field |
Definition at line 27 of file common.hxx.
|
inherited |
Control command identifiers for control()
| Enumerator | |
|---|---|
| CMD_RESET | Reset object internal state. |
| CMD_TRIGGER1 | Object-specific trigger slot 1. |
| CMD_TRIGGER2 | Object-specific trigger slot 2. |
| CMD_TRIGGER3 | Object-specific trigger slot 3. |
Definition at line 40 of file object.hxx.
|
inherited |
Default descriptor validation failure codes.
Negative values identify which length check failed in descValidDefault().
Definition at line 314 of file object.hxx.
|
inherited |
Object operational state returned by getState()
| Enumerator | |
|---|---|
| STATE_STOPPED | Object is stopped. |
| STATE_RUNNING | Object is running. |
Definition at line 32 of file object.hxx.
|
inlinestatic |
Build a config-item id for a dev object.
| cls | SYSTEM class (SYSTEM_CLASS_*). |
| dtype | Data type (SObjectId::DTYPE_*). |
| rw | Read-write flag. |
| size | Size in 32-bit words. |
| id | Config item id. |
Definition at line 52 of file common.hxx.
References dawn::SObjectCfg::objectCfg(), and dawn::SObjectId::OBJTYPE_ANY.
|
inlinevirtualinherited |
Configure object from descriptor data.
Called during framework setup before dependency binding. Implementations should parse/validate descriptor configuration and store object settings, but avoid one-time allocations that depend on bound objects.
Reimplemented in dawn::CIOAdcBase, dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIOBatteryBase, dawn::CIOButtons, dawn::CIOCapabilities, dawn::CIOConfig, dawn::CIOControl, dawn::CIODac, dawn::CIODescriptor, dawn::CIODescSelector, dawn::CIODummy, dawn::CIODummyNotify, dawn::CIOEncoder, dawn::CIOEncoderIndex, dawn::CIOFile, dawn::CIOGpi, dawn::CIOGpo, dawn::CIOLeds, dawn::CIOLteSignal, dawn::CIOPulseCount, dawn::CIOPwm, dawn::CIORand, dawn::CIORgbLed, dawn::CIOSensor, dawn::CIOSensorProducer, dawn::CIOTimestamp, dawn::CIOTrigger, dawn::CIOVirt, dawn::CProgAdjust, dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgDummy, dawn::CProgExpression, dawn::CProgGateway, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoDummy, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNimblePrph, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoShellPretty, dawn::CProtoUdp, dawn::CProtoWakaama, dawn::CSystemGnss, and dawn::CSystemLte.
Definition at line 73 of file object.hxx.
|
inlinevirtualinherited |
De-initialize object.
Clean up resources allocated during init().
Reimplemented in dawn::CIOAdcBase, dawn::CIOBatteryBase, dawn::CIOButtons, dawn::CIOCapabilities, dawn::CIOConfig, dawn::CIOControl, dawn::CIODac, dawn::CIODescriptor, dawn::CIODescSelector, dawn::CIODummy, dawn::CIODummyNotify, dawn::CIOEncoder, dawn::CIOEncoderIndex, dawn::CIOFile, dawn::CIOGpi, dawn::CIOGpo, dawn::CIOLeds, dawn::CIOLteSignal, dawn::CIOPulseCount, dawn::CIOPwm, dawn::CIORand, dawn::CIORgbLed, dawn::CIOSensor, dawn::CIOSensorProducer, dawn::CIOTimestamp, dawn::CIOTrigger, dawn::CIOVirt, dawn::CProgAdjust, dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgExpression, dawn::CProgGateway, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNimblePrph, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoUdp, and dawn::CProtoWakaama.
Definition at line 100 of file object.hxx.
|
staticinherited |
Default descriptor validation method.
Provides basic validation that only checks if descriptor lengths are correct.
| data | Descriptor data pointer. |
| len | Length of descriptor data in 32-bit words. |
Definition at line 42 of file object.cxx.
References dawn::SObjectCfg::UObjectCfgId::s, dawn::SObjectCfg::UObjectCfgId::size, and dawn::SObjectCfg::UObjectCfgId::v.
|
inlineprotectedvirtualinherited |
Start implementation hook.
Override in derived classes instead of start().
Reimplemented in dawn::CIOAdcFetch, dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIODummyNotify, dawn::CIOLteSignal, dawn::CIOPwm, dawn::CIORand, dawn::CIOTimestamp, dawn::CProgAdjust, dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgExpression, dawn::CProgGateway, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNimblePrph, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoShellPretty, dawn::CProtoUdp, dawn::CProtoWakaama, dawn::CSystemGnss, and dawn::CSystemLte.
Definition at line 402 of file object.hxx.
|
inlineprotectedvirtualinherited |
Stop implementation hook.
Override in derived classes instead of stop().
Reimplemented in dawn::CIOAdcFetch, dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIODummyNotify, dawn::CIOLteSignal, dawn::CIOPwm, dawn::CIORand, dawn::CIOTimestamp, dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgExpression, dawn::CProgGateway, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNimblePrph, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoShellPretty, dawn::CProtoUdp, dawn::CProtoWakaama, dawn::CSystemGnss, and dawn::CSystemLte.
Definition at line 415 of file object.hxx.
|
inherited |
Check if configuration flag is set.
Definition at line 160 of file object.cxx.
References dawn::CDescObject::getSize().
|
inherited |
Get object class field.
Definition at line 170 of file object.cxx.
References dawn::SObjectId::UObjectId::cls, and dawn::SObjectId::UObjectId::s.
|
inherited |
Get descriptor object for this object.
Definition at line 190 of file object.cxx.
|
inherited |
Get data type field.
Definition at line 175 of file object.cxx.
References dawn::SObjectId::UObjectId::dtype, and dawn::SObjectId::UObjectId::s.
|
inherited |
Get size of this object's data type.
Definition at line 195 of file object.cxx.
References dawn::SObjectId::getDtypeSize_(), and dawn::CDescObject::getObjectDtype().
|
inherited |
Get type-specific flags field.
Definition at line 180 of file object.cxx.
References dawn::SObjectId::UObjectId::flags, and dawn::SObjectId::UObjectId::s.
|
inherited |
Get object identifier as union structure.
Definition at line 150 of file object.cxx.
|
inherited |
Get object identifier as raw 32-bit value.
Definition at line 155 of file object.cxx.
References dawn::SObjectId::UObjectId::v.
|
inherited |
Get object configuration item.
Retrieves configuration data for this object.
| objcfg | Configuration ID specifying which config item to retrieve. |
| data | Pointer to buffer for configuration data. |
| len | Length of buffer in 32-bit words. |
Definition at line 240 of file object.cxx.
References dawn::SObjectCfg::SObjectCfgItem::data, dawn::SObjectCfg::objectCfgGetSize(), and dawn::CDescObject::objectCfgItemId().
|
inherited |
Get instance/private data field.
Definition at line 185 of file object.cxx.
References dawn::SObjectId::UObjectId::priv, and dawn::SObjectId::UObjectId::s.
|
inlinevirtualinherited |
Get current operational state.
Default returns STATE_RUNNING after successful start(), STATE_STOPPED otherwise. Objects with richer states (e.g. paused) should override.
Definition at line 183 of file object.hxx.
References dawn::CObject::STATE_RUNNING, and dawn::CObject::STATE_STOPPED.
|
inherited |
Get object type field.
Definition at line 165 of file object.cxx.
References dawn::SObjectId::UObjectId::s, and dawn::SObjectId::UObjectId::type.
|
inlinevirtualinherited |
Check if a background thread is active.
Used by Dawn's main loop to detect when clean exit is possible. Objects without a background thread must return false. Independent of operational state tracked via getState().
Reimplemented in dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgExpression, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNimblePrph, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoShellPretty, dawn::CProtoUdp, and dawn::CProtoWakaama.
Definition at line 169 of file object.hxx.
|
inlinevirtualinherited |
One-time initialize object after bindings are resolved.
Called once during framework setup after dependency binding. Allocate lifetime resources here (buffers, register maps, etc.).
Reimplemented in dawn::CIOAdcBase, dawn::CIODummy, dawn::CIODummyNotify, dawn::CIOEncoder, dawn::CIOEncoderIndex, dawn::CIOGpi, dawn::CIOGpo, dawn::CIOLeds, dawn::CIOLteSignal, dawn::CIOPulseCount, dawn::CIOPwm, dawn::CIORgbLed, dawn::CIOSysinfo, dawn::CIOSystime, dawn::CIOUname, dawn::CIOUuid, dawn::CIOVirt, dawn::CProgAdjust, dawn::CProgBitPack, dawn::CProgBitSplit, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgExpression, dawn::CProgGateway, dawn::CProgIODemux, dawn::CProgIOMux, dawn::CProgManyToOne, dawn::CProgOneToMany, dawn::CProgProcess, dawn::CProgRedirect, dawn::CProgSampling, dawn::CProgSelector, dawn::CProgSequencer, dawn::CProgSwitch, dawn::CProgToggle, dawn::CProgVecPack, dawn::CProgVecSplit, dawn::CProtoCan, dawn::CProtoIpc, dawn::CProtoModbusRtu, dawn::CProtoModbusTcp, dawn::CProtoNxscope, dawn::CProtoSerial, dawn::CProtoUdp, and dawn::CProtoWakaama.
Definition at line 87 of file object.hxx.
|
inlineprotectedvirtualinherited |
Pre-update hook for runtime configuration writes.
Called by setObjConfig() before descriptor-backed storage is updated. Derived classes may validate incoming data and prepare/apply runtime side effects. Returning a negative error rejects the update.
| objcfg | Configuration ID that will be updated. |
| data | Pointer to new config words. |
| len | Number of config words. |
Reimplemented in dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIOPulseCount, dawn::CIOPwm, dawn::CProgAdjust, and dawn::CSystemGnss.
Definition at line 386 of file object.hxx.
|
inherited |
Set object configuration item.
Updates a configuration item for this object.
| objcfg | Configuration ID specifying which config item to update. |
| data | Pointer to configuration data. |
| len | Length of configuration data in 32-bit words. |
Definition at line 200 of file object.cxx.
References dawn::SObjectCfg::SObjectCfgItem::data, dawn::SObjectCfg::objectCfgGetRw(), dawn::SObjectCfg::objectCfgGetSize(), dawn::CDescObject::objectCfgItemId(), and dawn::CObject::onSetObjConfig().
|
inlineinherited |
Start object.
Tracks operational state and calls doStart(). This phase may run many times during an object's lifetime and should not perform one-time allocation. Sets started on successful doStart() return.
Definition at line 116 of file object.hxx.
References dawn::CObject::doStart().
|
inlineinherited |
Stop object.
Tracks operational state and calls doStop(). This phase may run many times during an object's lifetime and should not perform one-time deallocation. Always clears started regardless of doStop() return value.
Definition at line 145 of file object.hxx.
References dawn::CObject::doStop().
|
inlinevirtualinherited |
Execute a trigger command.
| cmd | Command identifier (EObjectCmd value). |
Reimplemented in dawn::CIOAdcFetch, dawn::CIOAdcStream, dawn::CIOAdcSync, dawn::CIOEncoder, dawn::CIOEncoderIndex, dawn::CIOPwm, dawn::CProgBuffer, dawn::CProgCounter, dawn::CProgProcess, dawn::CProgSequencer, dawn::CProgThresholdBase, and dawn::CProgToggle.
Definition at line 195 of file object.hxx.
|
staticinherited |
Validate entire descriptor.
Validates a descriptor binary object-by-object using default checks.
| desc | Descriptor binary pointer. |
| len | Descriptor length in 32-bit words. |
Definition at line 123 of file object.cxx.
References dawn::CObject::descValidDefault().