Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef OBJECTS_COMMON_H
21#define OBJECTS_COMMON_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "liblwm2m.h"
28#include "lwm2m_client.h"
29
41static inline lwm2m_object_t *lwm2m_get_object_by_id(lwm2m_client_data_t *client_data, uint16_t id)
42{
43 return (lwm2m_object_t *)LWM2M_LIST_FIND(client_data->lwm2m_ctx->objectList, id);
44}
45
61int lwm2m_get_string(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, char *out,
62 size_t *out_len);
63
83int lwm2m_get_string_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
84 char *out, size_t *out_len);
85
101int lwm2m_get_opaque(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint8_t *out,
102 size_t *out_len);
103
123int lwm2m_get_opaque_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
124 uint8_t *out, size_t *out_len);
125
140int lwm2m_get_int(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, int64_t *out);
141
160int lwm2m_get_int_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
161 int64_t *out);
162
177int lwm2m_get_float(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, double *out);
178
197int lwm2m_get_float_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
198 double *out);
199
214int lwm2m_get_bool(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, bool *out);
215
234int lwm2m_get_bool_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
235 bool *out);
236
254 uint16_t *object_id_out, uint16_t *instance_id_out);
255
276int lwm2m_get_objlink_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
277 uint16_t *object_id_out, uint16_t *instance_id_out);
278
294int lwm2m_set_string(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, char *val,
295 size_t val_len);
296
316int lwm2m_set_string_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
317 char *val, size_t val_len);
318
334int lwm2m_set_opaque(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint8_t *val,
335 size_t val_len);
336
356int lwm2m_set_opaque_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
357 uint8_t *val, size_t val_len);
358
373int lwm2m_set_int(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, int64_t val);
374
393int lwm2m_set_int_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
394 int64_t val);
395
410int lwm2m_set_float(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, double val);
411
430int lwm2m_set_float_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
431 double val);
432
447int lwm2m_set_bool(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, bool val);
448
467int lwm2m_set_bool_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
468 bool val);
469
486 uint16_t object_id_in, uint16_t instance_id_in);
487
507int lwm2m_set_objlink_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len,
508 uint16_t object_id_in, uint16_t instance_id_in);
509
510#ifdef DOXYGEN
520#define LWM2M_URI_FLAG_OBJECT_ID (uint8_t)0x04
521
525#define LWM2M_URI_FLAG_INSTANCE_ID (uint8_t)0x02
526
530#define LWM2M_URI_FLAG_RESOURCE_ID (uint8_t)0x01
531
535typedef struct {
536 uint8_t flag;
537 uint16_t objectId;
538 uint16_t instanceId;
539 uint16_t resourceId;
541
543#endif /* DOXYGEN */
544
545#ifdef __cplusplus
546}
547#endif
548
549#endif /* OBJECTS_COMMON_H */
static lwm2m_object_t * lwm2m_get_object_by_id(lwm2m_client_data_t *client_data, uint16_t id)
Get the handle for an object type of the client by its ID.
Definition common.h:41
int lwm2m_get_int(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, int64_t *out)
Get the value of an integer-type resource, specified by uri.
int lwm2m_get_bool_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, bool *out)
Get the value of an float-type resource, specified by a path path.
int lwm2m_set_bool(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, bool val)
Set the value of an boolean-type resource, specified by uri.
int lwm2m_set_string(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, char *val, size_t val_len)
Set the value of a string-type resource, specified by uri.
int lwm2m_set_bool_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, bool val)
Set the value of an float-type resource, specified by a path path.
int lwm2m_set_objlink_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, uint16_t object_id_in, uint16_t instance_id_in)
Set the value of an objectlink-type resource, specified by a path path.
int lwm2m_set_int(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, int64_t val)
Set the value of an integer-type resource, specified by uri.
int lwm2m_get_string_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, char *out, size_t *out_len)
Get the value of a string-type resource, specified by a path path.
int lwm2m_get_objlink_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, uint16_t *object_id_out, uint16_t *instance_id_out)
Get the value of an objectlink-type resource, specified by a path path.
int lwm2m_set_float_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, double val)
Set the value of an float-type resource, specified by a path path.
int lwm2m_set_int_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, int64_t val)
Set the value of an integer-type resource, specified by a path path.
int lwm2m_get_objlink(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint16_t *object_id_out, uint16_t *instance_id_out)
Get the value of an objectlink-type resource, specified by uri.
int lwm2m_get_float(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, double *out)
Get the value of an float-type resource, specified by uri.
int lwm2m_get_bool(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, bool *out)
Get the value of an boolean-type resource, specified by uri.
int lwm2m_set_objlink(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint16_t object_id_in, uint16_t instance_id_in)
Set the value of an objectlink-type resource, specified by uri.
int lwm2m_set_float(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, double val)
Set the value of an float-type resource, specified by uri.
int lwm2m_get_float_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, double *out)
Get the value of an float-type resource, specified by a path path.
int lwm2m_get_string(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, char *out, size_t *out_len)
Get the value of a string-type resource, specified by uri.
int lwm2m_set_string_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, char *val, size_t val_len)
Set the value of a string-type resource, specified by a path path.
int lwm2m_get_opaque(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint8_t *out, size_t *out_len)
Get the value of an opaque-type resource, specified by uri.
int lwm2m_get_int_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, int64_t *out)
Get the value of an integer-type resource, specified by a path path.
int lwm2m_set_opaque_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, uint8_t *val, size_t val_len)
Set the value of an opaque-type resource, specified by a path path.
int lwm2m_set_opaque(lwm2m_client_data_t *client_data, const lwm2m_uri_t *uri, uint8_t *val, size_t val_len)
Set the value of an opaque-type resource, specified by uri.
int lwm2m_get_opaque_by_path(lwm2m_client_data_t *client_data, const char *path, size_t path_len, uint8_t *out, size_t *out_len)
Get the value of an opaque-type resource, specified by a path path.
Definitions and public API for a LwM2M client using Wakaama.
LwM2M client descriptor.
lwm2m_context_t * lwm2m_ctx
LwM2M context.
Representation of an URI in a LwM2M client (defined in liblwm2m.h).
Definition common.h:535
uint16_t instanceId
instance ID
Definition common.h:538
uint16_t resourceId
resource ID
Definition common.h:539
uint16_t objectId
object ID
Definition common.h:537
uint8_t flag
indicates which segments are present
Definition common.h:536