1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #define STATE_OFF	0x00
8 #define STATE_ON	0x01
9 #define STATE_DEFAULT	0x01
10 #define STATE_RESTORE	0x02
11 
12 /* Model Operation Codes */
13 #define BT_MESH_MODEL_OP_GEN_ONOFF_GET		BT_MESH_MODEL_OP_2(0x82, 0x01)
14 #define BT_MESH_MODEL_OP_GEN_ONOFF_SET		BT_MESH_MODEL_OP_2(0x82, 0x02)
15 #define BT_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK	BT_MESH_MODEL_OP_2(0x82, 0x03)
16 #define BT_MESH_MODEL_OP_GEN_ONOFF_STATUS	BT_MESH_MODEL_OP_2(0x82, 0x04)
17 
18 #define BT_MESH_MODEL_OP_SENS_DESC_GET		BT_MESH_MODEL_OP_2(0x82, 0x30)
19 #define BT_MESH_MODEL_OP_SENS_GET		BT_MESH_MODEL_OP_2(0x82, 0x31)
20 #define BT_MESH_MODEL_OP_SENS_COL_GET		BT_MESH_MODEL_OP_2(0x82, 0x32)
21 #define BT_MESH_MODEL_OP_SENS_SERIES_GET	BT_MESH_MODEL_OP_2(0x82, 0x33)
22 
23 #define BT_MESH_MODEL_OP_SENS_DESC_STATUS	BT_MESH_MODEL_OP_1(0x51)
24 #define BT_MESH_MODEL_OP_SENS_STATUS		BT_MESH_MODEL_OP_1(0x52)
25 
26 struct led_onoff_state {
27 	uint8_t current;
28 	uint8_t previous;
29 	uint8_t dev_id;
30 
31 	uint8_t last_tid;
32 	uint16_t last_tx_addr;
33 	int64_t last_msg_timestamp;
34 };
35 
36 void mesh_send_hello(void);
37 void mesh_send_baduser(void);
38 
39 uint16_t mesh_get_addr(void);
40 bool mesh_is_initialized(void);
41 void mesh_start(void);
42 int mesh_init(void);
43