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 
70 #ifdef MBED_CLOUD_CLIENT_DISABLE_REGISTRY
72 #endif
74 
78 typedef struct registry_callback_token_s {
79  uint8_t token[8];
80  unsigned token_size:4;
82 
87 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
88  uint8_t pmin:1;
89  uint8_t pmax:1;
90  uint8_t gt:1;
91  uint8_t lt:1;
92  uint8_t st:1;
93  uint8_t time:1;
94  uint8_t previous_value:1;
95 #endif
96  uint8_t content_type:1;
97 
99 
100 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
101 
105 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
106  float float_value;
107 #endif
108  int64_t int_value;
110 
111 #else
113 #endif //MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
114 
115 
119 typedef struct registry_data_opaque_s {
120  uint32_t size;
121  uint8_t data[];
123 
127 typedef union registry_data_generic_u {
129  const char *string;
131 
135 typedef struct registry_generic_value_s {
136  uint8_t free_data;
139 
143 typedef union registry_object_value_u {
144 
145  int64_t int_value;
146 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
147  float float_value;
148 #endif
150  void *list;
151  uint8_t empty_value;
152 
154 
160 typedef struct registry_path_s {
161 
162  uint16_t object_id;
164  uint16_t resource_id;
166 
167  // this needs only 2 bits, but a bitfield wastes 300 bytes of ROM while saving nothing in RAM
168  uint8_t path_type;
169 
171 
175 typedef enum registry_status_e {
176 
183 
185 
192 
196 
198 
203 typedef enum listing_type_e {
204 
210 
212 
220 typedef struct registry_listing_s {
221 
232  uint8_t listing_type;
233  uint8_t value_set;
234  uint8_t parameters_set;
235  uint8_t registered;
236  uint8_t set_registered;
237 
238  struct registry_object_s *object;
239  struct registry_object_s *object_instance;
240  struct registry_object_s *resource;
241  struct registry_object_s *resource_instance;
242 
244 
245 #ifdef __cplusplus
246 }
247 #endif
248 
249 #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:151
struct registry_object_s * object_instance
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:239
Request events from value changes.
Definition: lwm2m_types.h:193
Normal remove operation.
Definition: lwm2m_types.h:52
int64_t int_value
Used for accessing integer values.
Definition: lwm2m_types.h:145
uint8_t parameters_set
This bit is set as 1 if observation parameters are available for the current Resource.
Definition: lwm2m_types.h:234
List everything stored to registry.
Definition: lwm2m_types.h:206
float float_value
Float value of the resource.
Definition: lwm2m_types.h:106
registry_status_e
Possible status codes for registry functions.
Definition: lwm2m_types.h:175
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:195
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:177
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:128
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:119
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:129
All resource values are stored through this common name.
Definition: lwm2m_types.h:143
Invalid input parameter or data.
Definition: lwm2m_types.h:181
Describes the path of an item in the LwM2M Object registry.
Definition: lwm2m_types.h:160
struct registry_object_s * object
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:238
Failed due to not being registered.
Definition: lwm2m_types.h:71
Request events from Object creation removal.
Definition: lwm2m_types.h:194
registry_path_t path
Definition: lwm2m_types.h:228
registry_data_generic_t data
Union for storing the pointer to the actual data.
Definition: lwm2m_types.h:137
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:147
This data structure is used when searching or otherwise iterating the LwM2M Object hierarchy in the r...
Definition: lwm2m_types.h:220
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:136
uint16_t resource_id
Resource ID, for example value 1 in all applicable IDs translates to /1/1/1.
Definition: lwm2m_types.h:164
All non-primitive data in registry item values is stored through this structure.
Definition: lwm2m_types.h:135
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:236
registry_event_listen_mode_e
These values are used for indicating what kind of events are listened from the registry.
Definition: lwm2m_types.h:191
Structure for marking the observation parameters available inside the associated structure.
Definition: lwm2m_types.h:86
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:150
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:78
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:207
uint16_t object_id
Object ID, for example value 1 translates to /1.
Definition: lwm2m_types.h:162
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:120
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:233
struct registry_object_s * resource_instance
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:241
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:165
uint8_t listing_type
Definition: lwm2m_types.h:232
Value change.
Definition: lwm2m_types.h:37
Union for carrying previous integer or floating point value of the observed Resource.
Definition: lwm2m_types.h:104
uint8_t token[8]
Token data.
Definition: lwm2m_types.h:79
listing_type_e
Used for selecting the listing type before calling the listing function, and for internal state infor...
Definition: lwm2m_types.h:203
unsigned token_size
Length of the token data.
Definition: lwm2m_types.h:80
List everything located under the given path.
Definition: lwm2m_types.h:208
uint8_t path_type
This field describes which other fields are valid inside this structure.
Definition: lwm2m_types.h:168
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:235
int64_t int_value
Integer value of the resource.
Definition: lwm2m_types.h:108
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:209
Common name for storing either opaque or string data of Resources.
Definition: lwm2m_types.h:127
No errors.
Definition: lwm2m_types.h:178
Notification status has changed.
Definition: lwm2m_types.h:41
Resource already created.
Definition: lwm2m_types.h:182
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:179
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:149
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:163
Registry Object, Resource or Instance was removed.
Definition: lwm2m_types.h:42
Internal state, Must not be set by user.
Definition: lwm2m_types.h:205
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:112
struct registry_object_s * resource
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:240
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:180