Mistake on this page? Email us
lwm2m_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LWM2M_TYPES_H
18 #define LWM2M_TYPES_H
19 
20 #include "mbed-client/lwm2m_config.h"
21 #include <inttypes.h>
22 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
46 
47 
56 
71 
75 typedef struct registry_callback_token_s {
76  uint8_t token[8];
77  unsigned token_size:4;
79 
84 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
85  uint8_t pmin:1;
86  uint8_t pmax:1;
87  uint8_t gt:1;
88  uint8_t lt:1;
89  uint8_t st:1;
90  uint8_t time:1;
91  uint8_t previous_value:1;
92 #endif
93  uint8_t content_type:1;
94 
96 
97 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
98 
102 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
103  float float_value;
104 #endif
105  int64_t int_value;
107 
108 #else
110 #endif //MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
111 
112 
116 typedef struct registry_data_opaque_s {
117  uint32_t size;
118  uint8_t data[];
120 
124 typedef union registry_data_generic_u {
126  const char *string;
128 
132 typedef struct registry_generic_value_s {
133  uint8_t free_data;
136 
140 typedef union registry_object_value_u {
141 
142  int64_t int_value;
143 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
144  float float_value;
145 #endif
147  void *list;
148  uint8_t empty_value;
149 
151 
157 typedef struct registry_path_s {
158 
159  uint16_t object_id;
161  uint16_t resource_id;
163 
164  // this needs only 2 bits, but a bitfield wastes 300 bytes of ROM while saving nothing in RAM
165  uint8_t path_type;
166 
168 
172 typedef enum registry_status_e {
173 
180 
182 
189 
193 
195 
200 typedef enum listing_type_e {
201 
207 
209 
217 typedef struct registry_listing_s {
218 
229  uint8_t listing_type;
230  uint8_t value_set;
231  uint8_t parameters_set;
232  uint8_t registered;
233  uint8_t set_registered;
234 
235  struct registry_object_s *object;
236  struct registry_object_s *object_instance;
237  struct registry_object_s *resource;
238  struct registry_object_s *resource_instance;
239 
241 
242 #ifdef __cplusplus
243 }
244 #endif
245 
246 #endif //LWM2M_TYPES_H
enum registry_removal_type_e registry_removal_type_t
Resource remove mode.
Initial state.
Definition: lwm2m_types.h:62
uint8_t empty_value
If true, the object value has not been set. This is just for keeping the registry_getor registry_set ...
Definition: lwm2m_types.h:148
struct registry_object_s * object_instance
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:236
Request events from value changes.
Definition: lwm2m_types.h:190
Normal remove operation.
Definition: lwm2m_types.h:52
int64_t int_value
Used for accessing integer values.
Definition: lwm2m_types.h:142
uint8_t parameters_set
This bit is set as 1 if observation parameters are available for the current Resource.
Definition: lwm2m_types.h:231
List everything stored to registry.
Definition: lwm2m_types.h:203
float float_value
Float value of the resource.
Definition: lwm2m_types.h:103
registry_status_e
Possible status codes for registry functions.
Definition: lwm2m_types.h:172
Server has stopped the observation (RESET message or GET with observe 1).
Definition: lwm2m_types.h:69
Request all available events.
Definition: lwm2m_types.h:192
Callback type not set.
Definition: lwm2m_types.h:36
enum registry_status_e registry_status_t
Possible status codes for registry functions.
Received ACK from server.
Definition: lwm2m_types.h:66
There is no data to be read.
Definition: lwm2m_types.h:174
enum registry_callback_type_e registry_callback_type_t
Type of the resource callback call.
registry_data_opaque_t * opaque_data
Stores opaque data.
Definition: lwm2m_types.h:125
Do not call removal callback function.
Definition: lwm2m_types.h:54
Ignored status.
Definition: lwm2m_types.h:61
Structure for keeping opaque data in a registry item.
Definition: lwm2m_types.h:116
struct registry_path_s registry_path_t
Describes the path of an item in the LwM2M Object registry.
const char * string
Stores string data as a null-terminated string.
Definition: lwm2m_types.h:126
All resource values are stored through this common name.
Definition: lwm2m_types.h:140
Invalid input parameter or data.
Definition: lwm2m_types.h:178
Describes the path of an item in the LwM2M Object registry.
Definition: lwm2m_types.h:157
struct registry_object_s * object
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:235
Request events from Object creation removal.
Definition: lwm2m_types.h:191
registry_path_t path
Definition: lwm2m_types.h:225
registry_data_generic_t data
Union for storing the pointer to the actual data.
Definition: lwm2m_types.h:134
union registry_data_generic_u registry_data_generic_t
Common name for storing either opaque or string data of Resources.
enum listing_type_e listing_type_t
Used for selecting the listing type before calling the listing function, and for internal state infor...
enum registry_event_listen_mode_e registry_event_listen_mode_t
These values are used for indicating what kind of events are listened from the registry.
Resource is replaced with a new one.
Definition: lwm2m_types.h:53
float float_value
Used for accessing float value.
Definition: lwm2m_types.h:144
This data structure is used when searching or otherwise iterating the LwM2M Object hierarchy in the r...
Definition: lwm2m_types.h:217
Message block received for the Resource.
Definition: lwm2m_types.h:39
uint8_t free_data
If > 0, data will be freed automatically once removed.
Definition: lwm2m_types.h:133
uint16_t resource_id
Resource ID, for example value 1 in all applicable IDs translates to /1/1/1.
Definition: lwm2m_types.h:161
All non-primitive data in registry item values is stored through this structure.
Definition: lwm2m_types.h:132
uint8_t set_registered
This bit MUST be set as 0, unless the user wants to set the registered bit as 1.
Definition: lwm2m_types.h:233
registry_event_listen_mode_e
These values are used for indicating what kind of events are listened from the registry.
Definition: lwm2m_types.h:188
Structure for marking the observation parameters available inside the associated structure.
Definition: lwm2m_types.h:83
struct registry_callback_token_s registry_callback_token_t
Client Lite internal callbacks always associate with a token to enable multiple ongoing callbacks...
registry_removal_type_e
Resource remove mode.
Definition: lwm2m_types.h:51
void * list
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:147
registry_callback_type_e
Type of the resource callback call.
Definition: lwm2m_types.h:35
Message sending failed (retransmission completed).
Definition: lwm2m_types.h:67
Client Lite internal callbacks always associate with a token to enable multiple ongoing callbacks...
Definition: lwm2m_types.h:75
CoAP message building fails.
Definition: lwm2m_types.h:63
Registry Object, Resource or Instance was removed, but will be added again.
Definition: lwm2m_types.h:43
List one directory.
Definition: lwm2m_types.h:204
uint16_t object_id
Object ID, for example value 1 translates to /1.
Definition: lwm2m_types.h:159
Server has started the observation.
Definition: lwm2m_types.h:68
Execute received for the Resource.
Definition: lwm2m_types.h:38
struct registry_data_opaque_s registry_data_opaque_t
Structure for keeping opaque data in a registry item.
uint32_t size
Size of the data in bytes.
Definition: lwm2m_types.h:117
Registry Object, Resource or Instance was added.
Definition: lwm2m_types.h:44
uint8_t value_set
This bit is set as 1 if a value is available for the current Resource.
Definition: lwm2m_types.h:230
struct registry_object_s * resource_instance
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:238
enum registry_notification_status_e registry_notification_status_t
Notification status codes.
uint16_t resource_instance_id
Resource Instance ID, for example value 1 in all applicable IDs translates to /1/1/1/1.
Definition: lwm2m_types.h:162
uint8_t listing_type
Definition: lwm2m_types.h:229
Value change.
Definition: lwm2m_types.h:37
Union for carrying previous integer or floating point value of the observed Resource.
Definition: lwm2m_types.h:101
uint8_t token[8]
Token data.
Definition: lwm2m_types.h:76
listing_type_e
Used for selecting the listing type before calling the listing function, and for internal state infor...
Definition: lwm2m_types.h:200
unsigned token_size
Length of the token data.
Definition: lwm2m_types.h:77
List everything located under the given path.
Definition: lwm2m_types.h:205
uint8_t path_type
This field describes which other fields are valid inside this structure.
Definition: lwm2m_types.h:165
struct registry_available_parameters_s registry_available_parameters_t
Structure for marking the observation parameters available inside the associated structure.
uint8_t registered
This bit is set if the Resource has been registered.
Definition: lwm2m_types.h:232
int64_t int_value
Integer value of the resource.
Definition: lwm2m_types.h:105
union registry_object_value_u registry_object_value_t
All resource values are stored through this common name.
Internal state. Must not be set by user.
Definition: lwm2m_types.h:206
Common name for storing either opaque or string data of Resources.
Definition: lwm2m_types.h:124
No errors.
Definition: lwm2m_types.h:175
Notification status has changed.
Definition: lwm2m_types.h:41
Resource already created.
Definition: lwm2m_types.h:179
registry_notification_status_e
Notification status codes.
Definition: lwm2m_types.h:60
CoAP resend queue full.
Definition: lwm2m_types.h:64
Resource not found.
Definition: lwm2m_types.h:176
Message block is being sent.
Definition: lwm2m_types.h:40
struct registry_generic_value_s registry_generic_value_t
All non-primitive data in registry item values is stored through this structure.
registry_generic_value_t generic_value
Used for accessing string and opaque values.
Definition: lwm2m_types.h:146
Notification sent to the server but ACK not yet received.
Definition: lwm2m_types.h:65
uint16_t object_instance_id
Object Instance ID, for example value 1 in all applicable IDs translates to /1/1. ...
Definition: lwm2m_types.h:160
Registry Object, Resource or Instance was removed.
Definition: lwm2m_types.h:42
Internal state, Must not be set by user.
Definition: lwm2m_types.h:202
union registry_observation_value_u registry_observation_value_t
Union for carrying previous integer or floating point value of the observed Resource.
Definition: lwm2m_types.h:109
struct registry_object_s * resource
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:237
struct registry_listing_s registry_listing_t
This data structure is used when searching or otherwise iterating the LwM2M Object hierarchy in the r...
Out of memory.
Definition: lwm2m_types.h:177