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 
43 #ifndef OBJECTS_IPSO_SENSOR_BASE_H
44 #define OBJECTS_IPSO_SENSOR_BASE_H
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 #include "mutex.h"
51 #include "liblwm2m.h"
52 #include "lwm2m_client.h"
53 
62 #ifndef CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE
63 #define CONFIG_LWM2M_IPSO_SENSOR_BASE_UNITS_MAX_SIZE (4U)
64 #endif
74 #define LWM2M_IPSO_BASE_SENSOR_VALUE_ID 5700
78 #define LWM2M_IPSO_BASE_SENSOR_MIN_MEASURED_VALUE_ID 5601
82 #define LWM2M_IPSO_BASE_SENSOR_MAX_MEASURED_VALUE_ID 5602
86 #define LWM2M_IPSO_BASE_SENSOR_MIN_RANGE_VALUE_ID 5603
90 #define LWM2M_IPSO_BASE_SENSOR_MAX_RANGE_VALUE_ID 5604
94 #define LWM2M_IPSO_BASE_SENSOR_RESET_MIN_MAX_MEASURED_VALUES_ID 5605
98 #define LWM2M_IPSO_BASE_SENSOR_UNITS_ID 5701
110 typedef int lwm2m_obj_ipso_base_sensor_read_cb_t(void *read_cb_arg, int16_t *value);
111 
117  int32_t instance_id;
119  char *units;
120  size_t units_len;
121  int16_t min_range_value;
122  int16_t max_range_value;
123  void *read_cb_arg;
126 
131  lwm2m_list_t list;
132  int16_t sensor_value;
135  int16_t min_range_value;
136  int16_t max_range_value;
138  void *read_cb_arg;
141 
146  lwm2m_object_t object;
148  uint16_t object_id;
151 
165 
180  uint16_t object_id,
182  size_t instance_count);
183 
194  const lwm2m_obj_ipso_sensor_base_t *object,
195  uint16_t instance_id, int16_t value);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* OBJECTS_IPSO_SENSOR_BASE_H */
#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:70
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:146