google / web-serial-polyfill

Apache License 2.0
105 stars 27 forks source link

Add support for bluetooth serial devices #55

Open 95gabor opened 11 months ago

95gabor commented 11 months ago

I love this project. Could you also provide Bluetooth support for serial devices?

reillyeon commented 11 months ago

There are issues like #7 which reference specific proprietary Serial-over-X protocols (e.g. the Nordic Bluetooth GATT UART). Is this request referring to another Serial-over-GATT protocol or Serial-over-Bluetooth Classic (i.e. RFCOMM)?

reillyeon commented 11 months ago

Also to set expectations, I don't have time to implement any particular protocol in this library but I am happy to review patches adding such support.

95gabor commented 11 months ago

There are issues like #7, which reference specific proprietary Serial-over-X protocols (e.g. the Nordic Bluetooth GATT UART). Is this request referring to another Serial-over-GATT protocol or Serial-over-Bluetooth Classic (i.e. RFCOMM)?

Yes, I think Bluetooth GATT is what I need, but I'm not sure since I'm currently using the web serial interface, which hides this from me. (I just want to make it available for Android devices as well)

Also to set expectations, I don't have time to implement any particular protocol in this library but I am happy to review patches adding such support.

It's understandable, I'll try to implement it, but it's still a foreign area for me.

reillyeon commented 11 months ago

There are issues like #7, which reference specific proprietary Serial-over-X protocols (e.g. the Nordic Bluetooth GATT UART). Is this request referring to another Serial-over-GATT protocol or Serial-over-Bluetooth Classic (i.e. RFCOMM)?

Yes, I think Bluetooth GATT is what I need, but I'm not sure since I'm currently using the web serial interface, which hides this from me. (I just want to make it available for Android devices as well)

If the browser-implemented Web Serial API is working for your device then this is probably Bluetooth Classic rather than Bluetooth GATT. This reason for this assumption is that I don't think there's a standard protocol for Serial-over-GATT which your operating system is detecting an creating a platform-level serial port from that the browser detects. Unfortunately this means there isn't an option for implementing support for such a device through this polyfill as there isn't any other web API which provides access to Bluetooth Classic devices.

We are working on shipping built-in support for Bluetooth Classic devices in Chromium, initially targeting desktop platforms but once the API changes have landed adding support for Android should be a straightforward follow-up project.