add Scanner resume()

This commit is contained in:
hathach committed 2018-11-09 11:29:37 +07:00
1 parent 2b229f4929
commit 55760a4262
9 files changed
+29 -23

No files matched your search

+2
View File
@@ -3,6 +3,8 @@
This repository contains the Arduino BSP for Adafruit nRF52 series:
- [Bluefruit Feather nRF52832](https://www.adafruit.com/product/3406)
- Bluefruit Feather nRF52840 Express (coming soon)
- [Noric nRF52840DK PCA10056](https://www.nordicsemi.com/eng/Products/nRF52840-DK)
## BSP Installation
+1 -1
View File
@@ -5,7 +5,7 @@
- Added nRF52840-based board support (pca10056 and feather nRF52840 express)
- Upgrade bootloader to v6.1.0 ( single bank only )
- Upgrade BSP code to match SD v6
- Bluefruit.Scanner.start() must be called (often in callback) to resume scanning after received an report.
- Bluefruit.Scanner.resume() must be called in scan callback to resume scanning after received an report.
- Upgrade freeRTOS from v8 to v10.0.1
- Upgrade Segger SysView to 2.52d
- Added nrfx to core
@@ -78,8 +78,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
}else
{
// For Softdevice v6: after received a report, scanner will be paused
// We need to call Scanner start() to resume scanning
Bluefruit.Scanner.start();
// We need to call Scanner resume() to continue scanning
Bluefruit.Scanner.resume();
}
}
@@ -63,8 +63,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
Serial.println();
// For Softdevice v6: after received a report, scanner will be paused
// We need to call Scanner start() to resume scanning
Bluefruit.Scanner.start();
// We need to call Scanner resume() to continue scanning
Bluefruit.Scanner.resume();
}
void loop()
@@ -181,8 +181,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
Serial.println();
// For Softdevice v6: after received a report, scanner will be paused
// We need to call Scanner start() to resume scanning
Bluefruit.Scanner.start();
// We need to call Scanner resume() to continue scanning
Bluefruit.Scanner.resume();
}
void printUuid16List(uint8_t* buffer, uint8_t len)
@@ -144,7 +144,7 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
else
{
Serial.println("No Match");
Bluefruit.Scanner.start(); // continue scanning
Bluefruit.Scanner.resume(); // continue scanning
}
}
else
@@ -152,8 +152,8 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
Serial.println("Failed");
// For Softdevice v6: after received a report, scanner will be paused
// We need to call Scanner start() to resume scanning
Bluefruit.Scanner.start();
// We need to call Scanner resume() to continue scanning
Bluefruit.Scanner.resume();
}
}
@@ -364,6 +364,10 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
Serial.println();
#endif
// For Softdevice v6: after received a report, scanner will be paused
// We need to call Scanner resume() to continue scanning
Bluefruit.Scanner.resume();
}
#if ENABLE_TFT
+12 -13
View File
@@ -118,24 +118,23 @@ bool BLEScanner::start(uint16_t timeout)
_report_data.p_data = _scan_data;
_report_data.len = BLE_GAP_SCAN_BUFFER_MAX;
if (_runnning)
{
// resume scanning after received an report
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), false );
}else
{
// start a new scan
_param.timeout = timeout;
_param.timeout = timeout;
VERIFY_STATUS( sd_ble_gap_scan_start(&_param, &_report_data), false );
VERIFY_STATUS( sd_ble_gap_scan_start(&_param, &_report_data), false );
Bluefruit._startConnLed(); // start blinking
_runnning = true;
}
Bluefruit._startConnLed(); // start blinking
_runnning = true;
return true;
}
bool BLEScanner::resume(void)
{
// resume scanning after received an report
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), false );
return true;
}
bool BLEScanner::stop(void)
{
VERIFY_STATUS( sd_ble_gap_scan_stop(), false );
@@ -377,7 +376,7 @@ void BLEScanner::_eventHandler(ble_evt_t* evt)
}else
{
// continue scanning since report is filtered and callback is not invoked
VERIFY_STATUS( sd_ble_gap_scan_start(NULL, &_report_data), );
this->resume();
}
}
break;
@@ -74,6 +74,7 @@ public:
void clearFilters(void);
bool start(uint16_t timeout = 0);
bool resume(void);
bool stop(void);
/*------------- Callbacks -------------*/