Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Connecting Procedure APIs

This group includes connections APIs.

Functions

at_ble_status_t at_ble_conn_update_reply (at_ble_handle_t handle, bool accept, uint16_t ce_len_min, uint16_t ce_len_max)
 Reply to connection parameters update request AT_BLE_CONN_PARAM_UPDATE_REQUEST. More...
 
at_ble_status_t at_ble_connect (at_ble_addr_t peers[], uint8_t peer_count, uint16_t scan_interval, uint16_t scan_window, at_ble_connection_params_t *connection_params)
 Connect to a peer device. More...
 
at_ble_status_t at_ble_connect_cancel (void)
 Cancels an ongoing connection attempt. More...
 
at_ble_status_t at_ble_connection_param_update (at_ble_handle_t handle, at_ble_connection_params_t *connection_params)
 Update the connection parameters of an ongoing connection. More...
 
at_ble_status_t at_ble_disconnect (at_ble_handle_t handle, at_ble_disconnect_reason_t reason)
 Disconnect a connected peer device and receive response through AT_BLE_DISCONNECTED event. More...
 
at_ble_status_t at_ble_set_conn_mode (at_ble_conn_mode_t mode)
 Set connection mode parameter. More...
 

at_ble_status_t at_ble_conn_update_reply ( at_ble_handle_t  handle,
bool  accept,
uint16_t  ce_len_min,
uint16_t  ce_len_max 
)

Reply to connection parameters update request AT_BLE_CONN_PARAM_UPDATE_REQUEST.

Parameters
[in]handlehandle of the connection to be updated
[in]acceptaccept or refuse connection parameters proposed by peer slave device
[in]ce_len_minMinimum CE length
[in]ce_len_maxMaximum CE length
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t
at_ble_status_t at_ble_connect ( at_ble_addr_t  peers[],
uint8_t  peer_count,
uint16_t  scan_interval,
uint16_t  scan_window,
at_ble_connection_params_t connection_params 
)

Connect to a peer device.

Connecting to a peer device, implicitly starting the necessary scan operation then connecting if a device in the peers list is found in case of using default mode AT_BLE_CONNECTION_AUTO. In case of using AT_BLE_CONNECTION_DIRECT mode, device will try to connect directly to provided peer address only without scanning. This API returns immediately after the operation is programmed, actual connection establishment or failure is marked with AT_BLE_CONNECTED event

Parameters
[in]peersList of peers' addresses that the device will connect to one of them
[in]peer_countNumber peers trying to connect with. In case of using AT_BLE_CONNECTION_DIRECT mode, peer_count should be 1.
[in]scan_intervalScan interval in 625us units
[in]scan_windowScan window in 625us units
[in]connection_paramsParameters of the established connection
Note
Default connection mode is AT_BLE_CONNECTION_AUTO
See Also
at_ble_set_conn_mode
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

Connecting to a peer device, implicitly starting the necessary scan operation then connecting if a device in the peers list is found. This API returns immediately after the operation is programmed, actual connection establishment or failure is marked with AT_BLE_CONNECTED event

Parameters
[in]peersa list of peers that the device will connect to one of them
[in]peer_countnumber of elements in peers, 0 to connect to any peer device
[in]scan_intervalscan interval in 625us units
[in]scan_windowscan window in 625us units
[in]connection_paramsparameters of the established connection
Returns
AT_BLE_SUCCESS Operation programmed successfully
AT_BLE_INVALID_PARAM Invalid parameter supplied
AT_BLE_FAILURE Generic error

References at_ble_addr_t::addr, device_info::addr_auto_gen, at_ble_addr_get(), AT_BLE_INVALID_PARAM, AT_BLE_SUCCESS, AT_CNX_INTERVAL_MAX, AT_CNX_INTERVAL_MIN, AT_CNX_LATENCY_MAX, AT_CNX_SUP_TO_MAX, AT_CNX_SUP_TO_MIN, at_ble_connection_params_t::ce_len_max, at_ble_connection_params_t::ce_len_min, at_ble_connection_params_t::con_intv_max, at_ble_connection_params_t::con_intv_min, at_ble_connection_params_t::con_latency, device, GAPM_CONNECTION_AUTO, gapm_get_device_address_type(), gapm_start_connection_cmd_handler(), device_info::renew_dur, device_info::role, ROLE_MASTER, status, at_ble_connection_params_t::superv_to, and at_ble_addr_t::type.

at_ble_status_t at_ble_connect_cancel ( void  )

Cancels an ongoing connection attempt.

Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t
AT_BLE_SUCCESS Operation canceled successfully
AT_BLE_FAILURE Generic error

References gapm_cancel_cmd_handler().

at_ble_status_t at_ble_connection_param_update ( at_ble_handle_t  handle,
at_ble_connection_params_t connection_params 
)

Update the connection parameters of an ongoing connection.


Connection parameter update command can be used by both master and slave of the connection.
For master of the connection, new connection parameters will be applied immediately.
For slave of the connection, a connection update message request will be send to master. Then master will be able to accept or refuse those parameters within 30 seconds otherwise link is automatically disconnected.

Note
This API returns after programming the new values but before they take effect, actual effect of the parameters is marked by the event AT_BLE_CONN_PARAM_UPDATE_DONE
Parameters
[in]handlehandle of the connection to be updated
[in]connection_paramsnew parameters to be used
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

This API returns after programming the new values but before they take effect; the actual effect of the parameters is marked by the event AT_BLE_CONN_PARAM_UPDATE_DONE

Parameters
[in]handleHandle of the connection to be updated
[in]connection_paramsNew parameters to be used
Returns
AT_BLE_SUCCESS Operation programmed successfully
AT_BLE_INVALID_PARAM Invalid parameter supplied
AT_BLE_FAILURE Generic error

References AT_BLE_INVALID_PARAM, AT_CNX_INTERVAL_MAX, AT_CNX_INTERVAL_MIN, AT_CNX_LATENCY_MAX, AT_CNX_SUP_TO_MAX, AT_CNX_SUP_TO_MIN, at_ble_connection_params_t::ce_len_max, at_ble_connection_params_t::ce_len_min, at_ble_connection_params_t::con_intv_max, at_ble_connection_params_t::con_intv_min, at_ble_connection_params_t::con_latency, gapc_param_update_cmd_handler(), and at_ble_connection_params_t::superv_to.

at_ble_status_t at_ble_disconnect ( at_ble_handle_t  handle,
at_ble_disconnect_reason_t  reason 
)

Disconnect a connected peer device and receive response through AT_BLE_DISCONNECTED event.

Parameters
[in]handlehandle of the connection to be terminated
[in]reasondisconnection reason, more info at at_ble_disconnect_reason_t
Note
  • At AT_BLE_DISCONNECTED event, for reason of disconnection see Bluetooth error code at Bluetooth core specification; vol 2, Core System Package [BR/EDR Controller volume], Part D
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

Disconnect a connected peer device and receive response through AT_BLE_DISCONNECTED event.

Parameters
[in]handleHandle of the connection to be terminated
[in]reasonDisconnection reason, more info at at_ble_disconnect_reason_t
Returns
AT_BLE_SUCCESS Operation programmed successfully
AT_BLE_INVALID_PARAM Invalid parameter supplied
AT_BLE_FAILURE Generic error

References AT_BLE_TERMINATED_BY_USER, AT_BLE_UNACCEPTABLE_INTERVAL, device_info::conn_handle, device, gapc_disconnect_cmd_handler(), and status.

at_ble_status_t at_ble_set_conn_mode ( at_ble_conn_mode_t  mode)

Set connection mode parameter.

Parameters
[in]modeselected mode, one of at_ble_conn_mode_t
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

Referenced by ble_scan_info().