asterics / Addon-Bluetooth-WebGUI

ESP32 Addon for FABI & FLipMouse, adding Bluetooth and WiFi/WebGUI support
GNU General Public License v3.0
5 stars 2 forks source link

Add support for Web Bluetooth connection to device #16

Open deinhofer opened 1 year ago

deinhofer commented 1 year ago

Web Bluetooth is implemented for many browsers and OSs including iOS and Android. So adding support for Web Bluetooth would enable to configure the devices (FABI, FlipMouse,...) from within a smart phone without having to connect it via a cable.

There is a library developed by Espruino which supports both Web Serial and Web Bluetooth connections. So this way we could consistently support both.

So on the client side it is probably not a big change, but I guess we would have to implement a Serial connection over Bluetooth in the firmware of our devices.

See more at:

benjaminaigner commented 1 year ago

I think the current WebSerial together with a Bluetooth based serial connection is no way, because it will never be supported on mobile devices (it would be the easiest option).

WebBluetooth does add Android to the list, but iOS is not working out of the box (you need to install a special browser):

https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API http://www.espruino.com/Quick+Start+BLE (iOS)

Nevertheless, you are right, we should add WebBluetooth for mobile configuration possibility.

We need to implement an additional GATT characteristics to the currently used HID ones. And this must be done for 2 different BT chipsets:

The uart.js library looks like they are using the "Nordic UART service" behind the scenes, which means we need these UUIDs to be compatible with the library (otherwise it won't work): https://github.com/espruino/EspruinoWebTools/blob/2ab71a33d69bfda40465174ffe57adb03c21fc42/uart.js#L117

Personally I really would like to have this feature, but I'm not sure when we should do that. In addition, we need to adapt the firmwares in the controllers (FM3, FABI2, FABI3) a little bit to distinguish between "serial" commands coming from the BT module or responses from the BT module to serial commands from USB-CDC.