correct version of BLE libraries

last working version of this library with the ESP32 env revision pointed in the wiki
This commit is contained in:
Florian committed 2018-07-04 22:39:33 +02:00
1 parent 9dd7b97b11
commit b602e406ef
23 files changed
+72 -461

No files matched your search

+6 -22
View File
@@ -74,9 +74,6 @@ void BLEScan::handleGAPEvent(
// asked to stop.
case ESP_GAP_SEARCH_INQ_CMPL_EVT: {
m_stopped = true;
if (m_scanCompleteCB != nullptr) {
m_scanCompleteCB(m_scanResults);
}
m_semaphoreScanEnd.give();
break;
} // ESP_GAP_SEARCH_INQ_CMPL_EVT
@@ -189,14 +186,12 @@ void BLEScan::setWindow(uint16_t windowMSecs) {
/**
* @brief Start scanning.
* @param [in] duration The duration in seconds for which to scan.
* @param [in] scanCompleteCB A function to be called when scanning has completed.
* @return True if scan started or false if there was an error.
* @return N/A.
*/
bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults)) {
BLEScanResults BLEScan::start(uint32_t duration) {
ESP_LOGD(LOG_TAG, ">> start(duration=%d)", duration);
m_semaphoreScanEnd.take(std::string("start"));
m_scanCompleteCB = scanCompleteCB; // Save the callback to be invoked when the scan completes.
m_scanResults.m_vectorAdvertisedDevices.clear();
@@ -205,7 +200,7 @@ bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults)) {
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gap_set_scan_params: err: %d, text: %s", errRc, GeneralUtils::errorToString(errRc));
m_semaphoreScanEnd.give();
return false;
return m_scanResults;
}
errRc = ::esp_ble_gap_start_scanning(duration);
@@ -213,25 +208,14 @@ bool BLEScan::start(uint32_t duration, void (*scanCompleteCB)(BLEScanResults)) {
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gap_start_scanning: err: %d, text: %s", errRc, GeneralUtils::errorToString(errRc));
m_semaphoreScanEnd.give();
return false;
return m_scanResults;
}
m_stopped = false;
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
ESP_LOGD(LOG_TAG, "<< start()");
return true;
} // start
/**
* @brief Start scanning and block until scanning has been completed.
* @param [in] duration The duration in seconds for which to scan.
* @return The BLEScanResults.
*/
BLEScanResults BLEScan::start(uint32_t duration) {
if(start(duration, nullptr)) {
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
}
return m_scanResults;
} // start