1 /* Mesh Internal Communication Example
2 
3    This example code is in the Public Domain (or CC0 licensed, at your option.)
4 
5    Unless required by applicable law or agreed to in writing, this
6    software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7    CONDITIONS OF ANY KIND, either express or implied.
8 */
9 
10 #ifndef __MESH_LIGHT_H__
11 #define __MESH_LIGHT_H__
12 
13 #include "esp_err.h"
14 
15 /*******************************************************
16  *                Constants
17  *******************************************************/
18 #define MESH_LIGHT_RED       (0xff)
19 #define MESH_LIGHT_GREEN     (0xfe)
20 #define MESH_LIGHT_BLUE      (0xfd)
21 #define MESH_LIGHT_YELLOW    (0xfc)
22 #define MESH_LIGHT_PINK      (0xfb)
23 #define MESH_LIGHT_INIT      (0xfa)
24 #define MESH_LIGHT_WARNING   (0xf9)
25 
26 #define  MESH_TOKEN_ID       (0x0)
27 #define  MESH_TOKEN_VALUE    (0xbeef)
28 #define  MESH_CONTROL_CMD    (0x2)
29 
30 /*******************************************************
31  *                Type Definitions
32  *******************************************************/
33 
34 /*******************************************************
35  *                Structures
36  *******************************************************/
37 typedef struct {
38     uint8_t cmd;
39     bool on;
40     uint8_t token_id;
41     uint16_t token_value;
42 } mesh_light_ctl_t;
43 
44 /*******************************************************
45  *                Variables Declarations
46  *******************************************************/
47 
48 /*******************************************************
49  *                Function Definitions
50  *******************************************************/
51 esp_err_t mesh_light_init(void);
52 esp_err_t mesh_light_set(int color);
53 esp_err_t mesh_light_process(mesh_addr_t *from, uint8_t *buf, uint16_t len);
54 void mesh_connected_indicator(int layer);
55 void mesh_disconnected_indicator(void);
56 
57 #endif /* __MESH_LIGHT_H__ */
58