Dawn Framework 1.0
Universal data acquisition framework for embedded systems
handler.hxx
1// dawn/include/dawn/system/handler.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include "dawn/common/generic_handler.hxx"
9#include "dawn/system/common.hxx"
10#include "dawn/system/factory.hxx"
11
12namespace dawn
13{
16class CSystemHandler : public CGenericHandler<CSystemCommon>
17{
18public:
20 : userFactory(nullptr)
21 {
22 }
23
24 int init(CDescriptor &desc, ISystemFactory *f);
25
26 int initAll() override
27 {
29 if (ret != OK)
30 {
31 return ret;
32 }
33
35 }
36
37 int deinitAll() override
38 {
40 }
41
42 int startAll() override
43 {
45 }
46
47 int stopAll() override
48 {
50 }
51
52 bool hasThread() const override
53 {
55 }
56
57 bool isObjectValid(SObjectId::UObjectId &obj) const override
58 {
59 return SObjectId::objectIsSystem(obj);
60 }
61
63 {
65 uid.v = id;
67 }
68
69 CSystemCommon *getSystem(SObjectId::UObjectId &id) const
70 {
72 }
73
74protected:
75 const char *getObjectTypeName() const override
76 {
77 return "SYSTEM";
78 }
79
80private:
81 CSystemFactory factory;
82 ISystemFactory *userFactory;
83
84 static void objallocPriv(CHandler &obj, CDescObject &desc);
85 int objalloc(CDescriptor &desc);
86 CSystemCommon *create(CDescObject &desc);
87};
88} // Namespace dawn
Descriptor wrapper for individual object configuration.
Binary device descriptor manager.
Template handler for object lifecycle management.
int initAll()
Run one-time init() for all configured objects.
bool hasThread() const
Check if any thread is currently running.
int stopAll()
Stop all objects managed by this handler.
int deinitAll()
De-initialize all objects managed by this handler.
T * getObjectById(const SObjectId::UObjectId &id) const
Get object by ObjectID.
int configureAll()
Configure all objects managed by this handler.
int startAll()
Start all objects managed by this handler.
Base implementation of IHandler interface.
Definition handler.hxx:110
Base class for all Dawn objects (IOs, Programs, Protocols).
Definition object.hxx:28
Base class for OBJTYPE_ANY configuration objects.
Definition common.hxx:25
Built-in dev object factory.
Definition factory.hxx:25
Handler for SYSTEM objects (OBJTYPE_ANY, cls != 0).
Definition handler.hxx:17
bool isObjectValid(SObjectId::UObjectId &obj) const
Validate if object ID is valid for this handler.
Definition handler.hxx:57
int startAll()
Start all objects managed by this handler.
Definition handler.hxx:42
bool hasThread() const
Check if any thread is currently running.
Definition handler.hxx:52
int deinitAll()
De-initialize all objects managed by this handler.
Definition handler.hxx:37
int stopAll()
Stop all objects managed by this handler.
Definition handler.hxx:47
CObject * getObject(const SObjectId::ObjectId id)
Get object from this handler by ID.
Definition handler.hxx:62
int initAll()
Run one-time init() for all configured objects.
Definition handler.hxx:26
const char * getObjectTypeName() const
Get object type name for logging.
Definition handler.hxx:75
Interface for user-provided dev object factories.
Definition factory.hxx:16
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
static bool objectIsSystem(const UObjectId &objid)
Check if object is a System object (raw 32-bit version).
Definition objectid.hxx:402
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
32-bit encoded object identifier (union with bit field).
Definition objectid.hxx:218
ObjectId v
Raw 32-bit ObjectID value (for comparison, hashing, storage).
Definition objectid.hxx:221