I am building a ReactNative application that will receive the data from another machine/ device via BLE. I am using this package, https://www.npmjs.com/package/react-native-ble-plx to implement the BLE logic. Now, I am having a problem decoding the characteristic value that I received from the monitor function.
This is my code
char.monitor((err, cha) => {
if (err) {
console.log("Monitoring error");
console.log(err);
return
}
console.log("char data received")
console.log(base64.decode(cha.value))
console.log(cha.value)
})
When the data is received, as you can see I am base64-decoding it to get its original value. But it seems that the data is not decoded into the right format.
For example,
This is the original value
/hkABQAAMgAA//9kIwAAAACqAAEAAAAAigMAAA==
But it is decoded into the following value.
þ↓♣2ÿÿd#ª☺Š♥
As you can see it is not readable at all. The decoded value even contains the weird characters. I am using this ReactNative base64 package, https://www.npmjs.com/package/react-native-base64. What is missing in my code and how can I fix it?
This is the service UUID, 00001826-0000-1000-8000-00805F9B34FB and this is the characteristic UUID, 00002AD1-0000-1000-8000-00805F9B34FB.
Also, this documentation might be useful because I am trying to receive data from WaterRower machine, https://github.com/WaterRower-UK/WaterRowerData-iOS/blob/master/Sources/WaterRowerData-BLE/FTMS_v1.0.pdf.