1 // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef _BTC_BLE_MESH_CONFIG_MODEL_H_
16 #define _BTC_BLE_MESH_CONFIG_MODEL_H_
17 
18 #include "btc/btc_manage.h"
19 #include "esp_ble_mesh_config_model_api.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 typedef enum {
26     BTC_BLE_MESH_ACT_CONFIG_CLIENT_GET_STATE,
27     BTC_BLE_MESH_ACT_CONFIG_CLIENT_SET_STATE,
28     BTC_BLE_MESH_ACT_CONFIG_CLIENT_MAX,
29 } btc_ble_mesh_config_client_act_t;
30 
31 typedef union {
32     struct ble_mesh_cfg_client_get_state_reg_args {
33         esp_ble_mesh_client_common_param_t *params;
34         esp_ble_mesh_cfg_client_get_state_t *get_state;
35     } cfg_client_get_state;
36     struct ble_mesh_cfg_client_set_state_reg_args {
37         esp_ble_mesh_client_common_param_t *params;
38         esp_ble_mesh_cfg_client_set_state_t *set_state;
39     } cfg_client_set_state;
40 } btc_ble_mesh_config_client_args_t;
41 
42 typedef enum {
43     BTC_BLE_MESH_EVT_CONFIG_CLIENT_GET_STATE,
44     BTC_BLE_MESH_EVT_CONFIG_CLIENT_SET_STATE,
45     BTC_BLE_MESH_EVT_CONFIG_CLIENT_PUBLISH,
46     BTC_BLE_MESH_EVT_CONFIG_CLIENT_TIMEOUT,
47     BTC_BLE_MESH_EVT_CONFIG_CLIENT_MAX,
48 } btc_ble_mesh_config_client_evt_t;
49 
50 void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg);
51 
52 void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg);
53 
54 void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
55 
56 void btc_ble_mesh_config_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
57                                                  struct bt_mesh_msg_ctx *ctx,
58                                                  struct net_buf_simple *buf);
59 
60 void bt_mesh_config_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
61                                          struct bt_mesh_model *model,
62                                          struct bt_mesh_msg_ctx *ctx,
63                                          const uint8_t *val, size_t len);
64 
65 void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg);
66 
67 typedef enum {
68     BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
69     BTC_BLE_MESH_EVT_CONFIG_SERVER_MAX,
70 } btc_ble_mesh_config_server_evt_t;
71 
72 void bt_mesh_config_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
73                                          struct bt_mesh_msg_ctx *ctx,
74                                          const uint8_t *val, size_t len);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif /* _BTC_BLE_MESH_CONFIG_MODEL_H_ */
81