Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bless implementation #473

Closed
firux88 opened this issue Dec 9, 2024 · 4 comments
Closed

Bless implementation #473

firux88 opened this issue Dec 9, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@firux88
Copy link

firux88 commented Dec 9, 2024

While trying to make bless work, I got this error :TypeError: Can't instantiate abstract class BlessServerWinRT without an implementation for abstract method 'add_new_descriptor'

I've tried some tricks from GPT but i'm unable to make it work.
I dont think it's related to the bluetooth device but I'm with a TP-LINK UB500 with winusb 6.1 driver

Any idea ?

Thank you

I dont think it's related to the bluetooth device but I'm with a TP-LINK UB500 with winusb 6.1 driver

Exception in thread Thread-2 (_OpenThread):
Traceback (most recent call last):
File "C:\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Python312\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "C:\github\FortiusANT-master\pythoncode\bleBlessClass.py", line 145, in _OpenThread
self.loop.run_until_complete(self._Server())
File "C:\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\github\FortiusANT-master\pythoncode\bleBlessClass.py", line 169, in _Server
self.BlessServer = BlessServer(name=self.myServiceName, loop=self.loop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Can't instantiate abstract class BlessServerWinRT without an implementation for abstract method 'add_new_descriptor'
12:54:35,965: ---------- BLE-devices are activated ----------
Exception in thread Thread-1 (Tacx2DongleThread):
Traceback (most recent call last):
File "C:\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Python312\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "C:\github\FortiusANT-master\pythoncode\FortiusAnt.py", line 490, in Tacx2DongleThread
rtn = Tacx2Dongle(self)
^^^^^^^^^^^^^^^^^
File "C:\github\FortiusANT-master\pythoncode\FortiusAnt.py", line 171, in Tacx2Dongle
rtn = FortiusAntBody.Tacx2Dongle(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\github\FortiusANT-master\pythoncode\FortiusAntBody.py", line 681, in Tacx2Dongle
rtn = Tacx2DongleSub(FortiusAntGui, Restart)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\github\FortiusANT-master\pythoncode\FortiusAntBody.py", line 1407, in Tacx2DongleSub
bleCTP.SetAthleteData(HeartRate)
File "C:\github\FortiusANT-master\pythoncode\bleBless.py", line 358, in SetAthleteData
self.BlessServer.get_characteristic(bc.cHeartRateMeasurementUUID).value = info
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_characteristic'

@WouterJD
Copy link
Owner

WouterJD commented Dec 9, 2024

Hey Jimmy, bad luck that it does not work.
I was just about looking into these BLE-questions.

The first implementation (-b) used node.js, which is a complex but stable implementation (as soon it works).
"Native" python ble (-bb) would be easier, but proves to be less stable...

For what it's worth; I continue usinig FortiusAnt with two ANT-interfaces, but yeah - if you want to use a CTP running on your smartphone that's not a feasable route.

@WouterJD
Copy link
Owner

WouterJD commented Dec 9, 2024

So how do I test bleBless after having installed pip, python and requirements?

Step 1 - Start bleBless in testmode
The bleBless.py module has a built-in test mode that can be started as bleBless.py from the pythoncode folder.
You will see the following output:

FTMS server in FortiusAnt context
bleBless started
----------------
Message=, Bluetooth interface available (bless)
Message=, Bluetooth interface open
19:17:27,156: ---------------------------------------------------------------------------------------
19:17:27,161: FortiusAnt simulated trainer is active
19:17:27,163: Start a training in a CTP; 5 seconds after completing the training, simulation will end
19:17:27,165: ---------------------------------------------------------------------------------------
Client=False HasControl=False Started=False TargetPower= 100 TargetGrade=0      Speed=228 Cadence=128, Power=328, HeartRate= 28 Angle=   -2
Client=False HasControl=False Started=False TargetPower= 100 TargetGrade=0      Speed=229 Cadence=129, Power=329, HeartRate= 29 Angle=   -1
Client=False HasControl=False Started=False TargetPower= 100 TargetGrade=0      Speed=230 Cadence=130, Power=330, HeartRate= 30 Angle=    0
Client=False HasControl=False Started=False TargetPower= 100 TargetGrade=0      Speed=231 Cadence=131, Power=331, HeartRate= 31 Angle=    1
Client=False HasControl=False Started=False TargetPower= 100 TargetGrade=0      Speed=232 Cadence=132, Power=332, HeartRate= 32 Angle=    2

bleBless is now a FTMS (Fitness Machine Server) simulating a trainer.

Step 2 - connect the CTP

Now start a CTP, for example Trainer Road, and search for a trainer.
Trainer Road in my case shows FortiusAnt in the following way
Now connect the CTP to the trainer and the simulated data will be shown:
Then disconnect the CTP from the trainer.

Step 2b - Output from bleBless
While connected, bleBless will display the following:

Client=True  HasControl=True  Started=False TargetPower= 100 TargetGrade=0      Speed=237 Cadence=137, Power=337, HeartRate= 37 Angle=    7
Client=True  HasControl=True  Started=False TargetPower= 100 TargetGrade=0      Speed=238 Cadence=138, Power=338, HeartRate= 38 Angle=    8
Client=True  HasControl=True  Started=False TargetPower= 100 TargetGrade=0      Speed=239 Cadence=139, Power=339, HeartRate= 39 Angle=    9
Client=True  HasControl=True  Started=False TargetPower= 100 TargetGrade=0      Speed=240 Cadence=140, Power=340, HeartRate= 40 Angle=   10
Client=True  HasControl=True  Started=False TargetPower= 100 TargetGrade=0      Speed=241 Cadence=141, Power=341, HeartRate= 41 Angle=   11

Step 3 - Completion
After disconnect, bleBless will send 5 last messages and end.

Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=200 Cadence=100, Power=300, HeartRate=  0 Angle=  -30
Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=201 Cadence=101, Power=301, HeartRate=  1 Angle=  -29
Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=202 Cadence=102, Power=302, HeartRate=  2 Angle=  -28
Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=203 Cadence=103, Power=303, HeartRate=  3 Angle=  -27
Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=204 Cadence=104, Power=304, HeartRate=  4 Angle=  -26
Client=False HasControl=False Started=False TargetPower=  50 TargetGrade=0      Speed=205 Cadence=105, Power=305, HeartRate=  5 Angle=  -25
19:18:05,690: FortiusAnt simulated trainer is stopped
19:18:05,692: ---------------------------------------
Message=, Bluetooth interface closed
bleBless ended

Summary
Conclusion from the test:

  • all modules are correctly installed
  • the ble interface is working

Using this bleBless test-function, you can test the BLE interface without bothering for the trainer to be well connected.
All that is used is the configuration:

  • computer running FortiusAnt, in my case a windows 10 computer
  • smartphone with a CTP installed, in my case TrainerRoad

I hope this helps you in narrowing down the problem.

@WouterJD
Copy link
Owner

WouterJD commented Dec 9, 2024

I wrote this test-procedure to refresh my own memory on the subject and also because there are more issues with the -b interface.

What I remember from the development period is that there are "Blue tooth 5" dongles which are not entirely bluetooth 5.
All I know is what I wrote down in the manual section 3.8.1. My hardware manager tells me I'm using a Realtek bluetooth 5.0 device.

so your thought

I dont think it's related to the bluetooth device but I'm with a TP-LINK UB500 with winusb 6.1 driver
may be incorrect...

@WouterJD WouterJD added the help wanted Extra attention is needed label Dec 9, 2024
@WouterJD
Copy link
Owner

Since there is no communication here, I assume can be closed.
If not happy to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants