nimble/l2cap: Redo defines to static inline

This commit is contained in:
Łukasz Rymanowski
2020-03-07 01:09:21 +01:00
parent 7f0a9c9503
commit 050c2b6598
2 changed files with 38 additions and 8 deletions
+25 -5
View File
@@ -71,11 +71,31 @@ int ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
struct os_mbuf *sdu_rx);
int ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx);
#else
#define ble_l2cap_coc_init() 0
#define ble_l2cap_coc_create_server(psm, mtu, cb, cb_arg) BLE_HS_ENOTSUP
#define ble_l2cap_coc_recv_ready(chan, sdu_rx) BLE_HS_ENOTSUP
#define ble_l2cap_coc_cleanup_chan(conn, chan)
#define ble_l2cap_coc_send(chan, sdu_tx) BLE_HS_ENOTSUP
static inline int
ble_l2cap_coc_init(void) {
return 0;
}
static inline int
ble_l2cap_coc_create_server(uint16_t psm, uint16_t mtu,
ble_l2cap_event_fn *cb, void *cb_arg) {
return BLE_HS_ENOTSUP;
}
static inline int
ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
struct os_mbuf *sdu_rx) {
return BLE_HS_ENOTSUP;
}
static inline void
ble_l2cap_coc_cleanup_chan(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan) {
}
static inline int
ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx) {
return BLE_HS_ENOTSUP;
}
#endif
#ifdef __cplusplus
+13 -3
View File
@@ -107,9 +107,19 @@ int ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan);
int ble_l2cap_sig_le_credits(uint16_t conn_handle, uint16_t scid,
uint16_t credits);
#else
#define ble_l2cap_sig_coc_connect(conn_handle, psm, mtu, sdu_rx, cb, cb_arg) \
BLE_HS_ENOTSUP
#define ble_l2cap_sig_disconnect(chan) BLE_HS_ENOTSUP
static inline int
ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
struct os_mbuf *sdu_rx,
ble_l2cap_event_fn *cb, void *cb_arg)
{
return BLE_HS_ENOTSUP;
}
static inline int
ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan)
{
return BLE_HS_ENOTSUP;
}
#endif
void ble_l2cap_sig_conn_broken(uint16_t conn_handle, int reason);