Skip to content

Commit 675a40b

Browse files
Fix Not by reference. But the value was updated. (#3279)
1 parent 3570d48 commit 675a40b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: libraries/BLE/src/BLERemoteService.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,15 @@ std::map<uint16_t, BLERemoteCharacteristic*>* BLERemoteService::getCharacteristi
244244
* @brief This function is designed to get characteristics map when we have multiple characteristics with the same UUID
245245
*/
246246
void BLERemoteService::getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic*>* pCharacteristicMap) {
247-
pCharacteristicMap = &m_characteristicMapByHandle;
247+
log_v(">> getCharacteristics() for service: %s", getUUID().toString().c_str());
248+
// If is possible that we have not read the characteristics associated with the service so do that
249+
// now. The request to retrieve the characteristics by calling "retrieveCharacteristics" is a blocking
250+
// call and does not return until all the characteristics are available.
251+
if (!m_haveCharacteristics) {
252+
retrieveCharacteristics();
253+
}
254+
log_v("<< getCharacteristics() for service: %s", getUUID().toString().c_str());
255+
*pCharacteristicMap = m_characteristicMapByHandle;
248256
} // Get the characteristics map.
249257

250258
/**

0 commit comments

Comments
 (0)