ipso_sensor_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 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 
9 #pragma once
10 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #include "mutex.h"
50 #include "liblwm2m.h"
51 #include "lwm2m_client.h"
52 
61 #ifndef CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE
62 #define CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE (4U)
63 #endif
73 #define LWM2M_IPSO_BASE_SENSOR_VALUE_ID 5700
77 #define LWM2M_IPSO_BASE_SENSOR_MIN_MEASURED_VALUE_ID 5601
81 #define LWM2M_IPSO_BASE_SENSOR_MAX_MEASURED_VALUE_ID 5602
85 #define LWM2M_IPSO_BASE_SENSOR_MIN_RANGE_VALUE_ID 5603
89 #define LWM2M_IPSO_BASE_SENSOR_MAX_RANGE_VALUE_ID 5604
93 #define LWM2M_IPSO_BASE_SENSOR_RESET_MIN_MAX_MEASURED_VALUES_ID 5605
97 #define LWM2M_IPSO_BASE_SENSOR_UNITS_ID 5701
109 typedef int lwm2m_obj_ipso_base_sensor_read_cb_t(void *read_cb_arg, int16_t *value);
110 
116  int32_t instance_id;
118  char *units;
119  size_t units_len;
120  int16_t min_range_value;
121  int16_t max_range_value;
122  void *read_cb_arg;
125 
130  lwm2m_list_t list;
131  int16_t sensor_value;
134  int16_t min_range_value;
135  int16_t max_range_value;
137  void *read_cb_arg;
140 
145  lwm2m_object_t object;
147  uint16_t object_id;
150 
164 
179  uint16_t object_id,
181  size_t instance_count);
182 
193  const lwm2m_obj_ipso_sensor_base_t *object,
194  uint16_t instance_id, int16_t value);
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
#define CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE
Maximum size for the units resource string.
struct lwm2m_obj_ipso_sensor_base lwm2m_obj_ipso_sensor_base_t
LwM2M IPSO sensor base object.
void lwm2m_object_ipso_sensor_base_update_value(const lwm2m_client_data_t *client_data, const lwm2m_obj_ipso_sensor_base_t *object, uint16_t instance_id, int16_t value)
Update the value of the illuminance sensor and trigger a notification to the observing servers,...
struct lwm2m_obj_ipso_sensor_base_inst lwm2m_obj_ipso_sensor_base_inst_t
LwM2M IPSO sensor base instance.
int lwm2m_object_ipso_sensor_base_init_derived(lwm2m_client_data_t *client_data, lwm2m_obj_ipso_sensor_base_t *object, uint16_t object_id, lwm2m_obj_ipso_sensor_base_inst_t *instances, size_t instance_count)
Initialize the a LwM2M object derived from the IPSO Sensor Base object.
int32_t lwm2m_object_ipso_sensor_base_instance_create(lwm2m_obj_ipso_sensor_base_t *object, const lwm2m_obj_ipso_base_sensor_args_t *args)
Create a new object instance based on the IPSO Sensor Base and add it to the object list.
struct lwm2m_obj_ipso_sensor_base_args lwm2m_obj_ipso_base_sensor_args_t
Arguments for the creation of an object based on the IPSO Sensor Base object instance.
int lwm2m_obj_ipso_base_sensor_read_cb_t(void *read_cb_arg, int16_t *value)
Callback for reading the sensor value.
Definitions and public API for a LwM2M client using Wakaama.
Mutex for thread synchronization.
LwM2M client descriptor.
Definition: lwm2m_client.h:69
Arguments for the creation of an object based on the IPSO Sensor Base object instance.
int32_t instance_id
ID for the new instance.
char * units
Null-terminated string of the "Sensor Units" resource.
lwm2m_obj_ipso_base_sensor_read_cb_t * read_cb
Callback to read the sensor value.
int16_t max_range_value
Maximum value that can be measured by the sensor.
size_t units_len
Length of units.
int16_t min_range_value
Minimum value that can be measured by the sensor.
void * read_cb_arg
Data to pass to the read callback.
LwM2M IPSO sensor base instance.
int16_t min_sensor_value
minimum sensor value
lwm2m_list_t list
list handle
lwm2m_obj_ipso_base_sensor_read_cb_t * read_cb
Callback to read the sensor value.
int16_t min_range_value
minimum range value
char units[CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE]
units
void * read_cb_arg
Data to pass to the read callback.
int16_t max_sensor_value
maximum sensor value
int16_t max_range_value
maximum range value
LwM2M IPSO sensor base object.
lwm2m_obj_ipso_sensor_base_inst_t * free_instances
List of instances.
lwm2m_object_t object
LwM2M object base.
mutex_t mutex
Mutex for the object.
uint16_t object_id
Object ID.
Mutex structure.
Definition: mutex.h:39