20#ifndef H_BLE_L2CAP_SIG_
21#define H_BLE_L2CAP_SIG_
23#include "nimble/porting/nimble/include/syscfg/syscfg.h"
29#define BLE_L2CAP_SIG_MTU 100
31#define BLE_L2CAP_SIG_HDR_SZ 4
32struct ble_l2cap_sig_hdr {
37} __attribute__((packed));
39#define BLE_L2CAP_SIG_REJECT_MIN_SZ 2
40struct ble_l2cap_sig_reject {
43} __attribute__((packed));
45#define BLE_L2CAP_SIG_UPDATE_REQ_SZ 8
46struct ble_l2cap_sig_update_req {
49 uint16_t slave_latency;
50 uint16_t timeout_multiplier;
51} __attribute__((packed));
53#define BLE_L2CAP_SIG_UPDATE_RSP_SZ 2
54struct ble_l2cap_sig_update_rsp {
56} __attribute__((packed));
58#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT 0x0000
59#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT 0x0001
61struct ble_l2cap_sig_le_con_req {
67} __attribute__((packed));
69struct ble_l2cap_sig_le_con_rsp {
75} __attribute__((packed));
77struct ble_l2cap_sig_credit_base_connect_req {
83} __attribute__((packed));
85struct ble_l2cap_sig_credit_base_connect_rsp {
91} __attribute__((packed));
93struct ble_l2cap_sig_credit_base_reconfig_req {
97} __attribute__((packed));
99struct ble_l2cap_sig_credit_base_reconfig_rsp {
101} __attribute__((packed));
103struct ble_l2cap_sig_disc_req {
106} __attribute__((packed));
108struct ble_l2cap_sig_disc_rsp {
111} __attribute__((packed));
113struct ble_l2cap_sig_le_credits {
116} __attribute__((packed));
118void ble_l2cap_sig_hdr_parse(
void *payload, uint16_t len,
119 struct ble_l2cap_sig_hdr *hdr);
120int ble_l2cap_sig_reject_tx(uint16_t conn_handle,
121 uint8_t
id, uint16_t reason,
122 void *data,
int data_len);
123int ble_l2cap_sig_reject_invalid_cid_tx(uint16_t conn_handle, uint8_t
id,
124 uint16_t src_cid, uint16_t dst_cid);
125int ble_l2cap_sig_tx(uint16_t conn_handle,
struct os_mbuf *txom);
126void *ble_l2cap_sig_cmd_get(uint8_t opcode, uint8_t
id, uint16_t len,
128#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) != 0
129int ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
131 ble_l2cap_event_fn *cb,
void *cb_arg);
132int ble_l2cap_sig_disconnect(
struct ble_l2cap_chan *chan);
133int ble_l2cap_sig_le_credits(uint16_t conn_handle, uint16_t scid,
137ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
139 ble_l2cap_event_fn *cb,
void *cb_arg)
141 return BLE_HS_ENOTSUP;
145ble_l2cap_sig_disconnect(
struct ble_l2cap_chan *chan)
147 return BLE_HS_ENOTSUP;
151#if MYNEWT_VAL(BLE_L2CAP_ENHANCED_COC)
152int ble_l2cap_sig_ecoc_connect(uint16_t conn_handle,
153 uint16_t psm, uint16_t mtu,
154 uint8_t num,
struct os_mbuf *sdu_rx[],
155 ble_l2cap_event_fn *cb,
void *cb_arg);
156int ble_l2cap_sig_coc_reconfig(uint16_t conn_handle,
struct ble_l2cap_chan *chans[],
157 uint8_t num, uint16_t new_mtu);
160ble_l2cap_sig_ecoc_connect(uint16_t conn_handle,
161 uint16_t psm, uint16_t mtu,
162 uint8_t num,
struct os_mbuf *sdu_rx[],
163 ble_l2cap_event_fn *cb,
void *cb_arg)
165 return BLE_HS_ENOTSUP;
168ble_l2cap_sig_coc_reconfig(uint16_t conn_handle,
struct ble_l2cap_chan *chans[],
169 uint8_t num, uint16_t new_mtu)
171 return BLE_HS_ENOTSUP;
175void ble_l2cap_sig_conn_broken(uint16_t conn_handle,
int reason);
176int32_t ble_l2cap_sig_timer(
void);
177struct ble_l2cap_chan *ble_l2cap_sig_create_chan(uint16_t conn_handle);
178int ble_l2cap_sig_init(
void);