dotstack API Reference
1.10.37
|
The Bluetooth logical link control and adaptation protocol (L2CAP) supports higher level protocol multiplexing, packet segmentation and reassembly, and the conveying of quality of service information. More...
Macros | |
#define | bt_l2cap_listen(mgr, psm, acl_config, callback, param) bt_l2cap_listen_ext(mgr, psm, CMODE_BASIC, acl_config, callback, param) |
Listen for incoming connections. More... | |
#define | bt_l2cap_connect(mgr, remote_addr, psm, acl_config, connect_cb, param, state_cb) bt_l2cap_connect_ext(mgr, remote_addr, psm, CMODE_BASIC, acl_config, connect_cb, param, state_cb) |
Connect to a remote device. More... | |
Functions | |
void | bt_l2cap_init (void) |
Initialize the L2CAP layer. More... | |
bt_l2cap_mgr_t * | bt_l2cap_allocate_mgr (bt_hci_ctrl_state_t *hci_ctrl) |
Allocate L2CAP manager. More... | |
void | bt_l2cap_free_mgr (bt_l2cap_mgr_t *mgr) |
Release L2CAP manger. More... | |
bt_bool | bt_l2cap_listen_ext (bt_l2cap_mgr_t *mgr, bt_int psm, bt_byte chmode, bt_uint acl_config, bt_l2cap_listen_callback_fp callback, void *param) |
Listen for incoming connections. More... | |
bt_bool | bt_l2cap_cancel_listen (bt_l2cap_mgr_t *mgr, bt_int psmId) |
Stop listening for incoming connections. More... | |
bt_bool | bt_l2cap_listen_fixed_channel (bt_l2cap_mgr_t *mgr, bt_id cid, bt_byte link_type, bt_l2cap_listen_callback_fp callback, void *param) |
Listen for incoming connections. More... | |
bt_bool | bt_l2cap_cancel_listen_fixed_channel (bt_l2cap_mgr_t *mgr, bt_id cid, bt_byte link_type) |
Stop listening for incoming connections. More... | |
bt_bool | bt_l2cap_connect_ext (bt_l2cap_mgr_t *mgr, bt_bdaddr_t *remote_addr, bt_int psm, bt_byte chmode, bt_uint acl_config, bt_l2cap_connect_callback_fp connect_cb, void *param, bt_l2cap_state_changed_callback_fp state_cb) |
Connect to a remote device. More... | |
bt_bool | bt_l2cap_connect_fixed_channel (bt_l2cap_mgr_t *mgr, bt_bdaddr_t *remote_addr, bt_id cid, bt_uint acl_config, bt_l2cap_connect_callback_fp connect_cb, void *param, bt_l2cap_state_changed_callback_fp state_cb) |
Connect to a remote device. More... | |
bt_bool | bt_l2cap_disconnect (bt_l2cap_channel_t *ch) |
Close L2CAP channel. More... | |
bt_bool | bt_l2cap_disconnect_ex (bt_l2cap_channel_t *pch, bt_bool force_hci_disconnect) |
Close L2CAP channel. More... | |
bt_bool | bt_l2cap_is_channel_open (bt_l2cap_channel_t *channel) |
Check if channel is open. More... | |
bt_l2cap_mgr_t * | bt_l2cap_get_mgr (bt_hci_hconn_t h) |
Get the L2CAP manager. More... | |
bt_bool | bt_l2cap_hci_has_open_channels (bt_hci_conn_state_t *conn) |
Check if there are open channels on an ACL connection. More... | |
bt_bool | bt_l2cap_send_data (bt_l2cap_channel_t *channel, const bt_byte *data, bt_int len, bt_l2cap_send_data_callback_fp callback, void *cb_param) |
Send data over an L2CAP channel. More... | |
The Bluetooth logical link control and adaptation protocol (L2CAP) supports higher level protocol multiplexing, packet segmentation and reassembly, and the conveying of quality of service information.
#define bt_l2cap_connect | ( | mgr, | |
remote_addr, | |||
psm, | |||
acl_config, | |||
connect_cb, | |||
param, | |||
state_cb | |||
) | bt_l2cap_connect_ext(mgr, remote_addr, psm, CMODE_BASIC, acl_config, connect_cb, param, state_cb) |
Connect to a remote device.
This function establishes an L2CAP connection with a remote device on a specific PSM. When connect operation completes a callback function is called. An L2CAP channel will always be created in CMODE_BASIC mode.
mgr | The L2CAP manager. |
remote_addr | The address of the remote device. |
psm | The PSM for the connection. |
acl_config | The ACL link configuration. This can be one of the following values:
|
connect_cb | The Callback function that is called when the connect operation completes. |
param | A pointer to arbitrary data to be passed to the connect_cb callback. |
state_cb | The callback function that is called when the state of the established connection changes. |
TRUE
when the function succeeds. FALSE
otherwise. None of the callback functions is called in this case. #define bt_l2cap_listen | ( | mgr, | |
psm, | |||
acl_config, | |||
callback, | |||
param | |||
) | bt_l2cap_listen_ext(mgr, psm, CMODE_BASIC, acl_config, callback, param) |
Listen for incoming connections.
This function tells the L2CAP manager to listen for incoming connections on a specific PSM. When a connection is established a callback function is called. An L2CAP channel will always be created in CMODE_BASIC mode.
mgr | The L2CAP manager. |
psm | The PSM on which the manager will listen and accept incoming connections. |
acl_config | The ACL link configuration. This can be a combination of the following values:
|
callback | The callback function that will be called when an incoming connection is established. |
param | An arbitrary data pointer that will be passed to the callback function specified by the callback parameter. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_l2cap_mgr_t* bt_l2cap_allocate_mgr | ( | bt_hci_ctrl_state_t * | hci_ctrl | ) |
Allocate L2CAP manager.
This function allocates and initializes an L2CAP manager structure. One L2CAP manager manages all L2CAP connections for a particular local device. The local device is specified by the hci_ctrl
parameter.
hci_ctrl | Pointer to the hci_ctrl_state structure that represents the local device (HCI controller) for which a L2CAP manager is to be allocated. |
bt_bool bt_l2cap_cancel_listen | ( | bt_l2cap_mgr_t * | mgr, |
bt_int | psmId | ||
) |
Stop listening for incoming connections.
This function tells the L2CAP manager to stop listen for incoming connections on a specific PSM.
mgr | The L2CAP manager. |
psm | The PSM on which the manager will stop listening for incoming connections. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_l2cap_cancel_listen_fixed_channel | ( | bt_l2cap_mgr_t * | mgr, |
bt_id | cid, | ||
bt_byte | link_type | ||
) |
Stop listening for incoming connections.
This function tells the L2CAP manager to stop listen for incoming connections on a fixed channel.
mgr | The L2CAP manager. |
cid | The channel if on which the manager will stop listening. |
link | The type of the ACL link on which the manager will stop listening. This can be one of the following values:
|
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_l2cap_connect_ext | ( | bt_l2cap_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr, | ||
bt_int | psm, | ||
bt_byte | chmode, | ||
bt_uint | acl_config, | ||
bt_l2cap_connect_callback_fp | connect_cb, | ||
void * | param, | ||
bt_l2cap_state_changed_callback_fp | state_cb | ||
) |
Connect to a remote device.
This function establishes an L2CAP connection with a remote device on a specific PSM. When connect operation completes a callback function is called.
mgr | The L2CAP manager. |
remote_addr | The address of the remote device. |
psm | The PSM for the connection. |
chmode | The desired mode of the L2CAP channel. The mode can be changed depending on the capabilities of the remote L2CAP entity. The chmode can be one of the following values:
|
acl_config | The ACL link configuration. This can be a combination of the following values:
|
connect_cb | The Callback function that is called when the connect operation completes. |
param | A pointer to arbitrary data to be passed to the connect_cb callback. |
state_cb | The callback function that is called when the state of the established connection changes. |
TRUE
when the function succeeds. FALSE
otherwise. None of the callback functions is called in this case. bt_bool bt_l2cap_connect_fixed_channel | ( | bt_l2cap_mgr_t * | mgr, |
bt_bdaddr_t * | remote_addr, | ||
bt_id | cid, | ||
bt_uint | acl_config, | ||
bt_l2cap_connect_callback_fp | connect_cb, | ||
void * | param, | ||
bt_l2cap_state_changed_callback_fp | state_cb | ||
) |
Connect to a remote device.
This function establishes an L2CAP connection with a remote device on a fixed channel. When connect operation completes a callback function is called.
mgr | The L2CAP manager. |
remote_addr | The address of the remote device. |
cid | The channel id for the connection. |
acl_config | The ACL link configuration. This can be one of the following values:
|
connect_cb | The Callback function that is called when the connect operation completes. |
param | A pointer to arbitrary data to be passed to the connect_cb callback. |
state_cb | The callback function that is called when the state of the established connection changes. |
TRUE
when the function succeeds. FALSE
otherwise. None of the callback functions is called in this case. bt_bool bt_l2cap_disconnect | ( | bt_l2cap_channel_t * | ch | ) |
Close L2CAP channel.
This function closes an L2CAP channel. The channel can be established either by a call to bt_l2cap_connect() or by an incoming connection request.
ch | The L2CAP channel to be closed. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_l2cap_disconnect_ex | ( | bt_l2cap_channel_t * | pch, |
bt_bool | force_hci_disconnect | ||
) |
Close L2CAP channel.
This function closes an L2CAP channel. The channel can be established either by a call to bt_l2cap_connect() or by an incoming connection request.
ch | The L2CAP channel to be closed. |
force_hci_disconnect | Defines if the ACL link has also to be closed. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. void bt_l2cap_free_mgr | ( | bt_l2cap_mgr_t * | mgr | ) |
Release L2CAP manger.
This function releases the L2CAP manager structure.
mgr | The L2CAP manager structure to be released. |
bt_l2cap_mgr_t* bt_l2cap_get_mgr | ( | bt_hci_hconn_t | h | ) |
Get the L2CAP manager.
This function returns the L2CAP manager which manager the specified ACL connection.
h | ACL connection handle |
bt_bool bt_l2cap_hci_has_open_channels | ( | bt_hci_conn_state_t * | conn | ) |
Check if there are open channels on an ACL connection.
This function checks if there are open channels on a specified ACL connection.
conn | ACL connection |
TRUE
if the ACL has at least open L2CAP channel. FALSE
otherwise. void bt_l2cap_init | ( | void | ) |
Initialize the L2CAP layer.
This function initializes the L2CAP layer of the stack. It must be called prior to any other L2CAP function can be called.
bt_bool bt_l2cap_is_channel_open | ( | bt_l2cap_channel_t * | channel | ) |
Check if channel is open.
This function checks if an L2CAP channel is open.
channel | L2CAP channel |
TRUE
if the channel is open. FALSE
if the channel is closed. bt_bool bt_l2cap_listen_ext | ( | bt_l2cap_mgr_t * | mgr, |
bt_int | psm, | ||
bt_byte | chmode, | ||
bt_uint | acl_config, | ||
bt_l2cap_listen_callback_fp | callback, | ||
void * | param | ||
) |
Listen for incoming connections.
This function tells the L2CAP manager to listen for incoming connections on a specific PSM. When a connection is established a callback function is called.
mgr | The L2CAP manager. |
psm | The PSM on which the manager will listen and accept incoming connections. |
chmode | The desired mode of the L2CAP channel. The mode can be changed depending on the capabilities of the remote L2CAP entity. The chmode can be one of the following values:
|
acl_config | The ACL link configuration. This can be a combination of the following values:
|
callback | The callback function that will be called when an incoming connection is established. |
param | An arbitrary data pointer that will be passed to the callback function specified by the callback parameter. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_l2cap_listen_fixed_channel | ( | bt_l2cap_mgr_t * | mgr, |
bt_id | cid, | ||
bt_byte | link_type, | ||
bt_l2cap_listen_callback_fp | callback, | ||
void * | param | ||
) |
Listen for incoming connections.
This function tells the L2CAP manager to listen for incoming connections on a fixed channel. When a connection is established a callback function is called.
mgr | The L2CAP manager. |
cid | The channel if on which the manager will listen and accept incoming connections. |
link_type | The type of the ACL link on with the manager will listen. This can be one of the following values:
|
callback | The callback function that will be called when an incoming connection is established. |
param | An arbitrary data pointer that will be passed to the callback function specified by the callback parameter. |
TRUE
when the function succeeds. FALSE
otherwise. The callback function is not called in this case. bt_bool bt_l2cap_send_data | ( | bt_l2cap_channel_t * | channel, |
const bt_byte * | data, | ||
bt_int | len, | ||
bt_l2cap_send_data_callback_fp | callback, | ||
void * | cb_param | ||
) |
Send data over an L2CAP channel.
This function sends data over the specified L2CAP channel.
channel | The L2CAP channel to send data over. |
data | The pointer to the data. |
len | The length of the data. |
callback | The callback function that is called when sending the data has been completed. |
TRUE
if the function succeeds. FALSE
otherwise. The callback function is not called in this case.