mirror of
https://github.com/bluekitchen/btstack.git
synced 2024-12-29 09:26:08 +00:00
40 lines
1.7 KiB
TeX
40 lines
1.7 KiB
TeX
% !TEX root = btstack_gettingstarted.tex
|
|
\section{L2CAP API}
|
|
\label{appendix:api_l2cap}
|
|
$ $
|
|
\begin{lstlisting}
|
|
// Set up L2CAP and register L2CAP with HCI layer.
|
|
void l2cap_init(void);
|
|
|
|
// Registers a packet handler that handles HCI and general BTstack
|
|
// events.
|
|
void l2cap_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size));
|
|
|
|
// Creates L2CAP channel to the PSM of a remote device with baseband
|
|
// address. A new baseband connection will be initiated if needed.
|
|
void l2cap_create_channel_internal(void * connection, btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, uint16_t mtu);
|
|
|
|
// Disconencts L2CAP channel with given identifier.
|
|
void l2cap_disconnect_internal(uint16_t local_cid, uint8_t reason);
|
|
|
|
// Queries the maximal transfer unit (MTU) for L2CAP channel with
|
|
// given identifier.
|
|
uint16_t l2cap_get_remote_mtu_for_local_cid(uint16_t local_cid);
|
|
|
|
// Sends L2CAP data packet to the channel with given identifier.
|
|
int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len);
|
|
|
|
// Registers L2CAP service with given PSM and MTU, and assigns a
|
|
// packet handler. On embedded systems, use NULL for connection
|
|
// parameter.
|
|
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu);
|
|
|
|
// Unregisters L2CAP service with given PSM. On embedded systems,
|
|
// use NULL for connection parameter.
|
|
void l2cap_unregister_service_internal(void *connection, uint16_t psm);
|
|
|
|
// Accepts/Deny incoming L2CAP connection.
|
|
void l2cap_accept_connection_internal(uint16_t local_cid);
|
|
void l2cap_decline_connection_internal(uint16_t local_cid, uint8_t reason);
|
|
\end{lstlisting}
|
|
\pagebreak |