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 
42 #ifdef MBED_CONF_MBED_CLIENT_ENABLE_CPP_API
46 #endif // MBED_CONF_MBED_CLIENT_ENABLE_CPP_API
48 
49 
58 
73 
77 typedef struct registry_callback_token_s {
78  uint8_t token[8];
79  unsigned token_size:4;
81 
86 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
87  uint8_t pmin:1;
88  uint8_t pmax:1;
89  uint8_t gt:1;
90  uint8_t lt:1;
91  uint8_t st:1;
92  uint8_t time:1;
93  uint8_t previous_value:1;
94 #endif
95  uint8_t content_type:1;
96 
98 
99 #if MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
100 
104 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
105  float float_value;
106 #endif
107  int64_t int_value;
109 
110 #else
112 #endif //MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS
113 
114 
118 typedef struct registry_data_opaque_s {
119  uint32_t size;
120  uint8_t data[];
122 
126 typedef union registry_data_generic_u {
128  const char *string;
130 
134 typedef struct registry_generic_value_s {
135  uint8_t free_data;
138 
142 typedef union registry_object_value_u {
143 
144  int64_t int_value;
145 #if MBED_CLIENT_ENABLE_FLOAT_VALUE
146  float float_value;
147 #endif
149  void *list;
150  uint8_t empty_value;
151 
153 
159 typedef struct registry_path_s {
160 
161  uint16_t object_id;
163  uint16_t resource_id;
165  unsigned path_type:2;
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  unsigned listing_type:4;
230  unsigned value_set:1;
231  unsigned parameters_set:1;
232  unsigned registered:1;
233  unsigned set_registered:1;
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:64
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:150
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:54
int64_t int_value
Used for accessing integer values.
Definition: lwm2m_types.h:144
List everything stored to registry.
Definition: lwm2m_types.h:203
float float_value
Float value of the resource.
Definition: lwm2m_types.h:105
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:71
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:68
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:127
Do not call removal callback function.
Definition: lwm2m_types.h:56
Ignored status.
Definition: lwm2m_types.h:63
Structure for keeping opaque data in a registry item.
Definition: lwm2m_types.h:118
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:128
All resource values are stored through this common name.
Definition: lwm2m_types.h:142
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:159
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:136
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:55
float float_value
Used for accessing float value.
Definition: lwm2m_types.h:146
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:135
uint16_t resource_id
Resource ID, for example value 1 in all applicable IDs translates to /1/1/1.
Definition: lwm2m_types.h:163
All non-primitive data in registry item values is stored through this structure.
Definition: lwm2m_types.h:134
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:85
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:53
void * list
For internal use only, MUST NOT be accessed from application.
Definition: lwm2m_types.h:149
registry_callback_type_e
Type of the resource callback call.
Definition: lwm2m_types.h:35
Message sending failed (retransmission completed).
Definition: lwm2m_types.h:69
Client Lite internal callbacks always associate with a token to enable multiple ongoing callbacks...
Definition: lwm2m_types.h:77
CoAP message building fails.
Definition: lwm2m_types.h:65
Registry Object, Resource or Instance was removed, but will be added again.
Definition: lwm2m_types.h:44
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:161
Server has started the observation.
Definition: lwm2m_types.h:70
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:119
Registry Object, Resource or Instance was added.
Definition: lwm2m_types.h:45
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:164
Value change.
Definition: lwm2m_types.h:37
Union for carrying previous integer or floating point value of the observed Resource.
Definition: lwm2m_types.h:103
uint8_t token[8]
Token data.
Definition: lwm2m_types.h:78
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:79
List everything located under the given path.
Definition: lwm2m_types.h:205
struct registry_available_parameters_s registry_available_parameters_t
Structure for marking the observation parameters available inside the associated structure.
int64_t int_value
Integer value of the resource.
Definition: lwm2m_types.h:107
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:126
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:62
CoAP resend queue full.
Definition: lwm2m_types.h:66
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:148
Notification sent to the server but ACK not yet received.
Definition: lwm2m_types.h:67
uint16_t object_instance_id
Object Instance ID, for example value 1 in all applicable IDs translates to /1/1. ...
Definition: lwm2m_types.h:162
Registry Object, Resource or Instance was removed.
Definition: lwm2m_types.h:43
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:111
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