Skip to content

Commit

Permalink
Fixed some bugs caused by closing pairing.
Browse files Browse the repository at this point in the history
  • Loading branch information
xianglin1998 committed Sep 14, 2023
1 parent 4c43bca commit 98605be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 1 addition & 5 deletions firmware/application/src/ble_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,5 @@ void ble_slave_init(void) {
services_init(); // Initialization of service characteristics
advertising_init(); // Broadcast parameter initialization
conn_params_init(); // Connection parameter initialization

// Pairing enable?
if (settings_get_ble_pairing_enable_first_load()) {
peer_manager_init(); // Peer manager Initialization
}
peer_manager_init(); // Peer manager Initialization
}
11 changes: 8 additions & 3 deletions firmware/nrf52_sdk/components/ble/peer_manager/peer_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "ble_conn_state.h"
#include "peer_manager_internal.h"
#include "nrf_sdh_ble.h"
#include "settings.h"

#define NRF_LOG_MODULE_NAME peer_manager
#if PM_LOG_ENABLED
Expand Down Expand Up @@ -348,9 +349,13 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
return;
}

im_ble_evt_handler(p_ble_evt);
sm_ble_evt_handler(p_ble_evt);
gcm_ble_evt_handler(p_ble_evt);
if (settings_get_ble_pairing_enable_first_load()) {
im_ble_evt_handler(p_ble_evt);
sm_ble_evt_handler(p_ble_evt);
gcm_ble_evt_handler(p_ble_evt);
} else {
NRF_LOG_INFO("Pairing is disable, ignore ble event for peer manager.");
}
}

NRF_SDH_BLE_OBSERVER(m_ble_evt_observer, PM_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
Expand Down

0 comments on commit 98605be

Please sign in to comment.