I did not write this code, but coincidentally I am trying to do exactly what this code does (i.e. read the battery status of an LiTime 12V battery via bluetooth), but on a Particle MSOM running 6.2.1 instead of a browser. Scroll to the bottom, line 155 to see the relevant function.
The code above works well, but I need to do it on a Particle device. As far as I can tell, the battery level is only available via a GATT connection to the 0xFFE0 service. However, the Particle BLE library does not seem to have the necessary capabilities to request/read that. For example, the following methods (or similar) do not exist:
gatt.connect()
getPrimaryService(0xFFE0)
getServices()
getCharacteristics()
etc.
Am I missing something? Is there another library I could use? How can I work around this issue?