I am using the code available here, https://www.espruino.com/UART.js, to use UART on RuvviTag. According to the uart.js code, it always asks to connect to a bluetooth device. Is there anyway I can modify the code to automatically connect to my RuuviTag?
Bluetooth over a browser uses the Web Bluetooth specification, and having the user select the bluetooth device is a security feature. Imagine you have a bluetooth device that contains information about you (like a watch) then a scammer asks you to visit a page that would try to connect to a bluetooth device around without that UI popping up.
See also https://stackoverflow.com/a/54149101
I just added another possible answer to that stackoverflow question linked above: https://stackoverflow.com/questions/54132319/override-default-behavior-of-navigator-bluetooth-requestdevice/63454399#63454399
On newer chrome devices it's possible if you have connected before.
However if you're asking about the Bluetooth prompt specifically then right now I don't have a way to disable it, however you could use the Puck.js library which has the same API and is bluetooth only, so doesn't have the prompt: http://www.espruino.com/Web+Bluetooth
It'll still ask you which device to connect to though!
Just a heads up, its out! :) https://www.chromestatus.com/features/4797798639730688 Will have to play around with this.
Thanks @Gordon for the heads up :)
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