Bellafaire / Android-Companion-App-For-BLE-Devices

Provides an open source app which can send phone notifications and control phone functions over BLE
MIT License
43 stars 7 forks source link

Feature Request: BLE to Websocket adapter #2

Open Xasin opened 3 years ago

Xasin commented 3 years ago

Hi Bellafaire! Thank you so much for already forking out this project into a separate GitHub repo to make it easier to re-use.

I was wondering if it were possible to add a method for the BLE device to send and receive data to/from a Websocket connection, to allow arbitrary information transfer between a BLE device and a websocket endpoint, preferably in the form of a BLE characteristic (like the old BT SPP channel).

This shouldn't be too hard to add since the app itself should perform little to no intermediate processing apart from stitching packets together from the 8-Byte BLE limit, but I don't know how complex the Java libraries are for this kind of situation.

If this is something you would be willing to add I'd be delighted, otherwise I'd probably nip on this myself eventually and open a PR once I get something working.

I'd want to use this for one of my upcoming projects, the TapV2 badge, to allow continuous communication of my BLE-based wearable with a central server.

Bellafaire commented 3 years ago

That's a very cool idea that could open a lot of possibilities for a connected device. I will give it a look

Xasin commented 3 years ago

Thanks a lot! As long as the BLE device can set which WebSocket connection it wants to talk to, and can transmit arbitrary (reasonably sized) binary packets, I'd be happy. SLIP encoding or similar over a standard "BLE SPP" Characteristic could almost be enough, and that way the app can remain basically the same for a wide variety of BLE projects that could then interface with all sorts of services.

:+1: