Device : nrf51822 Softdevice : S110 v7.0.0
Title says it all. Autoconnect is working fine on my Android phones when nrf51822 is always programmed BLE_GAP_ADV_TYPE_ADV_IND. Per Nordic's SDK, this setting means only one mobile device can connect and in a connected state, nrf51822 is not visible to other mobile devices as it stops advertising.
Following SDK, nrf51822 is programmed to start in BLE_GAP_ADV_TYPE_ADV_IND and when it get connected it is re-programmed with BLE_GAP_ADV_TYPE_ADV_NONCONN_IND. Below is the code snippet handling the transitions :
static void on_ble_evt_postprocessing(ble_evt_t * p_ble_evt) {
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
advertising_start(BLE_GAP_ADV_TYPE_ADV_NONCONN_IND );
break;
case BLE_GAP_EVT_DISCONNECTED:
advertising_start(BLE_GAP_ADV_TYPE_ADV_IND);
break;
default:
// No implementation needed.
break;
}
}
Only when I do the above programming, my Android phones' autoconnect do not work. They work smoothly when I just use the BLE_GAP_ADV_TYPE_ADV_IND. Below is the autconnect code used in Android :
[ConnectGatt](developer.android.com/.../BluetoothDevice.html, boolean, android.bluetooth.BluetoothGattCallback))(Context, true, cbAutoConnect);
Anyone seeing this issue? Any solution or insights on this would be super helpful.