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()
|
void loop()
|
||||||
{
|
{
|
||||||
// put your main code here, to run repeatedly:
|
// 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.print("Devices found: ");
|
||||||
Serial.println(foundDevices.getCount());
|
Serial.println(foundDevices->getCount());
|
||||||
Serial.println("Scan done!");
|
Serial.println("Scan done!");
|
||||||
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||||
delay(2000);
|
delay(2000);
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
// 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.print("Devices found: ");
|
||||||
Serial.println(foundDevices.getCount());
|
Serial.println(foundDevices->getCount());
|
||||||
Serial.println("Scan done!");
|
Serial.println("Scan done!");
|
||||||
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||||
delay(2000);
|
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.
|
* @param [in] duration The duration in seconds for which to scan.
|
||||||
* @return The BLEScanResults.
|
* @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)) {
|
if(start(duration, nullptr, is_continue)) {
|
||||||
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
|
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
|
||||||
}
|
}
|
||||||
return m_scanResults;
|
return &m_scanResults;
|
||||||
} // start
|
} // start
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -500,8 +500,8 @@ BLEAdvertisedDevice BLEScanResults::getDevice(uint32_t i) {
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLEScanResults BLEScan::getResults() {
|
BLEScanResults* BLEScan::getResults() {
|
||||||
return m_scanResults;
|
return &m_scanResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLEScan::clearResults() {
|
void BLEScan::clearResults() {
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ public:
|
||||||
void setInterval(uint16_t intervalMSecs);
|
void setInterval(uint16_t intervalMSecs);
|
||||||
void setWindow(uint16_t windowMSecs);
|
void setWindow(uint16_t windowMSecs);
|
||||||
bool start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults), bool is_continue = false);
|
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 stop();
|
||||||
void erase(BLEAddress address);
|
void erase(BLEAddress address);
|
||||||
BLEScanResults getResults();
|
BLEScanResults* getResults();
|
||||||
void clearResults();
|
void clearResults();
|
||||||
|
|
||||||
#ifdef SOC_BLE_50_SUPPORTED
|
#ifdef SOC_BLE_50_SUPPORTED
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue