1 #ifndef __SIG_MODEL_H__
2 #define __SIG_MODEL_H__
3 
4 #define ATTR_TYPE_GENERIC_ONOFF 0x0100
5 #define ATTR_TYPE_LIGHTNESS 0x0121
6 #define ATTR_TYPE_COLOR_TEMPERATURE 0x0122
7 #define ATTR_TYPE_SENCE 0xF004
8 
9 typedef enum
10 {
11     TYPE_PRESENT = 0,
12     TYPE_TARGET,
13     TYPE_NUM,
14 } E_VALUE_TYPE;
15 
16 typedef struct
17 {
18 #ifdef CONFIG_MESH_MODEL_GEN_ONOFF_SRV
19     u8_t onoff[TYPE_NUM];
20 #endif
21 
22 #ifdef CONFIG_MESH_MODEL_LIGHTNESS_SRV
23     u16_t lightness[TYPE_NUM];
24 #endif
25 
26 #ifdef CONFIG_MESH_MODEL_CTL_SRV
27     u16_t color_temperature[TYPE_NUM];
28 #endif
29 
30 #ifdef CONFIG_MESH_MODEL_SCENE_SRV
31     u16_t scene[TYPE_NUM];
32 #endif
33 
34     u8_t delay; //unit:5ms
35     struct k_timer delay_timer;
36 #ifdef CONFIG_MESH_MODEL_TRANS
37     u8_t trans; //unit:100ms
38 
39     bt_u32_t trans_start_time;
40     bt_u32_t trans_end_time;
41 
42     struct k_timer trans_timer;
43 #endif
44 } sig_model_state_t;
45 
46 typedef struct
47 {
48 #ifdef CONFIG_MESH_MODEL_GEN_ONOFF_SRV
49     u8_t last_onoff;
50 #endif
51 #ifdef CONFIG_MESH_MODEL_LIGHTNESS_SRV
52     u16_t last_lightness;
53 #endif
54 #ifdef CONFIG_MESH_MODEL_CTL_SRV
55     u16_t last_color_temperature;
56 #endif
57 #ifdef CONFIG_MESH_MODEL_SCENE_SRV
58     u16_t last_scene;
59 #endif
60 } __packed sig_model_powerup_t;
61 
62 typedef struct
63 {
64     u8_t element_id;
65     sig_model_state_t state;
66     sig_model_powerup_t powerup;
67     void *user_data;
68 } sig_model_element_state_t;
69 
70 #ifdef CONFIG_MESH_MODEL_GEN_ONOFF_SRV
71 #include "sig_model_onoff_srv.h"
72 #include "sig_model_bind_ops.h"
73 #endif
74 #ifdef CONFIG_MESH_MODEL_LIGHTNESS_SRV
75 #include "sig_model_lightness_srv.h"
76 #endif
77 #ifdef CONFIG_MESH_MODEL_CTL_SRV
78 #include "sig_model_light_ctl_srv.h"
79 #endif
80 
81 #ifdef CONFIG_MESH_MODEL_SCENE_SRV
82 #include "sig_model_scene.h"
83 #endif
84 
85 #include "sig_model_transition.h"
86 #include "sig_model_opcode.h"
87 #include "sig_model_event.h"
88 
89 #endif
90