blescan.cpp bugfix unregister gap cb
This commit is contained in:
parent
015658962b
commit
85f9645599
@ -237,18 +237,16 @@ esp_err_t register_ble_callback(bool unregister = false) {
|
|||||||
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
|
||||||
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
|
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#if (MACFILTER)
|
#if (MACFILTER)
|
||||||
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_WLIST_PRA_DIR,
|
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_WLIST_PRA_DIR,
|
||||||
// ADV_IND, ADV_NONCONN_IND, ADV_SCAN_IND packets are used for
|
// ADV_IND, ADV_NONCONN_IND, ADV_SCAN_IND packets are used for broadcasting
|
||||||
broadcasting
|
// data in broadcast applications (e.g., Beacons), so we don't want them in
|
||||||
// data in broadcast applications (e.g., Beacons), so we don't want
|
|
||||||
them in
|
|
||||||
// macfilter mode
|
// macfilter mode
|
||||||
#else
|
#else
|
||||||
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
|
.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.scan_interval =
|
.scan_interval =
|
||||||
(uint16_t)(cfg.blescantime * 10 / 0.625), // Time = N * 0.625 msec
|
(uint16_t)(cfg.blescantime * 10 / 0.625), // Time = N * 0.625 msec
|
||||||
@ -275,7 +273,7 @@ void start_BLEscan(void) {
|
|||||||
ESP_ERROR_CHECK(esp_bluedroid_init());
|
ESP_ERROR_CHECK(esp_bluedroid_init());
|
||||||
ESP_ERROR_CHECK(esp_bluedroid_enable());
|
ESP_ERROR_CHECK(esp_bluedroid_enable());
|
||||||
// Register callback function for capturing bluetooth packets
|
// Register callback function for capturing bluetooth packets
|
||||||
ESP_ERROR_CHECK(register_ble_callback(true));
|
ESP_ERROR_CHECK(register_ble_callback(false));
|
||||||
ESP_LOGI(TAG, "Bluetooth scanner started");
|
ESP_LOGI(TAG, "Bluetooth scanner started");
|
||||||
#endif // BLECOUNTER
|
#endif // BLECOUNTER
|
||||||
} else {
|
} else {
|
||||||
@ -288,7 +286,7 @@ void start_BLEscan(void) {
|
|||||||
void stop_BLEscan(void) {
|
void stop_BLEscan(void) {
|
||||||
#if (BLECOUNTER)
|
#if (BLECOUNTER)
|
||||||
ESP_LOGI(TAG, "Shutting down bluetooth scanner ...");
|
ESP_LOGI(TAG, "Shutting down bluetooth scanner ...");
|
||||||
ESP_ERROR_CHECK(register_ble_callback(false)); // unregister capture function
|
ESP_ERROR_CHECK(register_ble_callback(true)); // unregister capture function
|
||||||
ESP_LOGD(TAG, "bluedroid disable...");
|
ESP_LOGD(TAG, "bluedroid disable...");
|
||||||
ESP_ERROR_CHECK(esp_bluedroid_disable());
|
ESP_ERROR_CHECK(esp_bluedroid_disable());
|
||||||
ESP_LOGD(TAG, "bluedroid deinit...");
|
ESP_LOGD(TAG, "bluedroid deinit...");
|
||||||
|
Loading…
Reference in New Issue
Block a user