1 /*
2  * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _BTC_BLE_MESH_CONFIG_MODEL_H_
8 #define _BTC_BLE_MESH_CONFIG_MODEL_H_
9 
10 #include "btc/btc_manage.h"
11 #include "esp_ble_mesh_config_model_api.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 typedef enum {
18     BTC_BLE_MESH_ACT_CONFIG_CLIENT_GET_STATE,
19     BTC_BLE_MESH_ACT_CONFIG_CLIENT_SET_STATE,
20     BTC_BLE_MESH_ACT_CONFIG_CLIENT_MAX,
21 } btc_ble_mesh_config_client_act_t;
22 
23 typedef union {
24     struct ble_mesh_cfg_client_get_state_reg_args {
25         esp_ble_mesh_client_common_param_t *params;
26         esp_ble_mesh_cfg_client_get_state_t *get_state;
27     } cfg_client_get_state;
28     struct ble_mesh_cfg_client_set_state_reg_args {
29         esp_ble_mesh_client_common_param_t *params;
30         esp_ble_mesh_cfg_client_set_state_t *set_state;
31     } cfg_client_set_state;
32 } btc_ble_mesh_config_client_args_t;
33 
34 typedef enum {
35     BTC_BLE_MESH_EVT_CONFIG_CLIENT_GET_STATE,
36     BTC_BLE_MESH_EVT_CONFIG_CLIENT_SET_STATE,
37     BTC_BLE_MESH_EVT_CONFIG_CLIENT_PUBLISH,
38     BTC_BLE_MESH_EVT_CONFIG_CLIENT_TIMEOUT,
39     BTC_BLE_MESH_EVT_CONFIG_CLIENT_MAX,
40 } btc_ble_mesh_config_client_evt_t;
41 
42 void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg);
43 
44 void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg);
45 
46 void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
47 
48 void btc_ble_mesh_config_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
49                                                  struct bt_mesh_msg_ctx *ctx,
50                                                  struct net_buf_simple *buf);
51 
52 void bt_mesh_config_client_cb_evt_to_btc(uint32_t opcode, uint8_t evt_type,
53                                          struct bt_mesh_model *model,
54                                          struct bt_mesh_msg_ctx *ctx,
55                                          const uint8_t *val, size_t len);
56 
57 void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg);
58 
59 typedef enum {
60     BTC_BLE_MESH_EVT_CONFIG_SERVER_STATE_CHANGE,
61     BTC_BLE_MESH_EVT_CONFIG_SERVER_MAX,
62 } btc_ble_mesh_config_server_evt_t;
63 
64 void bt_mesh_config_server_cb_evt_to_btc(uint8_t evt_type, struct bt_mesh_model *model,
65                                          struct bt_mesh_msg_ctx *ctx,
66                                          const uint8_t *val, size_t len);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* _BTC_BLE_MESH_CONFIG_MODEL_H_ */
73