light_control.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 
108 #ifndef OBJECTS_LIGHT_CONTROL_H
109 #define OBJECTS_LIGHT_CONTROL_H
110 
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 
115 #include "liblwm2m.h"
116 
125 #ifndef CONFIG_LWM2M_LIGHT_INSTANCES_MAX
126 #define CONFIG_LWM2M_LIGHT_INSTANCES_MAX (3U)
127 #endif
128 
132 #ifndef CONFIG_LWM2M_LIGHT_CONTROL_COLOR_MAX_SIZE
133 #define CONFIG_LWM2M_LIGHT_CONTROL_COLOR_MAX_SIZE (16U)
134 #endif
135 
139 #ifndef CONFIG_LWM2M_LIGHT_CONTROL_APP_TYPE_MAX_SIZE
140 #define CONFIG_LWM2M_LIGHT_CONTROL_APP_TYPE_MAX_SIZE (16U)
141 #endif
147 #define LWM2M_LIGHT_CONTROL_OBJECT_ID 3311
148 
156 #define LWM2M_LIGHT_CONTROL_ON_OFF_ID 5850
160 #define LWM2M_LIGHT_CONTROL_DIMMER_ID 5851
164 #define LWM2M_LIGHT_CONTROL_ON_TIME_ID 5852
168 #define LWM2M_LIGHT_CONTROL_ACT_PWR_ID 5805
172 #define LWM2M_LIGHT_CONTROL_PWR_FACTOR_ID 5820
176 #define LWM2M_LIGHT_CONTROL_COLOUR_ID 5706
180 #define LWM2M_LIGHT_CONTROL_UNITS_ID 5701
184 #define LWM2M_LIGHT_CONTROL_APP_TYPE_ID 5750
199 typedef void (*lwm2m_obj_light_control_cb_t)(lwm2m_object_t *object, uint16_t instance_id,
200  bool status, uint8_t dimmer, const char* color,
201  const char* app_type, void *arg);
202 
208  void *cb_arg;
209  const char *color;
210  size_t color_len;
211  const char *app_type;
212  size_t app_type_len;
214 
223 
237  int32_t instance_id);
238 
250 int lwm2m_object_light_control_update_status(uint16_t instance_id, bool status, bool call_cb);
251 
263 int lwm2m_object_light_control_update_dimmer(uint16_t instance_id, uint8_t dimmer, bool call_cb);
264 
278 int lwm2m_object_light_control_update_color(uint16_t instance_id, const char *color, size_t len,
279  bool call_cb);
280 
294 int lwm2m_object_light_control_update_app_type(uint16_t instance_id, const char *app_type,
295  size_t len, bool call_cb);
296 
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif /* OBJECTS_LIGHT_CONTROL_H */
int lwm2m_object_light_control_update_dimmer(uint16_t instance_id, uint8_t dimmer, bool call_cb)
Update the dimmer value of a light control instance.
lwm2m_object_t * lwm2m_object_light_control_init(lwm2m_client_data_t *client_data)
Initialize the Light Control object.
int lwm2m_object_light_control_instance_create(const lwm2m_obj_light_control_args_t *args, int32_t instance_id)
Create a new Light Control instance and add it to the object list.
void(* lwm2m_obj_light_control_cb_t)(lwm2m_object_t *object, uint16_t instance_id, bool status, uint8_t dimmer, const char *color, const char *app_type, void *arg)
Signature of the callback called when the light resources are updated.
int lwm2m_object_light_control_update_app_type(uint16_t instance_id, const char *app_type, size_t len, bool call_cb)
Update the application type of a light control instance.
int lwm2m_object_light_control_update_color(uint16_t instance_id, const char *color, size_t len, bool call_cb)
Update the color of a light control instance.
int lwm2m_object_light_control_update_status(uint16_t instance_id, bool status, bool call_cb)
Update the status of a light control instance.
struct lwm2m_obj_light_control_args lwm2m_obj_light_control_args_t
Arguments for the creation of a Light Control object instance.
LwM2M client descriptor.
Definition: lwm2m_client.h:70
Arguments for the creation of a Light Control object instance.
const char * color
Array of chars with the light color.
void * cb_arg
Argument to call cb with.
lwm2m_obj_light_control_cb_t cb
Callback for status and dimmer changes.
size_t color_len
Length of color.
size_t app_type_len
Length of app_type.
const char * app_type
Array of chars with the light app type.