I have a Xiaomi MI Scale 2 and I want to read the weight using an MDBT42Q using it's BLE. I've found the protocol defined here: https://github.com/oliexdev/openScale/wiki/Xiaomi-Bluetooth-Mi-Scale
For reading the weight I need to subscribe to the 00002a9d-0000-1000-8000-00805f9b34fb Gatt Characteristic. This characteristic enables me to subcribe to it using indications (not notifications).
I wolud like to know if it's posible to subscribe to indications in a similar way that is used for notifications (startNotifications function).
Thank you in advance.
Using startNotifications should 'just work'. It actually checks what the characteristic supports - if it supports notify it does that but otherwise if it does indicate it does that instead... the code where it does this is at https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L3293-L3299
As part of my research I seen this part of code, so I was confident that the indications will work. The problem appeared when I needed to communicate with the above mentioned device(Xiaomi Mi Scale 2).
The characteristic that I need to use has only set as true the indicate parameter. I've written some code to subscribe using the startNotifications() function, the problem is that I only received one packet of data, after that it seems that the device get stuck as is waiting for the ACK packet necesary to finish the indication reading procedure.
I will try to create using 2 espruino devices an example to do it more reproducible without buying a Scale.
Thank you for your fast response.
Thanks - so you think it's likely Espruino doesn't send the ACK for indications, and that's breaking it for you?
Yes, this what I think it's happening. Unfortunately I didn't have time to create a testbench to test it yet. I want to do it, as soon as possible, for sharing with you and try to discover where is the problem.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem