I am trying to get notification data from my smartwatch. I figured out almost everything. But data received on the serial monitor makes no sense to me.
this is serial monitor output.
Notify callback for characteristic c3e6c1a2-e966-1000-8000-be99c223df6a of data length 14
RAW DATA: U0
pROC DATA: U0
Data from the device look like this:
55-30-00-06-00-88-00-00-0A-00-B2-00-01-60
which is hexadecimal, last byte 60 represents the O2 value which in decimal is 96. 10th byte is the identifier of the reading type which in this case is O2 measurement.
Here is another value received by notification.
I haven't yet figured out what this means. but could step count, duration, calories burnt, and Heartrate values.
I want to get the type of reading and actual value of measurement.
Notification Callback function:
//When the BLE Server sends a new temperature reading with the notify property
static void temperatureNotifyCallback(BLERemoteCharacteristic* pBLERemoteCharacteristic,
uint8_t* pData,
size_t length,
bool isNotify) {
Serial.print("Notify callback for characteristic ");
Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str());
Serial.print(" of data length ");
Serial.println(length);
//store temperature value
Serial.print("RAW DATA: ");
Serial.println((char*)pData);
String strData;
strData.reserve(length);
for (int i = 0; i < 24; i++) {
strData += (char)pData[i];
}
Serial.print("pROC DATA: ");
Serial.println(strData);
newTemperature = true;
}
I don't know what I am doing wrong here. Can someone please guide me? and I am not a programmer
thanks
You might want to take a course to become a programmer, or hire an experienced programmer if you need to do it quickly.
I don't know what I am doing wrong here.
There are many smartwatch models, try to find the communication protocol for the model you have in hand. If you have a working system, such as an Android App, you might be able to reverse engineer the App to understand how data is handled.
Hi, thanks for your reply. I have done projects with Arduino. When i said i am not a programmer i meant not a professional programmer. Just tinkering around with Arduino since long time.
i figured out the protocol and data handling use nrfconnect app, WireShark. by sniffing data packets passing through android to watch. I know how to take different kind of readings etc.
but here problem is the data received from watch is incomplete only first two bytes are getting printed on serial monitor. i don't know if it is size limit of data transfer of esp-32 or something else.
This is modified code of Arduino ESP-32 BLE example. i added service UUID's and characteristic UUID's . I am able to connect to watch and can receive notification data. but for some reasons data received by ESP-32 is incomplete only first few bytes are getting printed on serial monitor.
I can post the code somewhere if you want to have a look.
I intercepted data packets with wireshark going through my android phone app to watch. that's how i am able to decode data packets.