Add readFloat to BLE (#3321)

* Add readFloat

* Add readFloat to BLE
This commit is contained in:
copercini
2019-10-06 11:28:53 -03:00
committed by Me No Dev
parent c2b3f2d6af
commit 24b277ad92
2 changed files with 12 additions and 0 deletions

View File

@ -389,6 +389,17 @@ uint8_t BLERemoteCharacteristic::readUInt8() {
return 0;
} // readUInt8
/**
* @brief Read a float value.
* @return the float value.
*/
float BLERemoteCharacteristic::readFloat() {
std::string value = readValue();
if (value.length() >= 4) {
return *(float*)(value.data());
}
return 0.0;
} // readFloat
/**
* @brief Read the value of the remote characteristic.