Dawn Framework 1.0
Universal data acquisition framework for embedded systems
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
dawn::CSystemGnss Class Reference

GNSS coexistence manager. More...

#include <gnss.hxx>

Inheritance diagram for dawn::CSystemGnss:
[legend]
Collaboration diagram for dawn::CSystemGnss:
[legend]

Public Types

enum  { }
 
enum  {
}
 Config item ids (cls = SYSTEM_CLASS_GNSS). More...
 
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

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.
 
CDescObjectgetDesc ()
 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.
 
const SThreadConfiggetThreadConfig () const
 Get current thread configuration.
 
int getThreadPriority () const
 Get configured worker thread priority.
 
int getThreadScheduler () const
 Get configured worker thread scheduler policy.
 
size_t getThreadStackSize () const
 Get configured worker thread stack size.
 
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.
 
bool isRunning () const
 Check if the worker thread is running.
 
int setObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 Set object configuration item.
 
void setThreadConfig (const SThreadConfig &config)
 Replace the full thread configuration.
 
template<typename Func >
void setThreadFunc (Func &&func)
 Assign the function executed by threadStart().
 
void setThreadPriority (int priority)
 Configure worker thread priority.
 
void setThreadScheduler (int scheduler)
 Configure worker thread scheduler policy.
 
void setThreadStackSize (size_t stackSize)
 Configure worker thread stack size.
 
int start ()
 Start object.
 
int stop ()
 Stop object.
 
int threadStart ()
 Start the worker thread.
 
int threadStop ()
 Stop the worker thread.
 
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 SObjectCfg::ObjectCfgId cfgIdMode (bool rw=true)
 Config-item id helper (cls = SYSTEM_CLASS_GNSS).
 
static int descValidDefault (const uint32_t *data, size_t len)
 Default descriptor validation method.
 
static SObjectId::ObjectId objectId (uint16_t inst=0)
 Build this object's ObjectId for a given instance.
 
static int validateDesc (const uint32_t *desc, size_t len)
 Validate entire descriptor.
 

Static Public Attributes

static int THREAD_PRIORITY_DEFAULT = 0
 Default thread priority behavior.
 
static int THREAD_SCHEDULER_DEFAULT = -1
 Default scheduler behavior.
 

Protected Member Functions

int doStart ()
 Start implementation hook.
 
int doStop ()
 Stop implementation hook.
 
int onSetObjConfig (SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
 React to runtime config writes (e.g.
 
template<typename Func >
int startWorkerThread (Func &&func)
 Start the worker thread with a given function.
 
int stopWorkerThread ()
 Stop the worker thread.
 
CThreadedObjectworkerThread ()
 Get a reference to this thread controller.
 
const CThreadedObjectworkerThread () const
 Get a const reference to this thread controller.
 
bool workerThreadRunning () const
 Check if the worker thread is running.
 

Detailed Description

GNSS coexistence manager.

The companion to the LTE manager (CSystemLte). On a single radio the modem time-shares LTE and GNSS; the kernel only provides the mechanisms (GNSS priority via SNIOC_GNSS_SET_PRIORITY, LTE power-save via the LTE API). This userspace manager owns the policy: a monitor thread watches GNSS for a fix and drives those knobs according to the configured mode. It is the place to implement and tune coexistence without touching the kernel.

Definition at line 36 of file gnss.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
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.

◆ anonymous enum

anonymous enum

Config item ids (cls = SYSTEM_CLASS_GNSS).

Enumerator
GNSS_CFG_MODE 

DAWN_GNSS_MODE_* (DTYPE_UINT8)

GNSS_CFG_SETTLE 

LTE-first grace, seconds (DTYPE_UINT32)

GNSS_CFG_ACQUIRE 

Bounded fix window, seconds (DTYPE_UINT32)

GNSS_CFG_RETRY 

Cooldown between attempts, s (DTYPE_UINT32)

GNSS_CFG_MAXATTEMPTS 

No-fix windows before give-up (DTYPE_UINT32)

GNSS_CFG_REARM 

Re-arm delay after give-up, s (DTYPE_UINT32)

GNSS_CFG_ENABLED 

Runtime on/off switch (DTYPE_BOOL)

Definition at line 43 of file gnss.hxx.

◆ anonymous enum

anonymous enum
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.

◆ anonymous enum

anonymous enum
inherited

Default descriptor validation failure codes.

Negative values identify which length check failed in descValidDefault().

Definition at line 314 of file object.hxx.

◆ EObjectState

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.

Member Function Documentation

◆ cfgId()

static SObjectCfg::ObjectCfgId dawn::CSystemCommon::cfgId ( uint16_t  cls,
uint8_t  dtype,
bool  rw,
uint16_t  size,
uint8_t  id 
)
inlinestaticinherited

Build a config-item id for a dev object.

Parameters
clsSYSTEM class (SYSTEM_CLASS_*).
dtypeData type (SObjectId::DTYPE_*).
rwRead-write flag.
sizeSize in 32-bit words.
idConfig item id.

Definition at line 52 of file common.hxx.

References dawn::SObjectCfg::objectCfg(), and dawn::SObjectId::OBJTYPE_ANY.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure()

int CSystemGnss::configure ( )
virtual

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.

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 127 of file gnss.cxx.

◆ deinit()

virtual int dawn::CObject::deinit ( )
inlinevirtualinherited

◆ descValidDefault()

int CObject::descValidDefault ( const uint32_t *  data,
size_t  len 
)
staticinherited

Default descriptor validation method.

Provides basic validation that only checks if descriptor lengths are correct.

Parameters
dataDescriptor data pointer.
lenLength of descriptor data in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 42 of file object.cxx.

References dawn::SObjectCfg::UObjectCfgId::s, dawn::SObjectCfg::UObjectCfgId::size, and dawn::SObjectCfg::UObjectCfgId::v.

Here is the caller graph for this function:

◆ doStart()

int CSystemGnss::doStart ( )
protectedvirtual

Start implementation hook.

Override in derived classes instead of start().

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 302 of file gnss.cxx.

References dawn::DAWN_GNSS_MODE_OFF.

◆ doStop()

int CSystemGnss::doStop ( )
protectedvirtual

Stop implementation hook.

Override in derived classes instead of stop().

Returns
OK on success, negative error code on failure.

Reimplemented from dawn::CObject.

Definition at line 326 of file gnss.cxx.

◆ getCfgFlag()

bool CObject::getCfgFlag ( ) const
inherited

Check if configuration flag is set.

Returns
True if this object has configuration data.

Definition at line 160 of file object.cxx.

References dawn::CDescObject::getSize().

Here is the call graph for this function:

◆ getCls()

uint16_t CObject::getCls ( ) const
inherited

Get object class field.

Returns
Object class identifier (0-511).

Definition at line 170 of file object.cxx.

References dawn::SObjectId::UObjectId::cls, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getDesc()

CDescObject & CObject::getDesc ( )
inherited

Get descriptor object for this object.

Returns
Reference to associated CDescObject.

Definition at line 190 of file object.cxx.

◆ getDtype()

uint8_t CObject::getDtype ( ) const
inherited

Get data type field.

Returns
Data type (DTYPE_UINT32, DTYPE_FLOAT, etc.).

Definition at line 175 of file object.cxx.

References dawn::SObjectId::UObjectId::dtype, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getDtypeSize()

size_t CObject::getDtypeSize ( ) const
inherited

Get size of this object's data type.

Returns
Size in bytes for the configured data type.

Definition at line 195 of file object.cxx.

References dawn::SObjectId::getDtypeSize_(), and dawn::CDescObject::getObjectDtype().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFlags()

uint8_t CObject::getFlags ( ) const
inherited

Get type-specific flags field.

Returns
Flags value (0-3).

Definition at line 180 of file object.cxx.

References dawn::SObjectId::UObjectId::flags, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getId()

SObjectId::UObjectId CObject::getId ( ) const
inherited

Get object identifier as union structure.

Returns
Reference to UObjectId structure.

Definition at line 150 of file object.cxx.

◆ getIdV()

SObjectId::ObjectId CObject::getIdV ( ) const
inherited

Get object identifier as raw 32-bit value.

Returns
ObjectID as uint32_t.

Definition at line 155 of file object.cxx.

References dawn::SObjectId::UObjectId::v.

Here is the caller graph for this function:

◆ getObjConfig()

int CObject::getObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
inherited

Get object configuration item.

Retrieves configuration data for this object.

Parameters
objcfgConfiguration ID specifying which config item to retrieve.
dataPointer to buffer for configuration data.
lenLength of buffer in 32-bit words.
Returns
OK on success, negative error code on failure.

Definition at line 240 of file object.cxx.

References dawn::SObjectCfg::SObjectCfgItem::data, dawn::SObjectCfg::objectCfgGetSize(), and dawn::CDescObject::objectCfgItemId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPriv()

uint16_t CObject::getPriv ( ) const
inherited

Get instance/private data field.

Returns
Instance ID (0-16383).

Definition at line 185 of file object.cxx.

References dawn::SObjectId::UObjectId::priv, and dawn::SObjectId::UObjectId::s.

Here is the caller graph for this function:

◆ getState()

virtual EObjectState dawn::CObject::getState ( ) const
inlinevirtualinherited

Get current operational state.

Default returns STATE_RUNNING after successful start(), STATE_STOPPED otherwise. Objects with richer states (e.g. paused) should override.

Returns
Current EObjectState value.

Definition at line 183 of file object.hxx.

References dawn::CObject::STATE_RUNNING, and dawn::CObject::STATE_STOPPED.

◆ getType()

uint8_t CObject::getType ( ) const
inherited

Get object type field.

Returns
Object type (OBJTYPE_IO, OBJTYPE_PROTO, OBJTYPE_PROG).

Definition at line 165 of file object.cxx.

References dawn::SObjectId::UObjectId::s, and dawn::SObjectId::UObjectId::type.

◆ hasThread()

virtual bool dawn::CObject::hasThread ( ) const
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().

Returns
True if a background thread is active, false otherwise.

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.

◆ init()

virtual int dawn::CObject::init ( )
inlinevirtualinherited

◆ isRunning()

bool CThreadedObject::isRunning ( ) const
inherited

Check if the worker thread is running.

Returns
True if thread is running, false otherwise.

Definition at line 262 of file thread.cxx.

Here is the caller graph for this function:

◆ onSetObjConfig()

int CSystemGnss::onSetObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
protectedvirtual

React to runtime config writes (e.g.

enable/disable over LwM2M).

Reimplemented from dawn::CObject.

Definition at line 332 of file gnss.cxx.

References dawn::DAWN_GNSS_MODE_OFF, GNSS_CFG_ENABLED, dawn::SObjectCfg::objectCfgGetCls(), dawn::SObjectCfg::objectCfgGetId(), and dawn::CSystemCommon::SYSTEM_CLASS_GNSS.

Here is the call graph for this function:

◆ setObjConfig()

int CObject::setObjConfig ( SObjectCfg::ObjectCfgId  objcfg,
uint32_t *  data,
size_t  len 
)
inherited

Set object configuration item.

Updates a configuration item for this object.

Parameters
objcfgConfiguration ID specifying which config item to update.
dataPointer to configuration data.
lenLength of configuration data in 32-bit words.
Returns
OK on success, negative error code on failure.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setThreadFunc()

template<typename Func >
void dawn::CThreadedObject::setThreadFunc ( Func &&  func)
inlineinherited

Assign the function executed by threadStart().

Parameters
funcCallable object to execute in the worker thread.

Definition at line 100 of file thread.hxx.

Here is the caller graph for this function:

◆ setThreadPriority()

void dawn::CThreadedObject::setThreadPriority ( int  priority)
inlineinherited

Configure worker thread priority.

Parameters
priorityRequested priority (0 = creator default).

Definition at line 149 of file thread.hxx.

References dawn::CThreadedObject::SThreadConfig::priority.

◆ setThreadScheduler()

void dawn::CThreadedObject::setThreadScheduler ( int  scheduler)
inlineinherited

Configure worker thread scheduler policy.

Parameters
schedulerPOSIX scheduler policy (-1 = creator default).

Definition at line 169 of file thread.hxx.

References dawn::CThreadedObject::SThreadConfig::scheduler.

◆ setThreadStackSize()

void dawn::CThreadedObject::setThreadStackSize ( size_t  stackSize)
inlineinherited

Configure worker thread stack size.

Parameters
stackSizeRequested stack size in bytes (0 = OS default).

Definition at line 129 of file thread.hxx.

References dawn::CThreadedObject::SThreadConfig::stackSize.

Here is the caller graph for this function:

◆ start()

int dawn::CObject::start ( )
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.

Returns
OK on success, negative error code on failure.

Definition at line 116 of file object.hxx.

References dawn::CObject::doStart().

Here is the call graph for this function:

◆ startWorkerThread()

template<typename Func >
int dawn::CThreadedObject::startWorkerThread ( Func &&  func)
inlineprotectedinherited

Start the worker thread with a given function.

Parameters
funcCallable object to execute in thread.
Returns
OK on success, negative error code on failure.

Definition at line 246 of file thread.hxx.

References dawn::CThreadedObject::setThreadFunc(), and dawn::CThreadedObject::threadStart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

int dawn::CObject::stop ( )
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.

Returns
OK on success, negative error code on failure.

Definition at line 145 of file object.hxx.

References dawn::CObject::doStop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopWorkerThread()

int dawn::CThreadedObject::stopWorkerThread ( )
inlineprotectedinherited

Stop the worker thread.

Returns
OK on success, negative error code on failure.

Definition at line 258 of file thread.hxx.

References dawn::CThreadedObject::threadStop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ threadStart()

int CThreadedObject::threadStart ( )
inherited

Start the worker thread.

Returns
OK on success, negative error code on failure.

Definition at line 172 of file thread.cxx.

Here is the caller graph for this function:

◆ threadStop()

int CThreadedObject::threadStop ( )
inherited

Stop the worker thread.

Returns
OK on success, negative error code on failure.

Definition at line 246 of file thread.cxx.

Here is the caller graph for this function:

◆ trigger()

virtual int dawn::CObject::trigger ( uint8_t  cmd)
inlinevirtualinherited

Execute a trigger command.

Parameters
cmdCommand identifier (EObjectCmd value).
Returns
OK on success, -ENOTSUP if not supported.

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.

◆ validateDesc()

int CObject::validateDesc ( const uint32_t *  desc,
size_t  len 
)
staticinherited

Validate entire descriptor.

Validates a descriptor binary object-by-object using default checks.

Parameters
descDescriptor binary pointer.
lenDescriptor length in 32-bit words.
Returns
OK on success, negative error code indicating validation stage.

Definition at line 123 of file object.cxx.

References dawn::CObject::descValidDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ workerThread() [1/2]

CThreadedObject & dawn::CThreadedObject::workerThread ( )
inlineprotectedinherited

Get a reference to this thread controller.

Returns
Reference to this object.

Definition at line 280 of file thread.hxx.

Here is the caller graph for this function:

◆ workerThread() [2/2]

const CThreadedObject & dawn::CThreadedObject::workerThread ( ) const
inlineprotectedinherited

Get a const reference to this thread controller.

Returns
Const reference to this object.

Definition at line 291 of file thread.hxx.

◆ workerThreadRunning()

bool dawn::CThreadedObject::workerThreadRunning ( ) const
inlineprotectedinherited

Check if the worker thread is running.

Returns
True if thread is running, false otherwise.

Definition at line 269 of file thread.hxx.

References dawn::CThreadedObject::isRunning().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ THREAD_PRIORITY_DEFAULT

int dawn::CThreadedObject::THREAD_PRIORITY_DEFAULT = 0
staticinherited

Default thread priority behavior.

Value 0 keeps the creator thread's default priority.

Definition at line 40 of file thread.hxx.

◆ THREAD_SCHEDULER_DEFAULT

int dawn::CThreadedObject::THREAD_SCHEDULER_DEFAULT = -1
staticinherited

Default scheduler behavior.

Value -1 keeps the creator thread's current scheduling policy.

Definition at line 48 of file thread.hxx.


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