forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbtp_l2cap.h
132 lines (112 loc) · 2.82 KB
/
btp_l2cap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* l2cap.h - Bluetooth tester headers */
/*
* Copyright (c) 2015-2016 Intel Corporation
* Copyright (c) 2022 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <zephyr/bluetooth/addr.h>
/* L2CAP Service */
/* commands */
#define BTP_L2CAP_READ_SUPPORTED_COMMANDS 0x01
struct btp_l2cap_read_supported_commands_rp {
uint8_t data[0];
} __packed;
#define BTP_L2CAP_CONNECT_OPT_ECFC 0x01
#define BTP_L2CAP_CONNECT_OPT_HOLD_CREDIT 0x02
#define BTP_L2CAP_CONNECT 0x02
struct btp_l2cap_connect_cmd {
bt_addr_le_t address;
uint16_t psm;
uint16_t mtu;
uint8_t num;
uint8_t options;
} __packed;
struct btp_l2cap_connect_rp {
uint8_t num;
uint8_t chan_id[];
} __packed;
#define BTP_L2CAP_DISCONNECT 0x03
struct btp_l2cap_disconnect_cmd {
uint8_t chan_id;
} __packed;
#define BTP_L2CAP_SEND_DATA 0x04
struct btp_l2cap_send_data_cmd {
uint8_t chan_id;
uint16_t data_len;
uint8_t data[];
} __packed;
#define BTP_L2CAP_TRANSPORT_BREDR 0x00
#define BTP_L2CAP_TRANSPORT_LE 0x01
#define BTP_L2CAP_CONNECTION_RESPONSE_SUCCESS 0x00
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHEN 0x01
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHOR 0x02
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENC_KEY 0x03
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENCRYPTION 0x04
#define BTP_L2CAP_LISTEN 0x05
struct btp_l2cap_listen_cmd {
uint16_t psm;
uint8_t transport;
uint16_t mtu;
uint16_t response;
} __packed;
#define BTP_L2CAP_ACCEPT_CONNECTION 0x06
struct btp_l2cap_accept_connection_cmd {
uint8_t chan_id;
uint16_t result;
} __packed;
#define BTP_L2CAP_RECONFIGURE 0x07
struct btp_l2cap_reconfigure_cmd {
bt_addr_le_t address;
uint16_t mtu;
uint8_t num;
uint8_t chan_id[];
} __packed;
#define BTP_L2CAP_CREDITS 0x08
struct btp_l2cap_credits_cmd {
uint8_t chan_id;
} __packed;
#define BTP_L2CAP_DISCONNECT_EATT_CHANS 0x09
struct btp_l2cap_disconnect_eatt_chans_cmd {
bt_addr_le_t address;
uint8_t count;
} __packed;
/* events */
#define BTP_L2CAP_EV_CONNECTION_REQ 0x80
struct btp_l2cap_connection_req_ev {
uint8_t chan_id;
uint16_t psm;
bt_addr_le_t address;
} __packed;
#define BTP_L2CAP_EV_CONNECTED 0x81
struct btp_l2cap_connected_ev {
uint8_t chan_id;
uint16_t psm;
uint16_t mtu_remote;
uint16_t mps_remote;
uint16_t mtu_local;
uint16_t mps_local;
bt_addr_le_t address;
} __packed;
#define BTP_L2CAP_EV_DISCONNECTED 0x82
struct btp_l2cap_disconnected_ev {
uint16_t result;
uint8_t chan_id;
uint16_t psm;
bt_addr_le_t address;
} __packed;
#define BTP_L2CAP_EV_DATA_RECEIVED 0x83
struct btp_l2cap_data_received_ev {
uint8_t chan_id;
uint16_t data_length;
uint8_t data[];
} __packed;
#define BTP_L2CAP_EV_RECONFIGURED 0x84
struct btp_l2cap_reconfigured_ev {
uint8_t chan_id;
uint16_t mtu_remote;
uint16_t mps_remote;
uint16_t mtu_local;
uint16_t mps_local;
} __packed;