svenmeier / coxswain

Your rowing servant
http://play.google.com/store/apps/details?id=svenmeier.coxswain
Apache License 2.0
80 stars 21 forks source link

Feature: Expose BLE service #34

Closed frankHarmann closed 7 years ago

frankHarmann commented 7 years ago

It would be nice if the live data read from the waterrower could be exposed as a ble service (f.e. using the ble "cycling power profile" [see f.e. http://www.olympum.com/sports/rowing-with-waterrower-in-zwift] or even faking the pm5 ble profile (http://www.concept2.com/files/pdf/us/monitors/PM5_BluetoothSmartInterfaceDefinition.pdf) to allow connection of concept2 ble enabled apps ). BLE enabling the waterrower would allow connection to various apps (f.e. Kinomap).

svenmeier commented 7 years ago

Android devices can be a BLE server:

http://stackoverflow.com/questions/37181843/android-using-bluetoothgattserver

But I don't think this would allow other Apps to read any information running on the same device.

Maybe the following is more what you're looking for?

https://github.com/olympum/waterrower-ble
frankHarmann commented 7 years ago

Hmm, i am unsure about exposing a service and reading from it on the same device. I will do some tests myself and will report results. If it works i will try to port waterrower-ble to java so you just would have to call an update function after you read the parameters from the device. May take some while as my time is a bit limited at the moment. Regarding the service itself, cycling-power profile is currently probably the way to go as there is no official rowing profile in ble yet (just unofficial ones from concept2 or Wahoo GymConnect). But if one service works it would probably be no magic to expose different services ,-)

frankHarmann commented 7 years ago

Unfortunately you are right. Loopback like connections are prohibited somewhere in the bluetooth stack. So while it is possible to expose a ble service (at least on devices supporting ble periphal mode) it is not possible to connect to this service from an app running on the same device. As this limits the benefit of exposing a ble service i think it's not worth the work at the moment.

svenmeier commented 7 years ago

Many thanks for your investigation.

frankHarmann commented 7 years ago

Hmm, thinking of it. As the phone itself is not capable of ble lookback how about using some work already done (https://github.com/olympum/waterrower-ble) and just UDP broadcast the values (using the same format as waterrower-ble in network mode). For anyone wanting BLE connectivity it would then be easy to setup a device on the network (bluetooth enable pc, raspberry or anything capable of running node.js) to do the UDP->BLE part (as you only need to install the waterrower-ble package on that device). If needed you can then connect from the phone to the ble service using apps supporting ble (f.e. Wahoo Fitness or Zwift).

svenmeier commented 7 years ago

Interesting as it sounds, this is out-of-scope for Coxswain.