nRF5 SDK for Mesh v5.0.0
light_ctl_setup_server.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 LIGHT_CTL_SETUP_SERVER_H__
39 #define LIGHT_CTL_SETUP_SERVER_H__
40 
41 #include <stdint.h>
42 #include "access.h"
43 #include "light_ctl_common.h"
44 #include "model_common.h"
45 
46 #include "light_lightness_setup_server.h"
47 
48 #include "generic_ponoff_setup_server.h"
49 #include "generic_level_server.h"
50 
66 #define LIGHT_CTL_SERVER_MODEL_ID (0x1303)
67 
69 #define LIGHT_CTL_SETUP_SERVER_MODEL_ID (0x1304)
70 
72 #define LIGHT_CTL_TEMPERATURE_SERVER_MODEL_ID (0x1306)
73 
75 typedef struct __light_ctl_server_t light_ctl_server_t;
76 
77 /* Forward declaration for @ref __light_ctl_setup_server_t */
78 typedef struct __light_ctl_setup_server_t light_ctl_setup_server_t;
79 
80 /* Forward declaration for @ref __light_ctl_temperature_server_t */
81 typedef struct __light_ctl_temperature_server_t light_ctl_temperature_server_t;
82 
95 typedef void (*light_ctl_state_set_cb_t)(const light_ctl_setup_server_t * p_self,
96  const access_message_rx_meta_t * p_meta,
97  const light_ctl_set_params_t * p_in,
98  const model_transition_t * p_in_transition,
100 
108 typedef void (*light_ctl_state_get_cb_t)(const light_ctl_setup_server_t * p_self,
109  const access_message_rx_meta_t * p_meta,
110  light_ctl_status_params_t * p_out);
111 
124 typedef void (*light_ctl_state_temperature32_set_cb_t)(const light_ctl_setup_server_t * p_self,
125  const access_message_rx_meta_t * p_meta,
127  const model_transition_t * p_in_transition,
129 
137 typedef void (*light_ctl_state_temperature32_get_cb_t)(const light_ctl_setup_server_t * p_self,
138  const access_message_rx_meta_t * p_meta,
140 
151 typedef void (*light_ctl_state_temperature32_range_set_cb_t)(const light_ctl_setup_server_t * p_self,
152  const access_message_rx_meta_t * p_meta,
155 
163 typedef void (*light_ctl_state_temperature32_range_get_cb_t)(const light_ctl_setup_server_t * p_self,
164  const access_message_rx_meta_t * p_meta,
166 
177 typedef void (*light_ctl_state_default_set_cb_t)(const light_ctl_setup_server_t * p_self,
178  const access_message_rx_meta_t * p_meta,
179  const light_ctl_default_set_params_t * p_in,
181 
189 typedef void (*light_ctl_state_default_get_cb_t)(const light_ctl_setup_server_t * p_self,
190  const access_message_rx_meta_t * p_meta,
192 
193 
209 typedef void (*light_ctl_state_move_set_cb_t)(const light_ctl_setup_server_t * p_self,
210  const access_message_rx_meta_t * p_meta,
212  const model_transition_t * p_in_transition,
214 
230 typedef void (*light_ctl_state_delta_set_cb_t)(const light_ctl_setup_server_t * p_self,
231  const access_message_rx_meta_t * p_meta,
233  const model_transition_t * p_in_transition,
235 
239 typedef struct
240 {
243  light_ctl_state_temperature32_set_cb_t temperature32_set_cb;
244  light_ctl_state_temperature32_get_cb_t temperature32_get_cb;
245  light_ctl_state_temperature32_range_set_cb_t temperature32_range_set_cb;
246  light_ctl_state_temperature32_range_get_cb_t temperature32_range_get_cb;
247  light_ctl_state_default_set_cb_t default_set_cb;
248  light_ctl_state_default_get_cb_t default_get_cb;
249  light_ctl_state_move_set_cb_t move_set_cb;
250  light_ctl_state_delta_set_cb_t delta_set_cb;
252 
256 typedef struct
257 {
264 
265  /* There are no callbacks for the state for this model, these
266  * callbacks are defined for the setup server. */
268 
271 {
274 
277 
280 };
281 
302 uint32_t light_ctl_server_status_publish(const light_ctl_server_t * p_server,
303  const light_ctl_status_params_t * p_params);
304 
325 uint32_t light_ctl_server_temperature_status_publish(const light_ctl_temperature_server_t * p_server,
326  const light_ctl_temperature_status_params_t * p_params);
327 
348 uint32_t light_ctl_server_temperature_range_status_publish(const light_ctl_server_t * p_server,
350 
371 uint32_t light_ctl_server_default_status_publish(const light_ctl_server_t * p_server,
372  const light_ctl_default_status_params_t * p_params);
373 
377 typedef struct
378 {
385 
386  /* There are no callbacks for the state for this model, these
387  * callbacks are defined for the setup server. */
389 
392 {
395 
397  generic_level_server_t generic_level_srv;
398 
401 
404 };
405 
409 typedef struct
410 {
414 
418 typedef struct
419 {
421  uint8_t element_index;
428 
432 
434 typedef struct
435 {
437  uint8_t handle;
441 
442 
445 {
448 
450  light_ctl_server_t ctl_srv;
451 
453  light_ctl_temperature_server_t ctl_temperature_srv;
454 
457 
460 };
461 
492 uint32_t light_ctl_setup_server_init(light_ctl_setup_server_t * p_s_server,
493  light_lightness_setup_server_t * p_ll_s_server,
494  uint8_t element_index);
495 
510 uint32_t light_ctl_ponoff_binding_setup(light_ctl_setup_server_t * p_s_server,
511  light_ctl_saved_values_t * p_saved_values);
512 
514 #endif /* LIGHT_CTL_SETUP_SERVER_H__ */
access_model_handle_t model_handle
Model handle assigned to this instance.
nrf_mesh_transmic_size_t transmic_size
TransMIC size used by the outgoing server messages.
generic_level_server_t generic_level_srv
Parent model context for - Level server.
void(* light_ctl_state_temperature32_get_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_ctl_temperature_status_params_t *p_out)
Callback type for Light CTL Temperature Get message.
uint16_t access_model_handle_t
Access layer handle type.
Definition: access.h:162
Internal structure to hold state information.
void(* light_ctl_state_move_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_temperature_move_set_params_t *p_in, const model_transition_t *p_in_transition, light_ctl_temperature_status_params_t *p_out)
Callback type for the Light CTL move Set/Set Unacknowledged "message".
void(* light_ctl_state_default_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_default_set_params_t *p_in, light_ctl_default_status_params_t *p_out)
Callback type for the Light CTL Default Set/Set Unacknowledged message.
uint32_t light_ctl_server_status_publish(const light_ctl_server_t *p_server, const light_ctl_status_params_t *p_params)
Publishes unsolicited Status message.
Message format for the Light CTL Temperature Move Set "message".
User provided settings and callbacks for the Light CTL Setup Server model instance.
light_ctl_setup_server_state_cbs_t light_ctl_cbs
Transaction callbacks for the Light CTL states.
Structure for tracking TID expiry for the models.
Definition: model_common.h:169
access_model_handle_t model_handle
Model handle assigned to this instance.
Parameters for the Light CTL Default Status message.
void(* light_ctl_state_temperature32_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_temperature_set_params_t *p_in, const model_transition_t *p_in_transition, light_ctl_temperature_status_params_t *p_out)
Callback type for the Light CTL Temperature Set/Set Unacknowledged message.
void(* light_ctl_state_delta_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_temperature_delta_set_params_t *p_in, const model_transition_t *p_in_transition, light_ctl_temperature_status_params_t *p_out)
Callback type for the Light CTL delta Set/Set Unacknowledged "message".
uint32_t light_ctl_server_temperature_range_status_publish(const light_ctl_server_t *p_server, const light_ctl_temperature_range_status_params_t *p_params)
Publishes unsolicited Status message.
Light CTL server callback list.
bool force_segmented
If server should force outgoing messages as segmented messages.
nrf_mesh_transmic_size_t transmic_size
TransMIC size used by the outgoing server messages.
uint32_t light_ctl_ponoff_binding_setup(light_ctl_setup_server_t *p_s_server, light_ctl_saved_values_t *p_saved_values)
Function to do the OnPowerup binding.
Forward declaration for __light_ctl_server_t.
uint8_t handle
Flash handle - only used by flash system.
Message format for the CTL Temperature Set message.
light_ctl_temperature_server_t ctl_temperature_srv
Parent model context for - CTL Temperature server.
light_ctl_server_t ctl_srv
Parent model context for - CTL server.
light_ctl_setup_server_settings_t settings
Model settings and callbacks for this instance.
uint32_t light_ctl_server_default_status_publish(const light_ctl_server_t *p_server, const light_ctl_default_status_params_t *p_params)
Publishes unsolicited Status message.
Storage format for model states while booting - the stored values will be read and passed to the mode...
void(* light_ctl_state_get_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_ctl_status_params_t *p_out)
Callback type for the Light CTL Get message.
access_model_handle_t model_handle
Model handle assigned to this instance.
void(* light_ctl_state_temperature32_range_get_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_ctl_temperature_range_status_params_t *p_out)
Callback type for the Light CTL Temperature Range Get message.
bool force_segmented
If server should force outgoing messages as segmented messages.
light_ctl_state_t state
State for this instance.
Metadata for received messages.
Definition: access.h:196
bool force_segmented
If server should force outgoing messages as segmented messages.
uint32_t light_ctl_setup_server_init(light_ctl_setup_server_t *p_s_server, light_lightness_setup_server_t *p_ll_s_server, uint8_t element_index)
Initializes the Light CTL Setup server.
Transaction callbacks for the Light CTL states.
User provided settings and callbacks for the CTL temperature model instance.
tid_tracker_t tid_tracker
Tid tracker structure.
nrf_mesh_transmic_size_t
Message MIC size selection.
Definition: nrf_mesh.h:385
uint32_t light_ctl_server_temperature_status_publish(const light_ctl_temperature_server_t *p_server, const light_ctl_temperature_status_params_t *p_params)
Publishes unsolicited Status message.
void(* light_ctl_state_temperature32_range_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_temperature_range_set_params_t *p_in, light_ctl_temperature_range_status_params_t *p_out)
Callback type for the Light CTL Temperature Range Set/Set Unacknowledged message. ...
Message format for the CTL Default Set message.
light_ctl_temperature_server_settings_t settings
Settings and callbacks for this instance.
const light_ctl_setup_server_callbacks_t * p_callbacks
Callback list.
Message format for the CTL delta set "message".
Parameters for the Light CTL Temperature Status message.
void(* light_ctl_state_set_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, const light_ctl_set_params_t *p_in, const model_transition_t *p_in_transition, light_ctl_status_params_t *p_out)
Callback type for the Light CTL Set/Set Unacknowledged message.
Parameters for the Light CTL Status message.
Message format for the CTL Temperature Range Set message.
bool initialized
To keep track if values has been loaded from flash or not.
light_ctl_server_settings_t settings
Settings and callbacks for this instance.
nrf_mesh_transmic_size_t transmic_size
TransMIC size used by the outgoing server messages.
Parameters for the Light CTL Temperature Range Status message.
void(* light_ctl_state_default_get_cb_t)(const light_ctl_setup_server_t *p_self, const access_message_rx_meta_t *p_meta, light_ctl_default_status_params_t *p_out)
Callback type for the Light CTL Default Get message.
Generic Transition parameters for the model messages.
Definition: model_common.h:162
tid_tracker_t tid_tracker
Tid tracker structure.
User provided settings and callbacks for the Light CTL server model instance.
Unpacked message structure typedefs are used for API interfaces and for implementing model code...

Documentation feedback | Developer Zone | Subscribe | Updated