Is there a function within the nRF51822 SDK to check if BLE is connected or not (or to check general BLE connection state)?
Thanks.
I think you are supposed to handle the BLE events and remember the state your self. You can register to receive these events using softdevice_ble_evt_handler_set(ble_evt_dispatch) where your ble_evt_dispatch function looks like this :
static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: connected = true; break;
case BLE_GAP_EVT_DISCONNECTED:
connected = false;
break;
default:
break;
}
}
I think you are supposed to handle the BLE events and remember the state your self. You can register to receive these events using softdevice_ble_evt_handler_set(ble_evt_dispatch) where your ble_evt_dispatch function looks like this :
static void ble_evt_dispatch(ble_evt_t * p_ble_evt) { switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: connected = true; break;
case BLE_GAP_EVT_DISCONNECTED:
connected = false;
break;
default:
break;
}
}