1 /*
2  * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __BTC_L2CAP_H__
8 #define __BTC_L2CAP_H__
9 
10 #include "btc/btc_task.h"
11 #include "esp_bt_defs.h"
12 #include "esp_l2cap_bt_api.h"
13 #include "common/bt_target.h"
14 #include "bta/bta_jv_api.h"
15 
16 #if (defined BTC_L2CAP_INCLUDED && BTC_L2CAP_INCLUDED == TRUE)
17 
18 #define BTC_L2CAP_INVALID_PSM 0x00
19 
20 typedef enum {
21     BTC_L2CAP_ACT_INIT = 0,
22     BTC_L2CAP_ACT_UNINIT,
23     BTC_L2CAP_ACT_START_DISCOVERY,
24     BTC_L2CAP_ACT_CONNECT,
25     BTC_L2CAP_ACT_START_SRV,
26     BTC_L2CAP_ACT_STOP_SRV,
27 } btc_l2cap_act_t;
28 
29 /* btc_l2cap_args_t */
30 typedef union {
31     //BTC_L2CAP_ACT_INIT
32     struct l2cap_init_arg {
33     } init;
34 
35     //BTC_L2CAP_ACT_UNINIT
36     struct l2cap_uninit_arg {
37     } uninit;
38 
39     //BTC_L2CAP_ACT_START_DISCOVERY
40     struct l2cap_start_discovery_arg {
41         BD_ADDR bd_addr;
42         UINT16 num_uuid;
43         tSDP_UUID *p_uuid_list;
44     } start_discovery;
45 
46     //BTC_L2CAP_ACT_CONNECT
47     struct l2cap_connect_arg {
48         UINT16 sec_mask;
49         UINT16 remote_psm;
50         esp_bd_addr_t peer_bd_addr;
51     } connect;
52 
53     //BTC_L2CAP_ACT_START_SRV
54     struct l2cap_start_srv_arg {
55         UINT16 sec_mask;
56         UINT16 local_psm;
57     } start_srv;
58 
59     //BTC_L2CAP_ACT_STOP_SRV
60     struct l2cap_stop_srv_arg {
61         UINT16 psm;
62     } stop_srv;
63 
64 } btc_l2cap_args_t;
65 
66 void btc_l2cap_call_handler(btc_msg_t *msg);
67 void btc_l2cap_cb_handler(btc_msg_t *msg);
68 esp_err_t btc_l2cap_vfs_register(void);
69 esp_err_t btc_l2cap_vfs_unregister(void);
70 
71 #endif ///defined BTC_L2CAP_INCLUDED && BTC_L2CAP_INCLUDED == TRUE
72 #endif ///__BTC_L2CAP_H__
73