I'm not sure I understand the problem - you should just get a byte array from Android, and element 0 will be temperature, 1 will be light, etc. If you can read out the first byte to see what the data is, and the second byte to read the data itself then you're basically all the way to decoding everything.
You can always do:
function getMyData() {
return [
0,E.getTemperature(),
1,Puck.light()*256,
2,Puck.getBatteryPercentage(),
3,myState];
}
But if you want to send multiple different characteristics that you can read separately then that's what having multiple different characteristics is for...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm not sure I understand the problem - you should just get a byte array from Android, and element 0 will be temperature, 1 will be light, etc. If you can read out the first byte to see what the data is, and the second byte to read the data itself then you're basically all the way to decoding everything.
You can always do:
But if you want to send multiple different characteristics that you can read separately then that's what having multiple different characteristics is for...