/* If there are no connections, signals completion of the stop procedure.  */
static int ble_hs_stop_gap_event(struct ble_gap_event *event, void *arg)
/* If there are no connections, signals completion of the stop procedure.  */
static int ble_hs_stop_gap_event(struct ble_gap_event *event, void *arg)
{
    if (event->type == BLE_GAP_EVENT_DISCONNECT ||
        event->type == BLE_GAP_EVENT_TERM_FAILURE) {
        ble_hs_stop_conn_cnt--;
        if (ble_hs_stop_conn_cnt == 0) {
            ble_hs_stop_done(0);
        }
    }
    return 0;
}