From 675a40b25790901a906b5ead57730b3053cc8d00 Mon Sep 17 00:00:00 2001 From: TANAKA Masayuki Date: Sat, 3 Oct 2020 09:41:03 +0900 Subject: [PATCH] Fix Not by reference. But the value was updated. (#3279) --- 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 3b5b52d7..dfd36a90 100644 --- a/libraries/BLE/src/BLERemoteService.cpp +++ b/libraries/BLE/src/BLERemoteService.cpp @@ -244,7 +244,15 @@ std::map* BLERemoteService::getCharacteristi * @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. /**