From bd395fa173a0d79a97b3654bf4250f630edbcda6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Sep 2019 14:00:46 +0900 Subject: [PATCH] Fix Not by reference. But the value was updated. --- libraries/BLE/src/BLERemoteService.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/BLE/src/BLERemoteService.cpp b/libraries/BLE/src/BLERemoteService.cpp index 754e8ac22d5..ddfb539ee02 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -230,7 +230,15 @@ std::map* BLERemoteService::getCharacteri * @brief This function is designed to get characteristics map when we have multiple characteristics with the same UUID */ void BLERemoteService::getCharacteristics(std::map* pCharacteristicMap) { - pCharacteristicMap = &m_characteristicMapByHandle; + log_v(">> getCharacteristics() for service: %s", getUUID().toString().c_str()); + // If is possible that we have not read the characteristics associated with the service so do that + // now. The request to retrieve the characteristics by calling "retrieveCharacteristics" is a blocking + // call and does not return until all the characteristics are available. + if (!m_haveCharacteristics) { + retrieveCharacteristics(); + } + log_v("<< getCharacteristics() for service: %s", getUUID().toString().c_str()); + *pCharacteristicMap = m_characteristicMapByHandle; } // Get the characteristics map. /**