Dawn Framework 1.0
Universal data acquisition framework for embedded systems
handler.hxx
1// dawn/include/dawn/proto/handler.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <vector>
9
10#include "dawn/common/descriptor.hxx"
11#include "dawn/common/generic_handler.hxx"
12#include "dawn/common/handler.hxx"
13#include "dawn/io/handler.hxx"
14#include "dawn/porting/config.hxx"
15#include "dawn/proto/common.hxx"
16#include "dawn/proto/factory.hxx"
17
18namespace dawn
19{
27class CProtoHandler : public CGenericHandler<CProtoCommon>
28{
29public:
37 : userFactory(nullptr)
38 , ioHandler(nullptr)
39 {
40 }
41
48 ~CProtoHandler() = default;
49
61 int init(CDescriptor &desc, CIOHandler *io, IProtoFactory *f);
62
72 int initAll() override;
73
82 int deinitAll() override
83 {
85 }
86
95 int startAll() override
96 {
98 }
99
108 int stopAll() override
109 {
111 }
112
119 bool hasThread() const override
120 {
122 }
123
133 bool isObjectValid(SObjectId::UObjectId &obj) const override;
134
144 CObject *getObject(const SObjectId::ObjectId id) override;
145
156
157protected:
164 const char *getObjectTypeName() const override
165 {
166 return "PROTO";
167 }
168
169private:
172 CProtoFactory factory;
173
176 IProtoFactory *userFactory;
177
180 CIOHandler *ioHandler;
181
191 static void objallocPriv(CHandler &obj, CDescObject &desc);
192
202 int objalloc(CDescriptor &desc);
203
214 CProtoCommon *create(CDescObject &desc);
215
226};
227} // Namespace dawn
Descriptor wrapper for individual object configuration.
Binary device descriptor manager.
Template handler for object lifecycle management.
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.
int startAll()
Start all objects managed by this handler.
Base implementation of IHandler interface.
Definition handler.hxx:110
Base class for all I/O objects.
Definition common.hxx:27
Manages I/O object lifecycle and dispatch.
Definition handler.hxx:37
Base class for all Dawn objects (IOs, Programs, Protocols).
Definition object.hxx:28
Base class for all protocol implementations.
Definition common.hxx:23
Built-in protocol factory.
Definition factory.hxx:37
Manages PROTO object lifecycle and dispatch.
Definition handler.hxx:28
int startAll()
Start all protocol objects.
Definition handler.hxx:95
int init(CDescriptor &desc, CIOHandler *io, IProtoFactory *f)
Initialize protocol handler and instances.
Definition handler.cxx:73
~CProtoHandler()=default
Destructor.
CProtoHandler()
Constructor.
Definition handler.hxx:36
int initAll()
Configure, bind, and initialize all protocol objects.
Definition handler.cxx:100
bool isObjectValid(SObjectId::UObjectId &obj) const
Validate protocol object ID.
Definition handler.cxx:130
CProtoCommon * getProto(SObjectId::UObjectId &id) const
Get protocol object interface.
Definition handler.cxx:142
const char * getObjectTypeName() const
Get object type name for logging.
Definition handler.hxx:164
bool hasThread() const
Check if any protocol is running.
Definition handler.hxx:119
CObject * getObject(const SObjectId::ObjectId id)
Get protocol object by ID.
Definition handler.cxx:135
int stopAll()
Stop all protocol objects.
Definition handler.hxx:108
int deinitAll()
Deinitialize all protocol objects.
Definition handler.hxx:82
Abstract factory interface for protocol creation.
Definition factory.hxx:17
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
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