How does background connect work?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I'm only interested in the CENTRAL side. I noticed that the wiced_bt_gatt_le_connect call has a scan_mode and an is_direct flag. The is_direct flag has a note in the .h file that says that you must set the background connection type to AUTO or SELECTIVE.  So how does this all work?  If I set scan_mode to HIGH_DUTY and background type to AUTO and is_direct = 0 will the central try to connect to all connectable devices? Does it use the white list? Can I use SELECTIVE to implement my own white list? Also, if I specify is_direct = 0 does the wiced_bt_gatt_le_connect call right away?  How do I cancel the background connection operations?

Finally, is there some documentation other than these .h files describing how this stack works?

Robert

0 Likes
1 Solution
Anonymous
Not applicable

1) If is_direct flag is set to TRUE, then connect request is sent to the device whose address is specified.

2) If is_direct flag is set to FALSE, the background connection type is checked.

     a) If background connection type is AUTO, then connect request is sent to the address specified in wiced_gatt_le_connect. (This is same as 1)

     b) If background connection type is SELECTIVE, the callback is triggered when you receive a adv packet from the peer device and connection request is sent to the device.

However, the wiced_bt_ble_set_background_connection_type is to be used along with wiced_bt_ble_update_background_connection_device rather than wiced_bt_gatt_le_connect.

1) Add desired peripheral addresses to whitelist using wiced_bt_ble_update_background_connection_device

2) Call the wiced_bt_ble_set_background_connection_type API

     a) If it is AUTO, connection request to the whitelist device will be sent automatically.

     b) If it is SELECTIVE, then callback will be triggered and you will have to call the connect API to connect to the device.

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

1) If is_direct flag is set to TRUE, then connect request is sent to the device whose address is specified.

2) If is_direct flag is set to FALSE, the background connection type is checked.

     a) If background connection type is AUTO, then connect request is sent to the address specified in wiced_gatt_le_connect. (This is same as 1)

     b) If background connection type is SELECTIVE, the callback is triggered when you receive a adv packet from the peer device and connection request is sent to the device.

However, the wiced_bt_ble_set_background_connection_type is to be used along with wiced_bt_ble_update_background_connection_device rather than wiced_bt_gatt_le_connect.

1) Add desired peripheral addresses to whitelist using wiced_bt_ble_update_background_connection_device

2) Call the wiced_bt_ble_set_background_connection_type API

     a) If it is AUTO, connection request to the whitelist device will be sent automatically.

     b) If it is SELECTIVE, then callback will be triggered and you will have to call the connect API to connect to the device.

0 Likes