summaryrefslogtreecommitdiff
path: root/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/mynewt-nimble/nimble/host/src/ble_gap.c')
-rw-r--r--src/libs/mynewt-nimble/nimble/host/src/ble_gap.c85
1 files changed, 3 insertions, 82 deletions
diff --git a/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c b/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c
index 7d1c525..be4a1cb 100644
--- a/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c
+++ b/src/libs/mynewt-nimble/nimble/host/src/ble_gap.c
@@ -1020,7 +1020,7 @@ ble_gap_slave_set_timer(uint32_t ticks_from_now)
}
#endif
-#if (NIMBLE_BLE_CONNECT || NIMBLE_BLE_SCAN)
+#if NIMBLE_BLE_CONNECT
/**
* Called when an error is encountered while the master-connection-fsm is
* active.
@@ -1034,22 +1034,12 @@ ble_gap_master_failed(int status)
ble_gap_master_connect_failure(status);
break;
-#if NIMBLE_BLE_SCAN
- case BLE_GAP_OP_M_DISC:
- STATS_INC(ble_gap_stats, initiate_fail);
- ble_gap_disc_complete();
- ble_gap_master_reset_state();
- break;
-#endif
-
default:
BLE_HS_DBG_ASSERT(0);
break;
}
}
-#endif
-#if NIMBLE_BLE_CONNECT
static void
ble_gap_update_failed(uint16_t conn_handle, int status)
{
@@ -1247,46 +1237,6 @@ ble_gap_adv_active_instance(uint8_t instance)
return ble_gap_slave[instance].op == BLE_GAP_OP_S_ADV;
}
-/**
- * Clears advertisement and discovery state. This function is necessary
- * when the controller loses its active state (e.g. on stack reset).
- */
-void
-ble_gap_reset_state(int reason)
-{
- uint16_t conn_handle;
-
- while (1) {
- conn_handle = ble_hs_atomic_first_conn_handle();
- if (conn_handle == BLE_HS_CONN_HANDLE_NONE) {
- break;
- }
-
- ble_gap_conn_broken(conn_handle, reason);
- }
-
-#if NIMBLE_BLE_ADVERTISE
-#if MYNEWT_VAL(BLE_EXT_ADV)
- uint8_t i;
- for (i = 0; i < BLE_ADV_INSTANCES; i++) {
- if (ble_gap_adv_active_instance(i)) {
- /* Indicate to application that advertising has stopped. */
- ble_gap_adv_finished(i, reason, 0, 0);
- }
- }
-#else
- if (ble_gap_adv_active_instance(0)) {
- /* Indicate to application that advertising has stopped. */
- ble_gap_adv_finished(0, reason, 0, 0);
- }
-#endif
-#endif
-
-#if (NIMBLE_BLE_SCAN || NIMBLE_BLE_CONNECT)
- ble_gap_master_failed(reason);
-#endif
-}
-
#if NIMBLE_BLE_CONNECT
static int
ble_gap_accept_master_conn(void)
@@ -1993,6 +1943,7 @@ ble_gap_update_timer(void)
ble_hs_unlock();
if (entry != NULL) {
+ ble_gap_update_notify(conn_handle, BLE_HS_ETIMEOUT);
ble_gap_update_entry_free(entry);
}
} while (entry != NULL);
@@ -5594,7 +5545,7 @@ ble_gap_unpair_oldest_peer(void)
}
if (num_peers == 0) {
- return BLE_HS_ENOENT;
+ return 0;
}
rc = ble_gap_unpair(&oldest_peer_id_addr);
@@ -5605,36 +5556,6 @@ ble_gap_unpair_oldest_peer(void)
return 0;
}
-int
-ble_gap_unpair_oldest_except(const ble_addr_t *peer_addr)
-{
- ble_addr_t peer_id_addrs[MYNEWT_VAL(BLE_STORE_MAX_BONDS)];
- int num_peers;
- int rc, i;
-
- rc = ble_store_util_bonded_peers(
- &peer_id_addrs[0], &num_peers, MYNEWT_VAL(BLE_STORE_MAX_BONDS));
- if (rc != 0) {
- return rc;
- }
-
- if (num_peers == 0) {
- return BLE_HS_ENOENT;
- }
-
- for (i = 0; i < num_peers; i++) {
- if (ble_addr_cmp(peer_addr, &peer_id_addrs[i]) != 0) {
- break;
- }
- }
-
- if (i >= num_peers) {
- return BLE_HS_ENOMEM;
- }
-
- return ble_gap_unpair(&peer_id_addrs[i]);
-}
-
void
ble_gap_passkey_event(uint16_t conn_handle,
struct ble_gap_passkey_params *passkey_params)