sets BLEScanResults by reference (#8759)
This commit is contained in:
parent
a8622c4f91
commit
f21820946a
4 changed files with 10 additions and 10 deletions
|
|
@ -111,9 +111,9 @@ void setup()
|
|||
void loop()
|
||||
{
|
||||
// put your main code here, to run repeatedly:
|
||||
BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
|
||||
BLEScanResults *foundDevices = pBLEScan->start(scanTime, false);
|
||||
Serial.print("Devices found: ");
|
||||
Serial.println(foundDevices.getCount());
|
||||
Serial.println(foundDevices->getCount());
|
||||
Serial.println("Scan done!");
|
||||
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||
delay(2000);
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
|
||||
BLEScanResults *foundDevices = pBLEScan->start(scanTime, false);
|
||||
Serial.print("Devices found: ");
|
||||
Serial.println(foundDevices.getCount());
|
||||
Serial.println(foundDevices->getCount());
|
||||
Serial.println("Scan done!");
|
||||
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||
delay(2000);
|
||||
|
|
|
|||
|
|
@ -426,11 +426,11 @@ bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), b
|
|||
* @param [in] duration The duration in seconds for which to scan.
|
||||
* @return The BLEScanResults.
|
||||
*/
|
||||
BLEScanResults BLEScan::start(uint32_t duration, bool is_continue) {
|
||||
BLEScanResults* BLEScan::start(uint32_t duration, bool is_continue) {
|
||||
if(start(duration, nullptr, is_continue)) {
|
||||
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
|
||||
}
|
||||
return m_scanResults;
|
||||
return &m_scanResults;
|
||||
} // start
|
||||
|
||||
|
||||
|
|
@ -500,8 +500,8 @@ BLEAdvertisedDevice BLEScanResults::getDevice(uint32_t i) {
|
|||
return dev;
|
||||
}
|
||||
|
||||
BLEScanResults BLEScan::getResults() {
|
||||
return m_scanResults;
|
||||
BLEScanResults* BLEScan::getResults() {
|
||||
return &m_scanResults;
|
||||
}
|
||||
|
||||
void BLEScan::clearResults() {
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ public:
|
|||
void setInterval(uint16_t intervalMSecs);
|
||||
void setWindow(uint16_t windowMSecs);
|
||||
bool start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), bool is_continue = false);
|
||||
BLEScanResults start(uint32_t duration, bool is_continue = false);
|
||||
BLEScanResults* start(uint32_t duration, bool is_continue = false);
|
||||
void stop();
|
||||
void erase(BLEAddress address);
|
||||
BLEScanResults getResults();
|
||||
BLEScanResults* getResults();
|
||||
void clearResults();
|
||||
|
||||
#ifdef SOC_BLE_50_SUPPORTED
|
||||
|
|
|
|||
Loading…
Reference in a new issue