GATT service on RuuviTag #7231
Replies: 1 comment
-
Posted at 2018-07-16 by @gfwilliams It probably also says something like The issue is that you're still connected to the RuuviTag over BLE, and the Nordic chips can't change their services on the fly (they can't remove/re-order them). So... Espruino has to wait until you disconnect, then it can restart the Bluetooth LE stack and add the services and everything will work. I think if you just upload and disconnect you'll find everything is actually working as you expect. Posted at 2018-07-16 by louisld Yes i get this message. Thank you very much. I will try to use BLE with the IDE disconnected. Posted at 2018-07-16 by louisld When I'm connecting to RuuvTag with nRFC app on android I can see service but I can't see the characteristic. Posted at 2018-07-16 by @gfwilliams Try using The change will just make it clear to Espruino that you want the temperature in a single byte value. Posted at 2018-07-16 by louisld I tried several times but nothing changed. Here is my new code :
Here is what I get with my phone : Posted at 2018-07-17 by @gfwilliams Actually I just tried this on a Pixl.js - what happens is when you disconnect it does the Bluetooth restart and tries to add the service. However the Bluetooth stack itself throws an error, because That error would get reported to the console, but obviously it can't because you're disconnected! I think you meant to use If you use that it'll be fine. Posted at 2018-07-17 by louisld Ok, I understand I can't put the characteristic I want in a random service.
Posted at 2018-07-17 by louisld When i delete the NRF.updateServices function I get no error. But I still can't see the service. Posted at 2018-07-17 by @gfwilliams Well, I just tried your previous example here with 0x180D (and on-board temperature so it works on other devices) and it works fine:
You can't 'read' the service because you didn't specify Posted at 2018-07-17 by @gfwilliams Just to add, the docs for Neither Posted at 2018-07-17 by louisld Ok thank you so much it works ! Just a last question : if I want to use another service than that of heart rate should I use heart service and just change the name or there is a specific service ? Posted at 2018-07-17 by @gfwilliams You're not really supposed to re-use UUIDs for different things, so the Bluetooth SIG suggests you should use a totally random 128 bit UUID (the chances of duplicates and then basically nothing). So, go to a site like this and get a random UUID - for instance:
Then just change the second group of 4 for all your services and characteristics, eg:
So then you have:
And you're sorted. The only gotcha is advertising 128bit UUIDs is hard since they use up a lot of your available space for advertising - so honestly I'd avoid that and would instead try to find your device based on its name (which you can easily change). Posted at 2018-07-17 by louisld Thank you for your grateful help ! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-07-16 by louisld
Hello,
I'm trying to set up a GATT service on the Ruuvitag. I used the Espruino's documentation to find that code :
But when I run it on the Ruuvitag, I got the following error from the javascript console :
I don't know what i'm doing wrong. Thanks for helping me.
Beta Was this translation helpful? Give feedback.
All reactions