Friendly LWM2M client
Lwm2mServer.h
Go to the documentation of this file.
1 /*
2  * Lwm2mServer
3  * Generated on: 2023-11-02 16:41:01
4  * Created by: Sinai RnD
5  */
6 
7 #ifndef WPP_M_1_LWM2M_SERVER_H
8 #define WPP_M_1_LWM2M_SERVER_H
9 
10 #include "Lwm2mServerConfig.h"
11 #include "Lwm2mServerInfo.h"
12 #include "Instance.h"
13 #include "InstSubject.h"
14 
15 /* --------------- Сode_h block 0 start --------------- */
16 #include "WppTaskQueue.h"
17 #include "WppBindings.h"
18 /* --------------- Сode_h block 0 end --------------- */
19 
20 namespace wpp {
21 
22 class WppClient;
23 class Object;
24 
25 /* --------------- Сode_h block 1 start --------------- */
26 /* --------------- Сode_h block 1 end --------------- */
27 
28 class Lwm2mServer : public Instance {
29 public:
30  enum ID: ID_T {
33  #if RES_1_2
34  DEFAULT_MINIMUM_PERIOD_2 = 2,
35  #endif
36  #if RES_1_3
37  DEFAULT_MAXIMUM_PERIOD_3 = 3,
38  #endif
39  #if RES_1_4
40  DISABLE_4 = 4,
41  #endif
42  #if RES_1_5
44  #endif
46  BINDING_7 = 7,
48  #if RES_1_9
50  #endif
51  #if RES_1_10
52  APN_LINK_10 = 10,
53  #endif
54  #if RES_1_11
55  TLS_DTLS_ALERT_CODE_11 = 11,
56  #endif
57  #if RES_1_12
58  LAST_BOOTSTRAPPED_12 = 12,
59  #endif
60  #if RES_1_13
61  REGISTRATION_PRIORITY_ORDER_13 = 13,
62  #endif
63  #if RES_1_14
64  INITIAL_REGISTRATION_DELAY_TIMER_14 = 14,
65  #endif
66  #if RES_1_15
67  REGISTRATION_FAILURE_BLOCK_15 = 15,
68  #endif
69  #if RES_1_16
70  BOOTSTRAP_ON_REGISTRATION_FAILURE_16 = 16,
71  #endif
72  #if RES_1_17
73  COMMUNICATION_RETRY_COUNT_17 = 17,
74  #endif
75  #if RES_1_18
76  COMMUNICATION_RETRY_TIMER_18 = 18,
77  #endif
78  #if RES_1_19
79  COMMUNICATION_SEQUENCE_DELAY_TIMER_19 = 19,
80  #endif
81  #if RES_1_20
82  COMMUNICATION_SEQUENCE_RETRY_COUNT_20 = 20,
83  #endif
84  #if RES_1_21
85  TRIGGER_21 = 21,
86  #endif
87  #if RES_1_22
88  PREFERRED_TRANSPORT_22 = 22,
89  #endif
90  #if RES_1_23
92  #endif
93  };
94 
95  /* --------------- Code_h block 2 start --------------- */
96  /* --------------- Code_h block 2 end --------------- */
97 
98 public:
99  Lwm2mServer(lwm2m_context_t &context, const OBJ_LINK_T &id);
100  ~Lwm2mServer();
101 
102  /* --------------- Helpful methods --------------- */
108  static Object & object(WppClient &ctx);
109 
116  static Lwm2mServer * instance(WppClient &ctx, ID_T instId = ID_T_MAX_VAL);
117 
124  static Lwm2mServer * createInst(WppClient &ctx, ID_T instId = ID_T_MAX_VAL);
125 
132  static bool removeInst(WppClient &ctx, ID_T instId);
133 
134  /* --------------- Code_h block 3 start --------------- */
135  /* --------------- Code_h block 3 end --------------- */
136 
137 protected:
138  /* --------------- Instance implementation part --------------- */
139  /*
140  * Handles information about resource operation that made server
141  */
142  void serverOperationNotifier(Instance *securityInst, ItemOp::TYPE type, const ResLink &resLink) override;
143  /*
144  * Handles information about resource operation that made user
145  */
146  void userOperationNotifier(ItemOp::TYPE type, const ResLink &resLink) override;
147 
148  /* --------------- Code_h block 4 start --------------- */
149  /* --------------- Code_h block 4 end --------------- */
150 
151 private:
152  /* --------------- Class private methods --------------- */
153  /*
154  * Creates resources without initializing.
155  */
156  void resourcesCreate();
157  /*
158  * Initialize resources with default values
159  * SINGLE resource always must have at least one instance.
160  */
161  void resourcesInit();
162 
163  /* --------------- Code_h block 5 start --------------- */
164  /* --------------- Code_h block 5 end --------------- */
165 
166 private:
167  /* --------------- Class private properties --------------- */
168  /* --------------- Code_h block 6 start --------------- */
169  WppTaskQueue::task_id_t _requestBootstrapTaskId;
170  WppTaskQueue::task_id_t _requestDeregistrationTaskId;
171  /* --------------- Code_h block 6 end --------------- */
172 };
173 
174 } /* namespace wpp */
175 
176 #endif /* WPP_M_1_LWM2M_SERVER_H */
#define ID_T_MAX_VAL
Definition: WppTypes.h:16
Instance is interface class that implements manipulation with derived class resources....
Definition: Instance.h:40
static bool removeInst(WppClient &ctx, ID_T instId)
Removes an instance of the object.
Definition: Lwm2mServer.cpp:64
void serverOperationNotifier(Instance *securityInst, ItemOp::TYPE type, const ResLink &resLink) override
This method must be implemented by the derived class, and handle information about resource operation...
Definition: Lwm2mServer.cpp:68
Lwm2mServer(lwm2m_context_t &context, const OBJ_LINK_T &id)
Definition: Lwm2mServer.cpp:26
void userOperationNotifier(ItemOp::TYPE type, const ResLink &resLink) override
This method must be implemented by the derived class, and handle information about resource operation...
Definition: Lwm2mServer.cpp:82
static Object & object(WppClient &ctx)
Gets the Object reference.
Definition: Lwm2mServer.cpp:48
static Lwm2mServer * instance(WppClient &ctx, ID_T instId=ID_T_MAX_VAL)
Gets an instance of the object.
Definition: Lwm2mServer.cpp:52
@ NOTIFICATION_STORING_WHEN_DISABLED_OR_OFFLINE_6
Definition: Lwm2mServer.h:45
@ REGISTRATION_UPDATE_TRIGGER_8
Definition: Lwm2mServer.h:47
@ BOOTSTRAP_REQUEST_TRIGGER_9
Definition: Lwm2mServer.h:49
static Lwm2mServer * createInst(WppClient &ctx, ID_T instId=ID_T_MAX_VAL)
Creates an instance of the object.
Definition: Lwm2mServer.cpp:58
The Object class implements manipulation with Instance interface class and its inheritors.
Definition: Object.h:32
Represents a client interface for Wpp library.
Definition: WppClient.h:37
uint32_t task_id_t
Definition: WppTaskQueue.h:52
The WppConnection class represents a connection interface for the Wpp library.
Definition: WppClient.cpp:14
uint16_t ID_T
Definition: WppTypes.h:15
TYPE
Enum representing the different types of operations.
Definition: ItemOp.h:29