Core Electronics Forum

ESP32 BLECharacteristic ->getData() limitation

I am using the Adafruit HUZZAH32 Feather with the Arduino IDE.
It seems that when it comes to reading BLE Characteristic data we are currently limited to:

std::string getValue(); //which reads string data only
uint8_t* getData(); //which reads an unsigned single byte only

example>

uint8_t* = pBLEchannel->getData();

After much testing it appears as though the sending of anything other than a single byte (float, double, record data) has to be sent as a string and then decoded again at the ESP32 end after a string read.
Is this actually the case or is there some way of reading the raw data values (multiple byte) from ->getData()?

I think this has to do with how the data is sent by the bluetooth, by tradition a lot of stuff is done in 8-bits with embedded systems. I think the easiest way around this is to pass in the string then to use pointers and cast the values as doubles or whatever type you need.

1 Like