Friendly LWM2M client
WppRegistry.h
Go to the documentation of this file.
1 /*
2  * Regestry.h
3  *
4  * Created on: 18 Jul 2023
5  * Author: valentin
6  */
7 
8 #ifndef WPP_REGISTRY_H_
9 #define WPP_REGISTRY_H_
10 
11 #include <vector>
12 #include "ObjectImpl.h"
13 
14 /* ---------- Mandatory objects include block begin ---------- */
15 #ifdef OBJ_M_3_DEVICE
16 #include "m_3_device/Device.h"
17 #endif
18 #ifdef OBJ_M_1_LWM2M_SERVER
20 #endif
21 #ifdef OBJ_M_0_LWM2M_SECURITY
23 #endif
24 /* ---------- Mandatory objects include block end ---------- */
25 
26 /* ---------- Optional objects include block begin ---------- */
27 #ifdef OBJ_O_4_CONNECTIVITY_MONITORING
29 #endif
30 #ifdef OBJ_O_2_LWM2M_ACCESS_CONTROL
32 #endif
33 #ifdef OBJ_O_3339_AUDIO_CLIP
35 #endif
36 #ifdef OBJ_O_5_FIRMWARE_UPDATE
38 #endif
39 /* ---------- Optional objects include block end ---------- */
40 
41 namespace wpp {
42 
43 // TODO: Split mandatory and optional registers
53 class WppRegistry {
54 public:
55  explicit WppRegistry(lwm2m_context_t &context);
56  ~WppRegistry();
57 
58  WppRegistry(const WppRegistry&) = delete;
59  WppRegistry(WppRegistry&&) = delete;
60  WppRegistry& operator=(const WppRegistry&) = delete;
62 
69  bool registerObj(Object &object);
70 
77  bool deregisterObj(Object &object);
78 
85  bool isObjRegistered(Object &object);
86 
93  bool isExist(OBJ_ID objId);
94 
101  Object * object(OBJ_ID objId);
102 
108  std::vector<Object *> & objects();
109 
110  /* ---------- Mandatory objects prototype block begin ---------- */
111  #ifdef OBJ_M_3_DEVICE
112  Object & device();
113  #endif
114  #ifdef OBJ_M_1_LWM2M_SERVER
115  Object & lwm2mServer();
116  #endif
117  #ifdef OBJ_M_0_LWM2M_SECURITY
118  Object & lwm2mSecurity();
119  #endif
120  /* ---------- Mandatory objects prototype block end ---------- */
121 
122  /* ---------- Optional objects prototype block begin ---------- */
123  #ifdef OBJ_O_4_CONNECTIVITY_MONITORING
125  #endif
126  #ifdef OBJ_O_2_LWM2M_ACCESS_CONTROL
128  #endif
129  #ifdef OBJ_O_3339_AUDIO_CLIP
130  Object & audioClip();
131  #endif
132  #ifdef OBJ_O_5_FIRMWARE_UPDATE
134  #endif
135  /* ---------- Optional objects prototype block end ---------- */
136 
137 private:
138  lwm2m_context_t &_context;
139  std::vector<Object *> _objects;
140 };
141 
142 } // namespace wpp
143 
144 #endif // WPP_REGISTRY_H_
The Object class implements manipulation with Instance interface class and its inheritors.
Definition: Object.h:32
The WppRegistry class represents a registry for managing LWM2M objects.
Definition: WppRegistry.h:53
WppRegistry(lwm2m_context_t &context)
Definition: WppRegistry.cpp:7
Object & firmwareUpdate()
Object & device()
Definition: WppRegistry.cpp:76
std::vector< Object * > & objects()
Gets all registered objects.
Definition: WppRegistry.cpp:70
WppRegistry(WppRegistry &&)=delete
bool isExist(OBJ_ID objId)
Checks if an Object with the given objId exists in the registry.
Definition: WppRegistry.cpp:60
Object & connectivityMonitoring()
Definition: WppRegistry.cpp:94
WppRegistry & operator=(WppRegistry &&)=delete
bool isObjRegistered(Object &object)
Checks if an Object is registered in the registry.
Definition: WppRegistry.cpp:55
Object & lwm2mSecurity()
Definition: WppRegistry.cpp:86
bool registerObj(Object &object)
Registers an Object in the registry.
Definition: WppRegistry.cpp:45
Object & lwm2mAccessControl()
Definition: WppRegistry.cpp:99
WppRegistry & operator=(const WppRegistry &)=delete
Object & lwm2mServer()
Definition: WppRegistry.cpp:81
Object * object(OBJ_ID objId)
Retrieves a pointer to the Object with the given objId.
Definition: WppRegistry.cpp:64
bool deregisterObj(Object &object)
Deregisters an Object from the registry.
Definition: WppRegistry.cpp:50
WppRegistry(const WppRegistry &)=delete
The WppConnection class represents a connection interface for the Wpp library.
Definition: WppClient.cpp:14
OBJ_ID
Enumeration of object IDs in the Wpp library.
Definition: ObjectID.h:14