Connection API¶
API Reference
-
group
gatt_common_api
GATT Profile Connection Functions.
Functions
-
wiced_bool_t
wiced_bt_gatt_le_connect
(wiced_bt_device_address_t bd_addr, wiced_bt_ble_address_type_t bd_addr_type, wiced_bt_ble_conn_mode_t conn_mode, wiced_bool_t is_direct)¶ Open GATT over LE connection to a remote device Result is notified using GATT_CONNECTION_STATUS_EVT of wiced_bt_gatt_cback_t.
NOTE : If is_direct = WICED_FALSE, it will create background connection. Default Background connection type is BTM_BLE_CONN_NONE. Before calling wiced_bt_gatt_le_connect please set background connection type (AUTO / SELECTIVE) using wiced_bt_ble_set_background_connection_type API
- Parameters
bd_addr – [in] : Remote device address
bd_addr_type – [in] Public or random address
conn_mode – [in] : connection scan mode
is_direct – [in] : Is direct connection or not
- Returns
TRUE : If connection started FALSE : If connection start failure
-
wiced_bt_gatt_status_t
wiced_bt_gatt_register
(wiced_bt_gatt_cback_t *p_gatt_cback)¶ Register an application callback for GATT.
- Parameters
p_gatt_cback – [in] : The GATT notification callback
- Returns
-
wiced_bool_t
wiced_bt_gatt_cancel_connect
(wiced_bt_device_address_t bd_addr, wiced_bool_t is_direct)¶ Cancel initiating GATT connection.
- Parameters
bd_addr – [in] : Remote device address
is_direct – [in] : Is direct connection or not
- Returns
TRUE : If connection started FALSE : If connection start failure
-
wiced_bt_gatt_status_t
wiced_bt_gatt_disconnect
(uint16_t conn_id)¶ Close the specified GATT connection.
Result is notified using GATT_CONNECTION_STATUS_EVT of wiced_bt_gatt_cback_t.
- Parameters
conn_id – [in] : GATT connection ID
- Returns
-
wiced_bool_t
wiced_bt_gatt_listen
(wiced_bool_t start, wiced_bt_device_address_t bd_addr, wiced_bt_ble_address_type_t type)¶ Start or stop LE advertisement and listen for connection.
- Parameters
start – [in] : TRUE to add device to Filter Accept List / FALSE to remove
bd_addr – [in] : Device to add/remove from Filter Accept List
type – [in] : Address type of bd_addr
- Returns
TRUE : Success FALSE : Failure
-
wiced_bt_gatt_status_t
wiced_bt_gatt_get_device_address
(uint16_t conn_id, wiced_bt_device_address_t *p_bdaddr, wiced_bt_transport_t *p_transport, wiced_bt_ble_address_type_t *p_addr_type)¶ API to get the bluetooth device address of the connected gatt conn_id.
note
: The API cannot be used to get the Bluetooth device address in case the device is disconnected
- Parameters
conn_id – [in] : Connection handle of the gatt bearer
p_bdaddr – [out] : wiced_bt_device_address_t
p_transport – [out] wiced_bt_transport_t of the bearer
p_addr_type – [out] wiced_bt_ble_address_type_t of the bearer. Valid only if device referred by the conn_id is of type BT_TRANSPORT_LE
- Returns
-
wiced_bool_t