23#include "nimble/nimble/include/nimble/nimble_opt.h"
28struct ble_l2cap_sig_update_req;
31#define BLE_L2CAP_CID_ATT 4
32#define BLE_L2CAP_CID_SIG 5
33#define BLE_L2CAP_CID_SM 6
35#define BLE_L2CAP_SIG_OP_REJECT 0x01
36#define BLE_L2CAP_SIG_OP_CONNECT_REQ 0x02
37#define BLE_L2CAP_SIG_OP_CONNECT_RSP 0x03
38#define BLE_L2CAP_SIG_OP_CONFIG_REQ 0x04
39#define BLE_L2CAP_SIG_OP_CONFIG_RSP 0x05
40#define BLE_L2CAP_SIG_OP_DISCONN_REQ 0x06
41#define BLE_L2CAP_SIG_OP_DISCONN_RSP 0x07
42#define BLE_L2CAP_SIG_OP_ECHO_REQ 0x08
43#define BLE_L2CAP_SIG_OP_ECHO_RSP 0x09
44#define BLE_L2CAP_SIG_OP_INFO_REQ 0x0a
45#define BLE_L2CAP_SIG_OP_INFO_RSP 0x0b
46#define BLE_L2CAP_SIG_OP_CREATE_CHAN_REQ 0x0c
47#define BLE_L2CAP_SIG_OP_CREATE_CHAN_RSP 0x0d
48#define BLE_L2CAP_SIG_OP_MOVE_CHAN_REQ 0x0e
49#define BLE_L2CAP_SIG_OP_MOVE_CHAN_RSP 0x0f
50#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_REQ 0x10
51#define BLE_L2CAP_SIG_OP_MOVE_CHAN_CONF_RSP 0x11
52#define BLE_L2CAP_SIG_OP_UPDATE_REQ 0x12
53#define BLE_L2CAP_SIG_OP_UPDATE_RSP 0x13
54#define BLE_L2CAP_SIG_OP_LE_CREDIT_CONNECT_REQ 0x14
55#define BLE_L2CAP_SIG_OP_LE_CREDIT_CONNECT_RSP 0x15
56#define BLE_L2CAP_SIG_OP_FLOW_CTRL_CREDIT 0x16
57#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_REQ 0x17
58#define BLE_L2CAP_SIG_OP_CREDIT_CONNECT_RSP 0x18
59#define BLE_L2CAP_SIG_OP_CREDIT_RECONFIG_REQ 0x19
60#define BLE_L2CAP_SIG_OP_CREDIT_RECONFIG_RSP 0x1A
61#define BLE_L2CAP_SIG_OP_MAX 0x1B
63#define BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD 0x0000
64#define BLE_L2CAP_SIG_ERR_MTU_EXCEEDED 0x0001
65#define BLE_L2CAP_SIG_ERR_INVALID_CID 0x0002
67#define BLE_L2CAP_COC_ERR_CONNECTION_SUCCESS 0x0000
68#define BLE_L2CAP_COC_ERR_UNKNOWN_LE_PSM 0x0002
69#define BLE_L2CAP_COC_ERR_NO_RESOURCES 0x0004
70#define BLE_L2CAP_COC_ERR_INSUFFICIENT_AUTHEN 0x0005
71#define BLE_L2CAP_COC_ERR_INSUFFICIENT_AUTHOR 0x0006
72#define BLE_L2CAP_COC_ERR_INSUFFICIENT_KEY_SZ 0x0007
73#define BLE_L2CAP_COC_ERR_INSUFFICIENT_ENC 0x0008
74#define BLE_L2CAP_COC_ERR_INVALID_SOURCE_CID 0x0009
75#define BLE_L2CAP_COC_ERR_SOURCE_CID_ALREADY_USED 0x000A
76#define BLE_L2CAP_COC_ERR_UNACCEPTABLE_PARAMETERS 0x000B
77#define BLE_L2CAP_COC_ERR_INVALID_PARAMETERS 0x000C
79#define BLE_L2CAP_ERR_RECONFIG_SUCCEED 0x0000
80#define BLE_L2CAP_ERR_RECONFIG_REDUCTION_MTU_NOT_ALLOWED 0x0001
81#define BLE_L2CAP_ERR_RECONFIG_REDUCTION_MPS_NOT_ALLOWED 0x0002
82#define BLE_L2CAP_ERR_RECONFIG_INVALID_DCID 0x0003
83#define BLE_L2CAP_ERR_RECONFIG_UNACCAPTED_PARAM 0x0004
85#define BLE_L2CAP_EVENT_COC_CONNECTED 0
86#define BLE_L2CAP_EVENT_COC_DISCONNECTED 1
87#define BLE_L2CAP_EVENT_COC_ACCEPT 2
88#define BLE_L2CAP_EVENT_COC_DATA_RECEIVED 3
89#define BLE_L2CAP_EVENT_COC_TX_UNSTALLED 4
90#define BLE_L2CAP_EVENT_COC_RECONFIG_COMPLETED 5
91#define BLE_L2CAP_EVENT_COC_PEER_RECONFIGURED 6
93typedef void ble_l2cap_sig_update_fn(uint16_t conn_handle,
int status,
96struct ble_l2cap_sig_update_params {
99 uint16_t slave_latency;
100 uint16_t timeout_multiplier;
103int ble_l2cap_sig_update(uint16_t conn_handle,
104 struct ble_l2cap_sig_update_params *params,
105 ble_l2cap_sig_update_fn *cb,
void *cb_arg);
107struct ble_l2cap_chan;
153 uint16_t conn_handle;
156 struct ble_l2cap_chan *chan;
166 uint16_t conn_handle;
172 struct ble_l2cap_chan *chan;
182 uint16_t conn_handle;
185 struct ble_l2cap_chan *chan;
198 uint16_t conn_handle;
201 struct ble_l2cap_chan *chan;
229 uint16_t conn_handle;
232 struct ble_l2cap_chan *chan;
237struct ble_l2cap_chan_info {
240 uint16_t our_l2cap_mtu;
241 uint16_t peer_l2cap_mtu;
243 uint16_t our_coc_mtu;
244 uint16_t peer_coc_mtu;
247typedef int ble_l2cap_event_fn(
struct ble_l2cap_event *event,
void *arg);
250uint16_t ble_l2cap_get_conn_handle(
struct ble_l2cap_chan *chan);
251int ble_l2cap_create_server(uint16_t psm, uint16_t mtu,
252 ble_l2cap_event_fn *cb,
void *cb_arg);
254int ble_l2cap_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
256 ble_l2cap_event_fn *cb,
void *cb_arg);
257int ble_l2cap_disconnect(
struct ble_l2cap_chan *chan);
258int ble_l2cap_send(
struct ble_l2cap_chan *chan,
struct os_mbuf *sdu_tx);
259int ble_l2cap_recv_ready(
struct ble_l2cap_chan *chan,
struct os_mbuf *sdu_rx);
260int ble_l2cap_get_chan_info(
struct ble_l2cap_chan *chan,
struct ble_l2cap_chan_info *chan_info);
Definition ble_l2cap.h:114
int status
Definition ble_l2cap.h:137
struct ble_l2cap_event::@34::@41 reconfigured
uint16_t peer_sdu_size
Definition ble_l2cap.h:169
struct ble_l2cap_event::@34::@40 tx_unstalled
struct ble_l2cap_chan * chan
Definition ble_l2cap.h:143
uint16_t conn_handle
Definition ble_l2cap.h:140
uint8_t type
Definition ble_l2cap.h:119
struct ble_l2cap_event::@34::@37 disconnect
struct ble_l2cap_event::@34::@38 accept
struct ble_l2cap_event::@34::@39 receive
struct ble_l2cap_event::@34::@36 connect
struct os_mbuf * sdu_rx
Definition ble_l2cap.h:188