parent
c2b3f2d6af
commit
24b277ad92
@ -389,6 +389,17 @@ uint8_t BLERemoteCharacteristic::readUInt8() {
|
|||||||
return 0;
|
return 0;
|
||||||
} // readUInt8
|
} // 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.
|
* @brief Read the value of the remote characteristic.
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
uint8_t readUInt8();
|
uint8_t readUInt8();
|
||||||
uint16_t readUInt16();
|
uint16_t readUInt16();
|
||||||
uint32_t readUInt32();
|
uint32_t readUInt32();
|
||||||
|
float readFloat();
|
||||||
void registerForNotify(notify_callback _callback, bool notifications = true);
|
void registerForNotify(notify_callback _callback, bool notifications = true);
|
||||||
void writeValue(uint8_t* data, size_t length, bool response = false);
|
void writeValue(uint8_t* data, size_t length, bool response = false);
|
||||||
void writeValue(std::string newValue, bool response = false);
|
void writeValue(std::string newValue, bool response = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user