nRF5 SDK for Mesh v5.0.0
light_lc_common.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef LC_SERVER_COMMON_H__
39 #define LC_SERVER_COMMON_H__
40 
41 #include <stdint.h>
42 #include "model_common.h"
43 
57 #define LIGHT_LC_SERVER_COMPANY_ID (0xFFFF)
58 
64 #define LIGHT_LC_PROPERTY_BUF_SIZE (4)
65 
67 #define LIGHT_LC_MODE_OFF (0)
68 
74 #ifndef LIGHT_LC_DEFAULT_MODE
75 #define LIGHT_LC_DEFAULT_MODE (0x0)
76 #endif
77 
83 #ifndef LIGHT_LC_DEFAULT_OCC_MODE
84 #define LIGHT_LC_DEFAULT_OCC_MODE (0x0)
85 #endif
86 
88 #ifndef LIGHT_LC_DEFAULT_LIGHT_ONOFF
89 #define LIGHT_LC_DEFAULT_LIGHT_ONOFF (0x0)
90 #endif
91 
98 #ifndef LIGHT_LC_DEFAULT_PR_LUXLEVEL_ON
99 #define LIGHT_LC_DEFAULT_PR_LUXLEVEL_ON (75000)
100 #endif
101 
108 #ifndef LIGHT_LC_DEFAULT_PR_LUXLEVEL_PROLONG
109 #define LIGHT_LC_DEFAULT_PR_LUXLEVEL_PROLONG (20000)
110 #endif
111 
118 #ifndef LIGHT_LC_DEFAULT_PR_LUXLEVEL_STANDBY
119 #define LIGHT_LC_DEFAULT_PR_LUXLEVEL_STANDBY (7000)
120 #endif
121 
128 #ifndef LIGHT_LC_DEFAULT_PR_LIGHTNESS_ON
129 #define LIGHT_LC_DEFAULT_PR_LIGHTNESS_ON (0xAFFF)
130 #endif
131 
138 #ifndef LIGHT_LC_DEFAULT_PR_LIGHTNESS_PROLONG
139 #define LIGHT_LC_DEFAULT_PR_LIGHTNESS_PROLONG (0x3FFF)
140 #endif
141 
148 #ifndef LIGHT_LC_DEFAULT_PR_LIGHTNESS_STANDBY
149 #define LIGHT_LC_DEFAULT_PR_LIGHTNESS_STANDBY (0x1000)
150 #endif
151 
158 #ifndef LIGHT_LC_DEFAULT_PR_REGULATOR_ACCURACY
159 #define LIGHT_LC_DEFAULT_PR_REGULATOR_ACCURACY (4)
160 #endif
161 
172 #ifndef LIGHT_LC_DEFAULT_PR_REGULATOR_KIU
173 #define LIGHT_LC_DEFAULT_PR_REGULATOR_KIU (250.0)
174 #endif
175 
186 #ifndef LIGHT_LC_DEFAULT_PR_REGULATOR_KID
187 #define LIGHT_LC_DEFAULT_PR_REGULATOR_KID (25.0)
188 #endif
189 
200 #ifndef LIGHT_LC_DEFAULT_PR_REGULATOR_KPU
201 #define LIGHT_LC_DEFAULT_PR_REGULATOR_KPU (80.0)
202 #endif
203 
214 #ifndef LIGHT_LC_DEFAULT_PR_REGULATOR_KPD
215 #define LIGHT_LC_DEFAULT_PR_REGULATOR_KPD (80.0)
216 #endif
217 
224 #ifndef LIGHT_LC_DEFAULT_PR_TIME_FADE_MS
225 #define LIGHT_LC_DEFAULT_PR_TIME_FADE_MS (4500)
226 #endif
227 
234 #ifndef LIGHT_LC_DEFAULT_PR_TIME_FADE_ON_MS
235 #define LIGHT_LC_DEFAULT_PR_TIME_FADE_ON_MS (2000)
236 #endif
237 
245 #ifndef LIGHT_LC_DEFAULT_PR_TIME_FADE_STANDBY_AUTO_MS
246 #define LIGHT_LC_DEFAULT_PR_TIME_FADE_STANDBY_AUTO_MS (3500)
247 #endif
248 
256 #ifndef LIGHT_LC_DEFAULT_PR_TIME_FADE_STANDBY_MANUAL_MS
257 #define LIGHT_LC_DEFAULT_PR_TIME_FADE_STANDBY_MANUAL_MS (3500)
258 #endif
259 
267 #ifndef LIGHT_LC_DEFAULT_PR_TIME_PROLONG_MS
268 #define LIGHT_LC_DEFAULT_PR_TIME_PROLONG_MS (7000)
269 #endif
270 
278 #ifndef LIGHT_LC_DEFAULT_PR_TIME_RUN_ON_MS
279 #define LIGHT_LC_DEFAULT_PR_TIME_RUN_ON_MS (10000)
280 #endif
281 
289 #ifndef LIGHT_LC_DEFAULT_PR_TIME_OCCUPANCY_DELAY_MS
290 #define LIGHT_LC_DEFAULT_PR_TIME_OCCUPANCY_DELAY_MS (0)
291 #endif
292 
298 #ifndef LIGHT_LC_LIGHT_PI_SUMMATION_INTERVAL_MS
299 #define LIGHT_LC_LIGHT_PI_SUMMATION_INTERVAL_MS (100)
300 #endif
301 
303 #define LIGHT_LC_LIGHT_PI_SUMMATION_INTERVAL_MIN_MS (10)
304 
306 #define LIGHT_LC_LIGHT_PI_SUMMATION_INTERVAL_MAX_MS (100)
307 
318 #ifndef LIGHT_LC_LIGHT_PI_CONVERSION_DIVISOR
319 #define LIGHT_LC_LIGHT_PI_CONVERSION_DIVISOR (50)
320 #endif
321 
325 typedef enum
326 {
327  LIGHT_LC_STATE_NULL_ENTRY,
328  LIGHT_LC_STATE_LIGHT_LC_MODE,
329  LIGHT_LC_STATE_LIGHT_LC_OCC_MODE,
330  LIGHT_LC_STATE_LIGHT_LC_LIGHT_ONOFF,
331  LIGHT_LC_STATE_AMBIENT_LUXLEVEL_ON,
332  LIGHT_LC_STATE_AMBIENT_LUXLEVEL_PROLONG,
333  LIGHT_LC_STATE_AMBIENT_LUXLEVEL_STANDBY,
334  LIGHT_LC_STATE_LIGHTNESS_ON,
335  LIGHT_LC_STATE_LIGHTNESS_PROLONG,
336  LIGHT_LC_STATE_LIGHTNESS_STANDBY,
337  LIGHT_LC_STATE_REGULATOR_ACCURACY,
338  LIGHT_LC_STATE_REGULATOR_KID,
339  LIGHT_LC_STATE_REGULATOR_KIU,
340  LIGHT_LC_STATE_REGULATOR_KPD,
341  LIGHT_LC_STATE_REGULATOR_KPU,
342  LIGHT_LC_STATE_TIME_FADE,
343  LIGHT_LC_STATE_TIME_FADE_ON,
344  LIGHT_LC_STATE_TIME_FADE_STANDBY_AUTO,
345  LIGHT_LC_STATE_TIME_FADE_STANDBY_MANUAL,
346  LIGHT_LC_STATE_TIME_OCCUPANCY_DELAY,
347  LIGHT_LC_STATE_TIME_PROLONG,
348  LIGHT_LC_STATE_TIME_RUN_ON,
350 
351 
358 typedef struct
359 {
360  bool mode;
362 
364 typedef struct
365 {
368 
370 typedef struct
371 {
373  uint8_t tid;
375 
377 typedef struct
378 {
379  uint16_t property_id;
380  /* Although the property value field is a variable size, it is
381  * never bigger than 4 bytes, so we put a 4 byte buffer here to
382  * use */
383  uint8_t property_buffer[LIGHT_LC_PROPERTY_BUF_SIZE];
385 
387 typedef struct
388 {
389  uint16_t property_id;
391 
393 typedef struct
394 {
395  bool mode;
397 
399 typedef struct
400 {
403 
405 typedef struct
406 {
409  uint32_t remaining_time_ms;
411 
413 typedef struct
414 {
415  uint16_t property_id;
416  /* Although the property value field is a variable size, it is
417  * never bigger than 4 bytes, so we put a 4 byte buffer here to
418  * use */
419  uint8_t property_buffer[LIGHT_LC_PROPERTY_BUF_SIZE];
421 
423 #endif /* LC_SERVER_COMMON_H__ */
Parameters for the Light LC Property Status message.
Parameters for the Light LC Light OnOff Status message.
light_lc_state_t
Enum for to determine which state data variable is being set/gotten.
Parameters for the Light LC Occupancy Mode Status message.
Message format for the Light LC Occupancy Mode set message.
bool light_on_off
The target value of the Light LC Light OnOff state.
uint16_t property_id
Property ID identifying a Light LC Property.
Parameters for the Light LC Mode Status message.
Message format for the Light LC Property set message.
bool present_light_onoff
The present value of the Light OnOff state.
bool mode
The present value of the Light LC Mode state.
bool target_light_onoff
The target value of the Light OnOff state.
uint16_t property_id
Property ID identifying a Light LC Property.
Unpacked message structure typedefs are used for API interfaces and for implementing model code...
Message format for the Light LC Property get message.
bool occupancy_mode
The present value of the Occupancy Mode state.
bool mode
The target value of the Mode state.
uint16_t property_id
Property ID identifying a Light LC Property.
uint32_t remaining_time_ms
Remaining transition time - encoded.
bool occupancy_mode
The target value of the Occupancy Mode state.
#define LIGHT_LC_PROPERTY_BUF_SIZE
Property size definitions.
Message format for the Light LC Light OnOff set message.

Documentation feedback | Developer Zone | Subscribe | Updated