Add template casting to readValue and advertisement data (#52)

The value returned by reading a remote characteristic or by getting a notification for it is kept in the class instance of the NimBLERemoteCharacteristic. This value can be accessed as a std::string type using the getValue() function.

This adds templates to read the value in the type used by the peripheral. The same functionality is implemented for getting the manufacturer data or the service data of an advertised device.
This commit is contained in:
h2zero
2020-05-29 20:02:26 -06:00
parent 10f544f80a
commit 99ad62cdd4
4 changed files with 52 additions and 6 deletions

View File

@@ -725,6 +725,7 @@ uint16_t NimBLEClient::getMTU() {
(*characteristic)->m_timestamp = time(nullptr);
(*characteristic)->m_semaphoreReadCharEvt.give();
}
if ((*characteristic)->m_notifyCallback != nullptr) {
NIMBLE_LOGD(LOG_TAG, "Invoking callback for notification on characteristic %s",
(*characteristic)->toString().c_str());