Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Connection callback structure. More...
#include <conn.h>
Data Fields | |
void(* | connected )(struct bt_conn *conn, uint8_t err) |
A new connection has been established. More... | |
void(* | disconnected )(struct bt_conn *conn, uint8_t reason) |
A connection has been disconnected. More... | |
bool(* | le_param_req )(struct bt_conn *conn, struct bt_le_conn_param *param) |
LE connection parameter update request. More... | |
void(* | le_param_updated )(struct bt_conn *conn, uint16_t interval, uint16_t latency, uint16_t timeout) |
The parameters for an LE connection have been updated. More... | |
void(* | identity_resolved )(struct bt_conn *conn, const bt_addr_le_t *rpa, const bt_addr_le_t *identity) |
Remote Identity Address has been resolved. More... | |
void(* | security_changed )(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) |
The security level of a connection has changed. More... | |
void(* | remote_info_available )(struct bt_conn *conn, struct bt_conn_remote_info *remote_info) |
Remote information procedures has completed. More... | |
void(* | le_phy_updated )(struct bt_conn *conn, struct bt_conn_le_phy_info *param) |
The PHY of the connection has changed. More... | |
void(* | le_data_len_updated )(struct bt_conn *conn, struct bt_conn_le_data_len_info *info) |
The data length parameters of the connection has changed. More... | |
Connection callback structure.
This structure is used for tracking the state of a connection. It is registered with the help of the bt_conn_cb_register() API. It's permissible to register multiple instances of this bt_conn_cb type, in case different modules of an application are interested in tracking the connection state. If a callback is not of interest for an instance, it may be set to NULL and will as a consequence not be used for that instance.
A new connection has been established.
This callback notifies the application of a new connection. In case the err parameter is non-zero it means that the connection establishment failed.
conn | New connection object. |
err | HCI error. Zero for success, non-zero otherwise. |
err
can mean either of the following:
embed:rst:inline :kconfig:`CONFIG_BT_CREATE_CONN_TIMEOUT`seconds.
BT_HCI_ERR_ADV_TIMEOUT
High duty cycle directed connectable advertiser started by bt_le_adv_start failed to be connected within the timeout. A connection has been disconnected.
This callback notifies the application that a connection has been disconnected.
When this callback is called the stack still has one reference to the connection object. If the application in this callback tries to start either a connectable advertiser or create a new connection this might fail because there are no free connection objects available. To avoid this issue it is recommended to either start connectable advertise or create a new connection using k_work_submit or increase
embed:rst:inline :kconfig:`CONFIG_BT_MAX_CONN`
.
conn | Connection object. |
reason | HCI reason for the disconnection. |
void(* bt_conn_cb::identity_resolved) (struct bt_conn *conn, const bt_addr_le_t *rpa, const bt_addr_le_t *identity) |
Remote Identity Address has been resolved.
This callback notifies the application that a remote Identity Address has been resolved
conn | Connection object. |
rpa | Resolvable Private Address. |
identity | Identity Address. |
void(* bt_conn_cb::le_data_len_updated) (struct bt_conn *conn, struct bt_conn_le_data_len_info *info) |
The data length parameters of the connection has changed.
This callback notifies the application that the maximum Link Layer payload length or transmission time has changed.
conn | Connection object. |
info | Connection data length information. |
bool(* bt_conn_cb::le_param_req) (struct bt_conn *conn, struct bt_le_conn_param *param) |
LE connection parameter update request.
This callback notifies the application that a remote device is requesting to update the connection parameters. The application accepts the parameters by returning true, or rejects them by returning false. Before accepting, the application may also adjust the parameters to better suit its needs.
It is recommended for an application to have just one of these callbacks for simplicity. However, if an application registers multiple it needs to manage the potentially different requirements for each callback. Each callback gets the parameters as returned by previous callbacks, i.e. they are not necessarily the same ones as the remote originally sent.
If the application does not have this callback then the default is to accept the parameters.
conn | Connection object. |
param | Proposed connection parameters. |
void(* bt_conn_cb::le_param_updated) (struct bt_conn *conn, uint16_t interval, uint16_t latency, uint16_t timeout) |
The parameters for an LE connection have been updated.
This callback notifies the application that the connection parameters for an LE connection have been updated.
conn | Connection object. |
interval | Connection interval. |
latency | Connection latency. |
timeout | Connection supervision timeout. |
void(* bt_conn_cb::le_phy_updated) (struct bt_conn *conn, struct bt_conn_le_phy_info *param) |
The PHY of the connection has changed.
This callback notifies the application that the PHY of the connection has changed.
conn | Connection object. |
info | Connection LE PHY information. |
void(* bt_conn_cb::remote_info_available) (struct bt_conn *conn, struct bt_conn_remote_info *remote_info) |
Remote information procedures has completed.
This callback notifies the application that the remote information has been retrieved from the remote peer.
conn | Connection object. |
remote_info | Connection information of remote device. |
void(* bt_conn_cb::security_changed) (struct bt_conn *conn, bt_security_t level, enum bt_security_err err) |
The security level of a connection has changed.
This callback notifies the application that the security of a connection has changed.
The security level of the connection can either have been increased or remain unchanged. An increased security level means that the pairing procedure has been performed or the bond information from a previous connection has been applied. If the security level remains unchanged this means that the encryption key has been refreshed for the connection.
conn | Connection object. |
level | New security level of the connection. |
err | Security error. Zero for success, non-zero otherwise. |