terence zhang / Mbed OS mbed-os-example-wakaama

Dependencies:   C12832 LM75B

Committer:
terencez
Date:
Mon Apr 24 23:03:31 2017 +0000
Revision:
0:f9d13e09cf11
Child:
3:a280069151ac
The first compiled submit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
terencez 0:f9d13e09cf11 1 /*******************************************************************************
terencez 0:f9d13e09cf11 2 *
terencez 0:f9d13e09cf11 3 * Copyright (c) 2013, 2014 Intel Corporation and others.
terencez 0:f9d13e09cf11 4 * All rights reserved. This program and the accompanying materials
terencez 0:f9d13e09cf11 5 * are made available under the terms of the Eclipse Public License v1.0
terencez 0:f9d13e09cf11 6 * and Eclipse Distribution License v1.0 which accompany this distribution.
terencez 0:f9d13e09cf11 7 *
terencez 0:f9d13e09cf11 8 * The Eclipse Public License is available at
terencez 0:f9d13e09cf11 9 * http://www.eclipse.org/legal/epl-v10.html
terencez 0:f9d13e09cf11 10 * The Eclipse Distribution License is available at
terencez 0:f9d13e09cf11 11 * http://www.eclipse.org/org/documents/edl-v10.php.
terencez 0:f9d13e09cf11 12 *
terencez 0:f9d13e09cf11 13 * Contributors:
terencez 0:f9d13e09cf11 14 * David Navarro, Intel Corporation - initial API and implementation
terencez 0:f9d13e09cf11 15 * Fabien Fleutot - Please refer to git log
terencez 0:f9d13e09cf11 16 * Simon Bernard - Please refer to git log
terencez 0:f9d13e09cf11 17 * Toby Jaffey - Please refer to git log
terencez 0:f9d13e09cf11 18 * Julien Vermillard - Please refer to git log
terencez 0:f9d13e09cf11 19 *******************************************************************************/
terencez 0:f9d13e09cf11 20
terencez 0:f9d13e09cf11 21 /*
terencez 0:f9d13e09cf11 22 Copyright (c) 2013, 2014 Intel Corporation
terencez 0:f9d13e09cf11 23
terencez 0:f9d13e09cf11 24 Redistribution and use in source and binary forms, with or without modification,
terencez 0:f9d13e09cf11 25 are permitted provided that the following conditions are met:
terencez 0:f9d13e09cf11 26
terencez 0:f9d13e09cf11 27 * Redistributions of source code must retain the above copyright notice,
terencez 0:f9d13e09cf11 28 this list of conditions and the following disclaimer.
terencez 0:f9d13e09cf11 29 * Redistributions in binary form must reproduce the above copyright notice,
terencez 0:f9d13e09cf11 30 this list of conditions and the following disclaimer in the documentation
terencez 0:f9d13e09cf11 31 and/or other materials provided with the distribution.
terencez 0:f9d13e09cf11 32 * Neither the name of Intel Corporation nor the names of its contributors
terencez 0:f9d13e09cf11 33 may be used to endorse or promote products derived from this software
terencez 0:f9d13e09cf11 34 without specific prior written permission.
terencez 0:f9d13e09cf11 35
terencez 0:f9d13e09cf11 36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
terencez 0:f9d13e09cf11 37 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
terencez 0:f9d13e09cf11 38 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
terencez 0:f9d13e09cf11 39 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
terencez 0:f9d13e09cf11 40 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
terencez 0:f9d13e09cf11 41 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
terencez 0:f9d13e09cf11 42 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
terencez 0:f9d13e09cf11 43 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
terencez 0:f9d13e09cf11 44 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
terencez 0:f9d13e09cf11 45 THE POSSIBILITY OF SUCH DAMAGE.
terencez 0:f9d13e09cf11 46
terencez 0:f9d13e09cf11 47 David Navarro <david.navarro@intel.com>
terencez 0:f9d13e09cf11 48
terencez 0:f9d13e09cf11 49 */
terencez 0:f9d13e09cf11 50
terencez 0:f9d13e09cf11 51 #ifndef _LWM2M_CLIENT_H_
terencez 0:f9d13e09cf11 52 #define _LWM2M_CLIENT_H_
terencez 0:f9d13e09cf11 53
terencez 0:f9d13e09cf11 54 #include <stdint.h>
terencez 0:f9d13e09cf11 55 #include <stddef.h>
terencez 0:f9d13e09cf11 56 #include <stdbool.h>
terencez 0:f9d13e09cf11 57
terencez 0:f9d13e09cf11 58 #include <stdlib.h>
terencez 0:f9d13e09cf11 59 #include <string.h>
terencez 0:f9d13e09cf11 60 #include <time.h>
terencez 0:f9d13e09cf11 61 //#include <sys/time.h>
terencez 0:f9d13e09cf11 62 //#include <EthernetInterface/lwip/include/lwip/sockets.h>
terencez 0:f9d13e09cf11 63
terencez 0:f9d13e09cf11 64 //////////////////////////////////////////////////
terencez 0:f9d13e09cf11 65 #define MBED_OS_EXAMPLE_WAKAAMA
terencez 0:f9d13e09cf11 66
terencez 0:f9d13e09cf11 67 #ifdef MBED_OS_EXAMPLE_WAKAAMA
terencez 0:f9d13e09cf11 68 // Global definitions
terencez 0:f9d13e09cf11 69 #define LWM2M_LITTLE_ENDIAN
terencez 0:f9d13e09cf11 70 #define LWM2M_CLIENT_MODE
terencez 0:f9d13e09cf11 71 #define LWM2M_WITH_LOGS
terencez 0:f9d13e09cf11 72 #define SHARED_DEFINITIONS
terencez 0:f9d13e09cf11 73 #define WAKAAMA_DEFINITIONS
terencez 0:f9d13e09cf11 74 #endif
terencez 0:f9d13e09cf11 75
terencez 0:f9d13e09cf11 76 #ifndef LWM2M_EMBEDDED_MODE
terencez 0:f9d13e09cf11 77 /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
terencez 0:f9d13e09cf11 78 * by your system, set this to 0 and include <sys/time.h> in cc.h */
terencez 0:f9d13e09cf11 79
terencez 0:f9d13e09cf11 80 struct timeval {
terencez 0:f9d13e09cf11 81 long tv_sec; /* seconds */
terencez 0:f9d13e09cf11 82 long tv_usec; /* and microseconds */
terencez 0:f9d13e09cf11 83 };
terencez 0:f9d13e09cf11 84 struct timezone{
terencez 0:f9d13e09cf11 85
terencez 0:f9d13e09cf11 86 int tz_minuteswest; /*minutes to greenwich time*/
terencez 0:f9d13e09cf11 87 int tz_dsttime; /*type of DST correction*/
terencez 0:f9d13e09cf11 88 };
terencez 0:f9d13e09cf11 89
terencez 0:f9d13e09cf11 90
terencez 0:f9d13e09cf11 91 int gettimeofday(struct timeval* t, void* timezone);
terencez 0:f9d13e09cf11 92
terencez 0:f9d13e09cf11 93 #define lwm2m_gettimeofday gettimeofday
terencez 0:f9d13e09cf11 94 #define lwm2m_malloc malloc
terencez 0:f9d13e09cf11 95 #define lwm2m_free free
terencez 0:f9d13e09cf11 96 #else
terencez 0:f9d13e09cf11 97 int lwm2m_gettimeofday(struct timeval *tv, void *p);
terencez 0:f9d13e09cf11 98 void *lwm2m_malloc(size_t s);
terencez 0:f9d13e09cf11 99 void lwm2m_free(void *p);
terencez 0:f9d13e09cf11 100 #endif
terencez 0:f9d13e09cf11 101
terencez 0:f9d13e09cf11 102 /*
terencez 0:f9d13e09cf11 103 * Error code
terencez 0:f9d13e09cf11 104 */
terencez 0:f9d13e09cf11 105 #if 0 //To be sync with enum.
terencez 0:f9d13e09cf11 106 typedef enum {
terencez 0:f9d13e09cf11 107 NO_ERROR = 0,
terencez 0:f9d13e09cf11 108
terencez 0:f9d13e09cf11 109 CREATED_2_01 = 65, /* CREATED */
terencez 0:f9d13e09cf11 110 DELETED_2_02 = 66, /* DELETED */
terencez 0:f9d13e09cf11 111 VALID_2_03 = 67, /* NOT_MODIFIED */
terencez 0:f9d13e09cf11 112 CHANGED_2_04 = 68, /* CHANGED */
terencez 0:f9d13e09cf11 113 CONTENT_2_05 = 69, /* OK */
terencez 0:f9d13e09cf11 114
terencez 0:f9d13e09cf11 115 BAD_REQUEST_4_00 = 128, /* BAD_REQUEST */
terencez 0:f9d13e09cf11 116 UNAUTHORIZED_4_01 = 129, /* UNAUTHORIZED */
terencez 0:f9d13e09cf11 117 BAD_OPTION_4_02 = 130, /* BAD_OPTION */
terencez 0:f9d13e09cf11 118 FORBIDDEN_4_03 = 131, /* FORBIDDEN */
terencez 0:f9d13e09cf11 119 NOT_FOUND_4_04 = 132, /* NOT_FOUND */
terencez 0:f9d13e09cf11 120 METHOD_NOT_ALLOWED_4_05 = 133, /* METHOD_NOT_ALLOWED */
terencez 0:f9d13e09cf11 121 NOT_ACCEPTABLE_4_06 = 134, /* NOT_ACCEPTABLE */
terencez 0:f9d13e09cf11 122 PRECONDITION_FAILED_4_12 = 140, /* BAD_REQUEST */
terencez 0:f9d13e09cf11 123 REQUEST_ENTITY_TOO_LARGE_4_13 = 141, /* REQUEST_ENTITY_TOO_LARGE */
terencez 0:f9d13e09cf11 124 UNSUPPORTED_MEDIA_TYPE_4_15 = 143, /* UNSUPPORTED_MEDIA_TYPE */
terencez 0:f9d13e09cf11 125
terencez 0:f9d13e09cf11 126 INTERNAL_SERVER_ERROR_5_00 = 160, /* INTERNAL_SERVER_ERROR */
terencez 0:f9d13e09cf11 127 NOT_IMPLEMENTED_5_01 = 161, /* NOT_IMPLEMENTED */
terencez 0:f9d13e09cf11 128 BAD_GATEWAY_5_02 = 162, /* BAD_GATEWAY */
terencez 0:f9d13e09cf11 129 SERVICE_UNAVAILABLE_5_03 = 163, /* SERVICE_UNAVAILABLE */
terencez 0:f9d13e09cf11 130 GATEWAY_TIMEOUT_5_04 = 164, /* GATEWAY_TIMEOUT */
terencez 0:f9d13e09cf11 131 PROXYING_NOT_SUPPORTED_5_05 = 165, /* PROXYING_NOT_SUPPORTED */
terencez 0:f9d13e09cf11 132
terencez 0:f9d13e09cf11 133 /* Erbium errors */
terencez 0:f9d13e09cf11 134 MEMORY_ALLOCATION_ERROR = 192,
terencez 0:f9d13e09cf11 135 PACKET_SERIALIZATION_ERROR,
terencez 0:f9d13e09cf11 136
terencez 0:f9d13e09cf11 137 /* Erbium hooks */
terencez 0:f9d13e09cf11 138 MANUAL_RESPONSE
terencez 0:f9d13e09cf11 139
terencez 0:f9d13e09cf11 140
terencez 0:f9d13e09cf11 141 #endif
terencez 0:f9d13e09cf11 142
terencez 0:f9d13e09cf11 143
terencez 0:f9d13e09cf11 144
terencez 0:f9d13e09cf11 145 #define COAP_NO_ERROR (uint8_t)0x00
terencez 0:f9d13e09cf11 146
terencez 0:f9d13e09cf11 147 #define COAP_201_CREATED (uint8_t)0x41
terencez 0:f9d13e09cf11 148 #define COAP_202_DELETED (uint8_t)0x42
terencez 0:f9d13e09cf11 149 #define COAP_204_CHANGED (uint8_t)0x44
terencez 0:f9d13e09cf11 150 #define COAP_205_CONTENT (uint8_t)0x45
terencez 0:f9d13e09cf11 151 #define COAP_400_BAD_REQUEST (uint8_t)0x80
terencez 0:f9d13e09cf11 152 #define COAP_401_UNAUTHORIZED (uint8_t)0x81
terencez 0:f9d13e09cf11 153 #define COAP_404_NOT_FOUND (uint8_t)0x84
terencez 0:f9d13e09cf11 154 #define COAP_405_METHOD_NOT_ALLOWED (uint8_t)0x85
terencez 0:f9d13e09cf11 155 #define COAP_406_NOT_ACCEPTABLE (uint8_t)0x86
terencez 0:f9d13e09cf11 156 #define COAP_500_INTERNAL_SERVER_ERROR (uint8_t)0xA0
terencez 0:f9d13e09cf11 157 #define COAP_501_NOT_IMPLEMENTED (uint8_t)0xA1
terencez 0:f9d13e09cf11 158 #define COAP_503_SERVICE_UNAVAILABLE (uint8_t)0xA3
terencez 0:f9d13e09cf11 159
terencez 0:f9d13e09cf11 160
terencez 0:f9d13e09cf11 161 /*
terencez 0:f9d13e09cf11 162 * Utility functions for sorted linked list
terencez 0:f9d13e09cf11 163 */
terencez 0:f9d13e09cf11 164
terencez 0:f9d13e09cf11 165 typedef struct _lwm2m_list_t
terencez 0:f9d13e09cf11 166 {
terencez 0:f9d13e09cf11 167 struct _lwm2m_list_t * next;
terencez 0:f9d13e09cf11 168 uint16_t id;
terencez 0:f9d13e09cf11 169 } lwm2m_list_t;
terencez 0:f9d13e09cf11 170
terencez 0:f9d13e09cf11 171 // defined in list.c
terencez 0:f9d13e09cf11 172 // Add 'node' to the list 'head' and return the new list
terencez 0:f9d13e09cf11 173 lwm2m_list_t * lwm2m_list_add(lwm2m_list_t * head, lwm2m_list_t * node);
terencez 0:f9d13e09cf11 174 // Return the node with ID 'id' from the list 'head' or NULL if not found
terencez 0:f9d13e09cf11 175 lwm2m_list_t * lwm2m_list_find(lwm2m_list_t * head, uint16_t id);
terencez 0:f9d13e09cf11 176 // Remove the node with ID 'id' from the list 'head' and return the new list
terencez 0:f9d13e09cf11 177 lwm2m_list_t * lwm2m_list_remove(lwm2m_list_t * head, uint16_t id, lwm2m_list_t ** nodeP);
terencez 0:f9d13e09cf11 178 // Return the lowest unused ID in the list 'head'
terencez 0:f9d13e09cf11 179 uint16_t lwm2m_list_newId(lwm2m_list_t * head);
terencez 0:f9d13e09cf11 180
terencez 0:f9d13e09cf11 181 #define LWM2M_LIST_ADD(H,N) lwm2m_list_add((lwm2m_list_t *)H, (lwm2m_list_t *)N);
terencez 0:f9d13e09cf11 182 #define LWM2M_LIST_RM(H,I,N) lwm2m_list_remove((lwm2m_list_t *)H, I, (lwm2m_list_t **)N);
terencez 0:f9d13e09cf11 183
terencez 0:f9d13e09cf11 184
terencez 0:f9d13e09cf11 185 /*
terencez 0:f9d13e09cf11 186 * Resource values
terencez 0:f9d13e09cf11 187 */
terencez 0:f9d13e09cf11 188
terencez 0:f9d13e09cf11 189 // defined in utils.c
terencez 0:f9d13e09cf11 190 int lwm2m_PlainTextToInt64(char * buffer, int length, int64_t * dataP);
terencez 0:f9d13e09cf11 191
terencez 0:f9d13e09cf11 192 /*
terencez 0:f9d13e09cf11 193 * These utility functions allocate a new buffer storing the plain text
terencez 0:f9d13e09cf11 194 * representation of data. They return the size in bytes of the buffer
terencez 0:f9d13e09cf11 195 * or 0 in case of error.
terencez 0:f9d13e09cf11 196 * There is no trailing '\0' character in the buffer.
terencez 0:f9d13e09cf11 197 */
terencez 0:f9d13e09cf11 198 int lwm2m_int8ToPlainText(int8_t data, char ** bufferP);
terencez 0:f9d13e09cf11 199 int lwm2m_int16ToPlainText(int16_t data, char ** bufferP);
terencez 0:f9d13e09cf11 200 int lwm2m_int32ToPlainText(int32_t data, char ** bufferP);
terencez 0:f9d13e09cf11 201 int lwm2m_int64ToPlainText(int64_t data, char ** bufferP);
terencez 0:f9d13e09cf11 202 int lwm2m_float32ToPlainText(float data, char ** bufferP);
terencez 0:f9d13e09cf11 203 int lwm2m_float64ToPlainText(double data, char ** bufferP);
terencez 0:f9d13e09cf11 204 int lwm2m_boolToPlainText(bool data, char ** bufferP);
terencez 0:f9d13e09cf11 205
terencez 0:f9d13e09cf11 206
terencez 0:f9d13e09cf11 207 /*
terencez 0:f9d13e09cf11 208 * TLV
terencez 0:f9d13e09cf11 209 */
terencez 0:f9d13e09cf11 210
terencez 0:f9d13e09cf11 211 #define LWM2M_TLV_HEADER_MAX_LENGTH 6
terencez 0:f9d13e09cf11 212
terencez 0:f9d13e09cf11 213 #define LWM2M_TYPE_RESSOURCE 0x00
terencez 0:f9d13e09cf11 214 #define LWM2M_TYPE_MULTIPLE_RESSOURCE 0x01
terencez 0:f9d13e09cf11 215 #define LWM2M_TYPE_RESSOURCE_INSTANCE 0x02
terencez 0:f9d13e09cf11 216 #define LWM2M_TYPE_OBJECT_INSTANCE 0x03
terencez 0:f9d13e09cf11 217
terencez 0:f9d13e09cf11 218 /*
terencez 0:f9d13e09cf11 219 * Bitmask for the lwm2m_tlv_t::flag
terencez 0:f9d13e09cf11 220 * LWM2M_TLV_FLAG_STATIC_DATA specifies that lwm2m_tlv_t::value
terencez 0:f9d13e09cf11 221 * points to static memory and must no be freeed by the caller.
terencez 0:f9d13e09cf11 222 * LWM2M_TLV_FLAG_TEXT_FORMAT specifies that lwm2m_tlv_t::value
terencez 0:f9d13e09cf11 223 * is expressed or requested in plain text format.
terencez 0:f9d13e09cf11 224 */
terencez 0:f9d13e09cf11 225 #define LWM2M_TLV_FLAG_STATIC_DATA 0x01
terencez 0:f9d13e09cf11 226 #define LWM2M_TLV_FLAG_TEXT_FORMAT 0x02
terencez 0:f9d13e09cf11 227
terencez 0:f9d13e09cf11 228 typedef enum
terencez 0:f9d13e09cf11 229 {
terencez 0:f9d13e09cf11 230 TLV_OBJECT_INSTANCE = LWM2M_TYPE_OBJECT_INSTANCE,
terencez 0:f9d13e09cf11 231 TLV_RESSOURCE_INSTANCE = LWM2M_TYPE_RESSOURCE_INSTANCE,
terencez 0:f9d13e09cf11 232 TLV_MULTIPLE_INSTANCE = LWM2M_TYPE_MULTIPLE_RESSOURCE,
terencez 0:f9d13e09cf11 233 TLV_RESSOURCE = LWM2M_TYPE_RESSOURCE
terencez 0:f9d13e09cf11 234 } lwm2m_tlv_type_t;
terencez 0:f9d13e09cf11 235
terencez 0:f9d13e09cf11 236 typedef struct
terencez 0:f9d13e09cf11 237 {
terencez 0:f9d13e09cf11 238 uint8_t flags;
terencez 0:f9d13e09cf11 239 uint8_t type;
terencez 0:f9d13e09cf11 240 uint16_t id;
terencez 0:f9d13e09cf11 241 size_t length;
terencez 0:f9d13e09cf11 242 uint8_t * value;
terencez 0:f9d13e09cf11 243 } lwm2m_tlv_t;
terencez 0:f9d13e09cf11 244
terencez 0:f9d13e09cf11 245 lwm2m_tlv_t * lwm2m_tlv_new(int size);
terencez 0:f9d13e09cf11 246 int lwm2m_tlv_parse(char * buffer, size_t bufferLen, lwm2m_tlv_t ** dataP);
terencez 0:f9d13e09cf11 247 int lwm2m_tlv_serialize(int size, lwm2m_tlv_t * tlvP, char ** bufferP);
terencez 0:f9d13e09cf11 248 void lwm2m_tlv_free(int size, lwm2m_tlv_t * tlvP);
terencez 0:f9d13e09cf11 249
terencez 0:f9d13e09cf11 250 void lwm2m_tlv_encode_int(int64_t data, lwm2m_tlv_t * tlvP);
terencez 0:f9d13e09cf11 251 int lwm2m_tlv_decode_int(lwm2m_tlv_t * tlvP, int64_t * dataP);
terencez 0:f9d13e09cf11 252
terencez 0:f9d13e09cf11 253 /*
terencez 0:f9d13e09cf11 254 * These utility functions fill the buffer with a TLV record containing
terencez 0:f9d13e09cf11 255 * the data. They return the size in bytes of the TLV record, 0 in case
terencez 0:f9d13e09cf11 256 * of error.
terencez 0:f9d13e09cf11 257 */
terencez 0:f9d13e09cf11 258 int lwm2m_intToTLV(lwm2m_tlv_type_t type, int64_t data, uint16_t id, char * buffer, size_t buffer_len);
terencez 0:f9d13e09cf11 259 int lwm2m_boolToTLV(lwm2m_tlv_type_t type, bool value, uint16_t id, char * buffer, size_t buffer_len);
terencez 0:f9d13e09cf11 260 int lwm2m_opaqueToTLV(lwm2m_tlv_type_t type, uint8_t * dataP, size_t data_len, uint16_t id, char * buffer, size_t buffer_len);
terencez 0:f9d13e09cf11 261 int lwm2m_decodeTLV(char * buffer, size_t buffer_len, lwm2m_tlv_type_t * oType, uint16_t * oID, size_t * oDataIndex, size_t * oDataLen);
terencez 0:f9d13e09cf11 262 int lwm2m_opaqueToInt(char * buffer, size_t buffer_len, int64_t * dataP);
terencez 0:f9d13e09cf11 263
terencez 0:f9d13e09cf11 264 /*
terencez 0:f9d13e09cf11 265 * URI
terencez 0:f9d13e09cf11 266 *
terencez 0:f9d13e09cf11 267 * objectId is always set
terencez 0:f9d13e09cf11 268 * if instanceId or resourceId is greater than LWM2M_URI_MAX_ID, it means it is not specified
terencez 0:f9d13e09cf11 269 *
terencez 0:f9d13e09cf11 270 */
terencez 0:f9d13e09cf11 271
terencez 0:f9d13e09cf11 272 #define LWM2M_MAX_ID ((uint16_t)0xFFFF)
terencez 0:f9d13e09cf11 273
terencez 0:f9d13e09cf11 274 #define LWM2M_URI_FLAG_OBJECT_ID (uint8_t)0x04
terencez 0:f9d13e09cf11 275 #define LWM2M_URI_FLAG_INSTANCE_ID (uint8_t)0x02
terencez 0:f9d13e09cf11 276 #define LWM2M_URI_FLAG_RESOURCE_ID (uint8_t)0x01
terencez 0:f9d13e09cf11 277
terencez 0:f9d13e09cf11 278 #define LWM2M_URI_IS_SET_INSTANCE(uri) ((uri->flag & LWM2M_URI_FLAG_INSTANCE_ID) != 0)
terencez 0:f9d13e09cf11 279 #define LWM2M_URI_IS_SET_RESOURCE(uri) ((uri->flag & LWM2M_URI_FLAG_RESOURCE_ID) != 0)
terencez 0:f9d13e09cf11 280
terencez 0:f9d13e09cf11 281 typedef struct
terencez 0:f9d13e09cf11 282 {
terencez 0:f9d13e09cf11 283 uint8_t flag; // indicates which segments are set
terencez 0:f9d13e09cf11 284 uint16_t objectId;
terencez 0:f9d13e09cf11 285 uint16_t instanceId;
terencez 0:f9d13e09cf11 286 uint16_t resourceId;
terencez 0:f9d13e09cf11 287 } lwm2m_uri_t;
terencez 0:f9d13e09cf11 288
terencez 0:f9d13e09cf11 289
terencez 0:f9d13e09cf11 290 #define LWM2M_STRING_ID_MAX_LEN 6
terencez 0:f9d13e09cf11 291
terencez 0:f9d13e09cf11 292 // Parse an URI in LWM2M format and fill the lwm2m_uri_t.
terencez 0:f9d13e09cf11 293 // Return the number of characters read from buffer or 0 in case of error.
terencez 0:f9d13e09cf11 294 // Valid URIs: /1, /1/, /1/2, /1/2/, /1/2/3
terencez 0:f9d13e09cf11 295 // Invalid URIs: /, //, //2, /1//, /1//3, /1/2/3/, /1/2/3/4
terencez 0:f9d13e09cf11 296 int lwm2m_stringToUri(char * buffer, size_t buffer_len, lwm2m_uri_t * uriP);
terencez 0:f9d13e09cf11 297
terencez 0:f9d13e09cf11 298
terencez 0:f9d13e09cf11 299 /*
terencez 0:f9d13e09cf11 300 * LWM2M Objects
terencez 0:f9d13e09cf11 301 *
terencez 0:f9d13e09cf11 302 * For the read callback, if *numDataP is not zero, *dataArrayP is pre-allocated
terencez 0:f9d13e09cf11 303 * and contains the list of resources to read.
terencez 0:f9d13e09cf11 304 *
terencez 0:f9d13e09cf11 305 */
terencez 0:f9d13e09cf11 306
terencez 0:f9d13e09cf11 307 typedef struct _lwm2m_object_t lwm2m_object_t;
terencez 0:f9d13e09cf11 308
terencez 0:f9d13e09cf11 309 typedef uint8_t (*lwm2m_read_callback_t) (uint16_t instanceId, int * numDataP, lwm2m_tlv_t ** dataArrayP, lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 310 typedef uint8_t (*lwm2m_write_callback_t) (uint16_t instanceId, int numData, lwm2m_tlv_t * dataArray, lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 311 typedef uint8_t (*lwm2m_execute_callback_t) (uint16_t instanceId, uint16_t resourceId, char * buffer, int length, lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 312 typedef uint8_t (*lwm2m_create_callback_t) (uint16_t instanceId, int numData, lwm2m_tlv_t * dataArray, lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 313 typedef uint8_t (*lwm2m_delete_callback_t) (uint16_t instanceId, lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 314 typedef void (*lwm2m_close_callback_t) (lwm2m_object_t * objectP);
terencez 0:f9d13e09cf11 315
terencez 0:f9d13e09cf11 316
terencez 0:f9d13e09cf11 317 struct _lwm2m_object_t
terencez 0:f9d13e09cf11 318 {
terencez 0:f9d13e09cf11 319 uint16_t objID;
terencez 0:f9d13e09cf11 320 lwm2m_list_t * instanceList;
terencez 0:f9d13e09cf11 321 lwm2m_read_callback_t readFunc;
terencez 0:f9d13e09cf11 322 lwm2m_write_callback_t writeFunc;
terencez 0:f9d13e09cf11 323 lwm2m_execute_callback_t executeFunc;
terencez 0:f9d13e09cf11 324 lwm2m_create_callback_t createFunc;
terencez 0:f9d13e09cf11 325 lwm2m_delete_callback_t deleteFunc;
terencez 0:f9d13e09cf11 326 lwm2m_close_callback_t closeFunc;
terencez 0:f9d13e09cf11 327 void * userData;
terencez 0:f9d13e09cf11 328 };
terencez 0:f9d13e09cf11 329
terencez 0:f9d13e09cf11 330 /*
terencez 0:f9d13e09cf11 331 * LWM2M Servers
terencez 0:f9d13e09cf11 332 *
terencez 0:f9d13e09cf11 333 * Since LWM2M Server Object instances are not accessible to LWM2M servers,
terencez 0:f9d13e09cf11 334 * there is no need to store them as lwm2m_objects_t
terencez 0:f9d13e09cf11 335 */
terencez 0:f9d13e09cf11 336
terencez 0:f9d13e09cf11 337 typedef enum
terencez 0:f9d13e09cf11 338 {
terencez 0:f9d13e09cf11 339 SEC_NONE = 0,
terencez 0:f9d13e09cf11 340 SEC_PRE_SHARED_KEY,
terencez 0:f9d13e09cf11 341 SEC_RAW_PUBLIC_KEY,
terencez 0:f9d13e09cf11 342 SEC_CERTIFICATE
terencez 0:f9d13e09cf11 343 } lwm2m_security_mode_t;
terencez 0:f9d13e09cf11 344
terencez 0:f9d13e09cf11 345 typedef struct
terencez 0:f9d13e09cf11 346 {
terencez 0:f9d13e09cf11 347 lwm2m_security_mode_t mode;
terencez 0:f9d13e09cf11 348 size_t publicKeyLength;
terencez 0:f9d13e09cf11 349 uint8_t * publicKey;
terencez 0:f9d13e09cf11 350 size_t privateKeyLength;
terencez 0:f9d13e09cf11 351 uint8_t * privateKey;
terencez 0:f9d13e09cf11 352 } lwm2m_security_t;
terencez 0:f9d13e09cf11 353
terencez 0:f9d13e09cf11 354 typedef enum
terencez 0:f9d13e09cf11 355 {
terencez 0:f9d13e09cf11 356 STATE_UNKNOWN = 0,
terencez 0:f9d13e09cf11 357 STATE_REG_PENDING,
terencez 0:f9d13e09cf11 358 STATE_REGISTERED,
terencez 0:f9d13e09cf11 359 STATE_REG_UPDATE_PENDING,
terencez 0:f9d13e09cf11 360 STATE_DEREG_PENDING
terencez 0:f9d13e09cf11 361 } lwm2m_status_t;
terencez 0:f9d13e09cf11 362
terencez 0:f9d13e09cf11 363 typedef enum
terencez 0:f9d13e09cf11 364 {
terencez 0:f9d13e09cf11 365 BINDING_UNKNOWN = 0,
terencez 0:f9d13e09cf11 366 BINDING_U, // UDP
terencez 0:f9d13e09cf11 367 BINDING_UQ, // UDP queue mode
terencez 0:f9d13e09cf11 368 BINDING_S, // SMS
terencez 0:f9d13e09cf11 369 BINDING_SQ, // SMS queue mode
terencez 0:f9d13e09cf11 370 BINDING_US, // UDP plus SMS
terencez 0:f9d13e09cf11 371 BINDING_UQS // UDP queue mode plus SMS
terencez 0:f9d13e09cf11 372 } lwm2m_binding_t;
terencez 0:f9d13e09cf11 373
terencez 0:f9d13e09cf11 374 typedef struct _lwm2m_server_
terencez 0:f9d13e09cf11 375 {
terencez 0:f9d13e09cf11 376 struct _lwm2m_server_ * next; // matches lwm2m_list_t::next
terencez 0:f9d13e09cf11 377 uint16_t shortID; // matches lwm2m_list_t::id
terencez 0:f9d13e09cf11 378 uint32_t lifetime; // lifetime of the registration in sec or 0 if default value (86400 sec)
terencez 0:f9d13e09cf11 379 char * sms; // SMS MSISDN (phone number) for this server to send SMS
terencez 0:f9d13e09cf11 380 lwm2m_binding_t binding; // client connection mode with this server
terencez 0:f9d13e09cf11 381 lwm2m_security_t security;
terencez 0:f9d13e09cf11 382 void * sessionH;
terencez 0:f9d13e09cf11 383 lwm2m_status_t status;
terencez 0:f9d13e09cf11 384 char * location;
terencez 0:f9d13e09cf11 385 uint16_t mid;
terencez 0:f9d13e09cf11 386 } lwm2m_server_t;
terencez 0:f9d13e09cf11 387
terencez 0:f9d13e09cf11 388 typedef struct
terencez 0:f9d13e09cf11 389 {
terencez 0:f9d13e09cf11 390 char * uri;
terencez 0:f9d13e09cf11 391 lwm2m_security_t security;
terencez 0:f9d13e09cf11 392 uint32_t holdOffTime;
terencez 0:f9d13e09cf11 393 } lwm2m_bootstrap_server_t;
terencez 0:f9d13e09cf11 394
terencez 0:f9d13e09cf11 395 /*
terencez 0:f9d13e09cf11 396 * LWM2M result callback
terencez 0:f9d13e09cf11 397 *
terencez 0:f9d13e09cf11 398 * When used with an observe, if 'data' is not nil, 'status' holds the observe counter.
terencez 0:f9d13e09cf11 399 */
terencez 0:f9d13e09cf11 400 typedef void (*lwm2m_result_callback_t) (uint16_t clientID, lwm2m_uri_t * uriP, int status, uint8_t * data, int dataLength, void * userData);
terencez 0:f9d13e09cf11 401
terencez 0:f9d13e09cf11 402 /*
terencez 0:f9d13e09cf11 403 * LWM2M Observations
terencez 0:f9d13e09cf11 404 *
terencez 0:f9d13e09cf11 405 * Used to store observation of remote clients resources.
terencez 0:f9d13e09cf11 406 * status STATE_REG_PENDING means the observe request was sent to the client but not yet answered.
terencez 0:f9d13e09cf11 407 * status STATE_REGISTERED means the client acknowledged the observe request.
terencez 0:f9d13e09cf11 408 */
terencez 0:f9d13e09cf11 409
terencez 0:f9d13e09cf11 410 typedef struct _lwm2m_observation_
terencez 0:f9d13e09cf11 411 {
terencez 0:f9d13e09cf11 412 struct _lwm2m_observation_ * next; // matches lwm2m_list_t::next
terencez 0:f9d13e09cf11 413 uint16_t id; // matches lwm2m_list_t::id
terencez 0:f9d13e09cf11 414 struct _lwm2m_client_ * clientP;
terencez 0:f9d13e09cf11 415 lwm2m_uri_t uri;
terencez 0:f9d13e09cf11 416 lwm2m_result_callback_t callback;
terencez 0:f9d13e09cf11 417 void * userData;
terencez 0:f9d13e09cf11 418 } lwm2m_observation_t;
terencez 0:f9d13e09cf11 419
terencez 0:f9d13e09cf11 420 /*
terencez 0:f9d13e09cf11 421 * LWM2M Clients
terencez 0:f9d13e09cf11 422 *
terencez 0:f9d13e09cf11 423 * Be careful not to mix lwm2m_client_object_t used to store list of objects of remote clients
terencez 0:f9d13e09cf11 424 * and lwm2m_object_t describing objects exposed to remote servers.
terencez 0:f9d13e09cf11 425 *
terencez 0:f9d13e09cf11 426 */
terencez 0:f9d13e09cf11 427
terencez 0:f9d13e09cf11 428 typedef struct _lwm2m_client_object_
terencez 0:f9d13e09cf11 429 {
terencez 0:f9d13e09cf11 430 struct _lwm2m_client_object_ * next; // matches lwm2m_list_t::next
terencez 0:f9d13e09cf11 431 uint16_t id; // matches lwm2m_list_t::id
terencez 0:f9d13e09cf11 432 lwm2m_list_t * instanceList;
terencez 0:f9d13e09cf11 433 } lwm2m_client_object_t;
terencez 0:f9d13e09cf11 434
terencez 0:f9d13e09cf11 435 typedef struct _lwm2m_client_
terencez 0:f9d13e09cf11 436 {
terencez 0:f9d13e09cf11 437 struct _lwm2m_client_ * next; // matches lwm2m_list_t::next
terencez 0:f9d13e09cf11 438 uint16_t internalID; // matches lwm2m_list_t::id
terencez 0:f9d13e09cf11 439 char * name;
terencez 0:f9d13e09cf11 440 lwm2m_binding_t binding;
terencez 0:f9d13e09cf11 441 char * msisdn;
terencez 0:f9d13e09cf11 442 uint32_t lifetime;
terencez 0:f9d13e09cf11 443 time_t endOfLife;
terencez 0:f9d13e09cf11 444 void * sessionH;
terencez 0:f9d13e09cf11 445 lwm2m_client_object_t * objectList;
terencez 0:f9d13e09cf11 446 lwm2m_observation_t * observationList;
terencez 0:f9d13e09cf11 447 } lwm2m_client_t;
terencez 0:f9d13e09cf11 448
terencez 0:f9d13e09cf11 449
terencez 0:f9d13e09cf11 450 /*
terencez 0:f9d13e09cf11 451 * LWM2M transaction
terencez 0:f9d13e09cf11 452 *
terencez 0:f9d13e09cf11 453 * Adaptation of Erbium's coap_transaction_t
terencez 0:f9d13e09cf11 454 */
terencez 0:f9d13e09cf11 455
terencez 0:f9d13e09cf11 456 typedef enum
terencez 0:f9d13e09cf11 457 {
terencez 0:f9d13e09cf11 458 ENDPOINT_UNKNOWN = 0,
terencez 0:f9d13e09cf11 459 ENDPOINT_CLIENT,
terencez 0:f9d13e09cf11 460 ENDPOINT_SERVER,
terencez 0:f9d13e09cf11 461 ENDPOINT_BOOTSTRAP
terencez 0:f9d13e09cf11 462 } lwm2m_endpoint_type_t;
terencez 0:f9d13e09cf11 463
terencez 0:f9d13e09cf11 464 typedef struct _lwm2m_transaction_ lwm2m_transaction_t;
terencez 0:f9d13e09cf11 465
terencez 0:f9d13e09cf11 466 typedef void (*lwm2m_transaction_callback_t) (lwm2m_transaction_t * transacP, void * message);
terencez 0:f9d13e09cf11 467
terencez 0:f9d13e09cf11 468 struct _lwm2m_transaction_
terencez 0:f9d13e09cf11 469 {
terencez 0:f9d13e09cf11 470 lwm2m_transaction_t * next; // matches lwm2m_list_t::next
terencez 0:f9d13e09cf11 471 uint16_t mID; // matches lwm2m_list_t::id
terencez 0:f9d13e09cf11 472 lwm2m_endpoint_type_t peerType;
terencez 0:f9d13e09cf11 473 void * peerP;
terencez 0:f9d13e09cf11 474 uint8_t retrans_counter;
terencez 0:f9d13e09cf11 475 time_t retrans_time;
terencez 0:f9d13e09cf11 476 char objStringID[LWM2M_STRING_ID_MAX_LEN];
terencez 0:f9d13e09cf11 477 char instanceStringID[LWM2M_STRING_ID_MAX_LEN];
terencez 0:f9d13e09cf11 478 char resourceStringID[LWM2M_STRING_ID_MAX_LEN];
terencez 0:f9d13e09cf11 479 void * message;
terencez 0:f9d13e09cf11 480 uint16_t buffer_len;
terencez 0:f9d13e09cf11 481 uint8_t * buffer;
terencez 0:f9d13e09cf11 482 lwm2m_transaction_callback_t callback;
terencez 0:f9d13e09cf11 483 void * userData;
terencez 0:f9d13e09cf11 484 };
terencez 0:f9d13e09cf11 485
terencez 0:f9d13e09cf11 486 /*
terencez 0:f9d13e09cf11 487 * LWM2M observed resources
terencez 0:f9d13e09cf11 488 */
terencez 0:f9d13e09cf11 489 typedef struct _lwm2m_watcher_
terencez 0:f9d13e09cf11 490 {
terencez 0:f9d13e09cf11 491 struct _lwm2m_watcher_ * next;
terencez 0:f9d13e09cf11 492
terencez 0:f9d13e09cf11 493 lwm2m_server_t * server;
terencez 0:f9d13e09cf11 494 uint8_t token[8];
terencez 0:f9d13e09cf11 495 size_t tokenLen;
terencez 0:f9d13e09cf11 496 uint32_t counter;
terencez 0:f9d13e09cf11 497 uint16_t lastMid;
terencez 0:f9d13e09cf11 498 } lwm2m_watcher_t;
terencez 0:f9d13e09cf11 499
terencez 0:f9d13e09cf11 500 typedef struct _lwm2m_observed_
terencez 0:f9d13e09cf11 501
terencez 0:f9d13e09cf11 502 {
terencez 0:f9d13e09cf11 503 struct _lwm2m_observed_ * next;
terencez 0:f9d13e09cf11 504
terencez 0:f9d13e09cf11 505 lwm2m_uri_t uri;
terencez 0:f9d13e09cf11 506 lwm2m_watcher_t * watcherList;
terencez 0:f9d13e09cf11 507 } lwm2m_observed_t;
terencez 0:f9d13e09cf11 508
terencez 0:f9d13e09cf11 509
terencez 0:f9d13e09cf11 510 /*
terencez 0:f9d13e09cf11 511 * LWM2M Context
terencez 0:f9d13e09cf11 512 */
terencez 0:f9d13e09cf11 513
terencez 0:f9d13e09cf11 514 // The session handle MUST uniquely identify a peer.
terencez 0:f9d13e09cf11 515 typedef uint8_t (*lwm2m_buffer_send_callback_t)(void * sessionH, uint8_t * buffer, size_t length, void * userData);
terencez 0:f9d13e09cf11 516
terencez 0:f9d13e09cf11 517
terencez 0:f9d13e09cf11 518 typedef struct
terencez 0:f9d13e09cf11 519 {
terencez 0:f9d13e09cf11 520 int socket;
terencez 0:f9d13e09cf11 521 #ifdef LWM2M_CLIENT_MODE
terencez 0:f9d13e09cf11 522 char * endpointName;
terencez 0:f9d13e09cf11 523 lwm2m_bootstrap_server_t * bootstrapServer;
terencez 0:f9d13e09cf11 524 lwm2m_server_t * serverList;
terencez 0:f9d13e09cf11 525 lwm2m_object_t ** objectList;
terencez 0:f9d13e09cf11 526 uint16_t numObject;
terencez 0:f9d13e09cf11 527 lwm2m_observed_t * observedList;
terencez 0:f9d13e09cf11 528 #endif
terencez 0:f9d13e09cf11 529 #ifdef LWM2M_SERVER_MODE
terencez 0:f9d13e09cf11 530 lwm2m_client_t * clientList;
terencez 0:f9d13e09cf11 531 lwm2m_result_callback_t monitorCallback;
terencez 0:f9d13e09cf11 532 void * monitorUserData;
terencez 0:f9d13e09cf11 533 #endif
terencez 0:f9d13e09cf11 534 uint16_t nextMID;
terencez 0:f9d13e09cf11 535 lwm2m_transaction_t * transactionList;
terencez 0:f9d13e09cf11 536 // buffer send callback
terencez 0:f9d13e09cf11 537 lwm2m_buffer_send_callback_t bufferSendCallback;
terencez 0:f9d13e09cf11 538 void * bufferSendUserData;
terencez 0:f9d13e09cf11 539 } lwm2m_context_t;
terencez 0:f9d13e09cf11 540
terencez 0:f9d13e09cf11 541
terencez 0:f9d13e09cf11 542 // initialize a liblwm2m context. endpointName, numObject and objectList are ignored for pure servers.
terencez 0:f9d13e09cf11 543 lwm2m_context_t * lwm2m_init(char * endpointName, uint16_t numObject, lwm2m_object_t * objectList[], lwm2m_buffer_send_callback_t bufferSendCallback, void * bufferSendUserData);
terencez 0:f9d13e09cf11 544 // close a liblwm2m context.
terencez 0:f9d13e09cf11 545 void lwm2m_close(lwm2m_context_t * contextP);
terencez 0:f9d13e09cf11 546
terencez 0:f9d13e09cf11 547 // perform any required pending operation and adjust timeoutP to the maximal time interval to wait.
terencez 0:f9d13e09cf11 548 int lwm2m_step(lwm2m_context_t * contextP, struct timeval * timeoutP);
terencez 0:f9d13e09cf11 549 // dispatch received data to liblwm2m
terencez 0:f9d13e09cf11 550 void lwm2m_handle_packet(lwm2m_context_t * contextP, uint8_t * buffer, int length, void * fromSessionH);
terencez 0:f9d13e09cf11 551
terencez 0:f9d13e09cf11 552 #ifdef LWM2M_CLIENT_MODE
terencez 0:f9d13e09cf11 553 void lwm2m_set_bootstrap_server(lwm2m_context_t * contextP, lwm2m_bootstrap_server_t * serverP);
terencez 0:f9d13e09cf11 554 int lwm2m_add_server(lwm2m_context_t * contextP, uint16_t shortID, uint32_t lifetime, char * sms, lwm2m_binding_t binding, void * sessionH, lwm2m_security_t * securityP);
terencez 0:f9d13e09cf11 555
terencez 0:f9d13e09cf11 556 // send registration message to all known LWM2M Servers.
terencez 0:f9d13e09cf11 557 int lwm2m_register(lwm2m_context_t * contextP);
terencez 0:f9d13e09cf11 558
terencez 0:f9d13e09cf11 559 // send a registration update to the server specified by the server short identifier
terencez 0:f9d13e09cf11 560 int lwm2m_update_registration(lwm2m_context_t * contextP, uint16_t shortServerID);
terencez 0:f9d13e09cf11 561
terencez 0:f9d13e09cf11 562 // inform liblwm2m that a resource value has changed.
terencez 0:f9d13e09cf11 563 void lwm2m_resource_value_changed(lwm2m_context_t * contextP, lwm2m_uri_t * uriP);
terencez 0:f9d13e09cf11 564 #endif
terencez 0:f9d13e09cf11 565
terencez 0:f9d13e09cf11 566 #ifdef LWM2M_SERVER_MODE
terencez 0:f9d13e09cf11 567 // Clients registration/deregistration monitoring API.
terencez 0:f9d13e09cf11 568 // When a LWM2M client registers, the callback is called with status CREATED_2_01.
terencez 0:f9d13e09cf11 569 // When a LWM2M client deregisters, the callback is called with status DELETED_2_02.
terencez 0:f9d13e09cf11 570 // clientID is the internal ID of the LWM2M Client.
terencez 0:f9d13e09cf11 571 // The callback's parameters uri, data, dataLength are always NULL.
terencez 0:f9d13e09cf11 572 // The lwm2m_client_t is present in the lwm2m_context_t's clientList when the callback is called. On a deregistration, it deleted when the callback returns.
terencez 0:f9d13e09cf11 573 void lwm2m_set_monitoring_callback(lwm2m_context_t * contextP, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 574
terencez 0:f9d13e09cf11 575 // Device Management APIs
terencez 0:f9d13e09cf11 576 int lwm2m_dm_read(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 577 int lwm2m_dm_write(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, char * buffer, int length, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 578 int lwm2m_dm_execute(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, char * buffer, int length, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 579 int lwm2m_dm_create(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, char * buffer, int length, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 580 int lwm2m_dm_delete(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 581
terencez 0:f9d13e09cf11 582 // Information Reporting APIs
terencez 0:f9d13e09cf11 583 int lwm2m_observe(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 584 int lwm2m_observe_cancel(lwm2m_context_t * contextP, uint16_t clientID, lwm2m_uri_t * uriP, lwm2m_result_callback_t callback, void * userData);
terencez 0:f9d13e09cf11 585 #endif
terencez 0:f9d13e09cf11 586
terencez 0:f9d13e09cf11 587 #endif