Dawn Framework 1.0
Universal data acquisition framework for embedded systems
gnss.hxx
1// dawn/include/dawn/system/gnss.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include "dawn/common/thread.hxx"
9#include "dawn/system/common.hxx"
10
11namespace dawn
12{
17enum
18{
23};
24
37 : public CSystemCommon
38 , public CThreadedObject
39{
40public:
43 enum
44 {
45 GNSS_CFG_FIRST = 0,
53 GNSS_CFG_LAST = 31
54 };
55
58 constexpr static SObjectId::ObjectId objectId(uint16_t inst = 0)
59 {
62 }
63
66 constexpr static SObjectCfg::ObjectCfgId cfgIdMode(bool rw = true)
67 {
69 }
70
71 constexpr static SObjectCfg::ObjectCfgId cfgIdSettle(bool rw = true)
72 {
74 }
75
76 constexpr static SObjectCfg::ObjectCfgId cfgIdAcquire(bool rw = true)
77 {
79 }
80
81 constexpr static SObjectCfg::ObjectCfgId cfgIdRetry(bool rw = true)
82 {
84 }
85
86 constexpr static SObjectCfg::ObjectCfgId cfgIdMaxAttempts(bool rw = true)
87 {
89 }
90
91 constexpr static SObjectCfg::ObjectCfgId cfgIdRearm(bool rw = true)
92 {
94 }
95
96 constexpr static SObjectCfg::ObjectCfgId cfgIdEnabled(bool rw = true)
97 {
99 }
100
101 explicit CSystemGnss(CDescObject &desc);
102
103 int configure() override;
104
105#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
106 const char *getClassNameStr() const override
107 {
108 return "gnss";
109 }
110#endif
111
112protected:
113 int doStart() override;
114 int doStop() override;
115
118 int onSetObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len) override;
119
120private:
121 uint8_t mode;
122 bool enabled;
123 uint32_t settle;
124 uint32_t acquire;
125 uint32_t retry;
126 uint32_t maxAttempts;
127 uint32_t rearm;
128 int fd;
129
132 void loadParams();
133
136 int startMonitor();
137
140 void stopMonitor();
141
144 void monitor();
145};
146} // Namespace dawn
Base class for OBJTYPE_ANY configuration objects.
Definition common.hxx:25
@ SYSTEM_CLASS_GNSS
GNSS coexistence manager (policy)
Definition common.hxx:31
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.
Definition common.hxx:52
GNSS coexistence manager.
Definition gnss.hxx:39
static SObjectId::ObjectId objectId(uint16_t inst=0)
Build this object's ObjectId for a given instance.
Definition gnss.hxx:58
int doStart()
Start implementation hook.
Definition gnss.cxx:302
@ GNSS_CFG_MODE
DAWN_GNSS_MODE_* (DTYPE_UINT8)
Definition gnss.hxx:46
@ GNSS_CFG_ENABLED
Runtime on/off switch (DTYPE_BOOL)
Definition gnss.hxx:52
@ GNSS_CFG_ACQUIRE
Bounded fix window, seconds (DTYPE_UINT32)
Definition gnss.hxx:48
@ GNSS_CFG_REARM
Re-arm delay after give-up, s (DTYPE_UINT32)
Definition gnss.hxx:51
@ GNSS_CFG_MAXATTEMPTS
No-fix windows before give-up (DTYPE_UINT32)
Definition gnss.hxx:50
@ GNSS_CFG_SETTLE
LTE-first grace, seconds (DTYPE_UINT32)
Definition gnss.hxx:47
@ GNSS_CFG_RETRY
Cooldown between attempts, s (DTYPE_UINT32)
Definition gnss.hxx:49
int configure()
Configure object from descriptor data.
Definition gnss.cxx:127
int onSetObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
React to runtime config writes (e.g.
Definition gnss.cxx:332
int doStop()
Stop implementation hook.
Definition gnss.cxx:326
static SObjectCfg::ObjectCfgId cfgIdMode(bool rw=true)
Config-item id helper (cls = SYSTEM_CLASS_GNSS).
Definition gnss.hxx:66
Portable thread owner abstraction for Dawn components.
Definition thread.hxx:32
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
Definition objectcfg.hxx:60
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
@ DAWN_GNSS_MODE_OFF
Manager idle; do not touch the radio knobs.
Definition gnss.hxx:19
@ DAWN_GNSS_MODE_HYBRID
LTE first, then borrow the radio in bounded windows for a cold fix, always handing it back so LTE sta...
Definition gnss.hxx:20
@ OBJTYPE_ANY
Wildcard/metadata object type.
Definition objectid.hxx:176
@ DTYPE_UINT8
Unsigned 8-bit integer (0 to 255).
Definition objectid.hxx:80
@ DTYPE_ANY
Wildcard data type (matches any actual type).
Definition objectid.hxx:68
@ DTYPE_UINT32
Unsigned 32-bit integer (0 to 4294967295).
Definition objectid.hxx:96
@ DTYPE_BOOL
Boolean data type (stored in 32-bit container).
Definition objectid.hxx:72
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.
Definition objectid.hxx:290