-
Notifications
You must be signed in to change notification settings - Fork 9
Deal with unfriendly FTMS machines #26
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
Conversation
…be all machine types simultaneously
…be all machine types simultaneously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for FTMS devices that expose multiple data characteristics by introducing an optional preferredDeviceDataType parameter to the useDeviceDataCharacteristic method. This addresses the issue where some devices (like certain rowers) expose all FTMS machine type characteristics but only populate data in one stream.
Changes:
- Added optional
preferredDeviceDataTypeparameter touseDeviceDataCharacteristicmethod with fallback to automatic detection - Implemented
isDeviceDataTypeSupportedhelper method to check if a specific device type is supported - Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/flutter_ftms.dart | Added optional preferredDeviceDataType parameter with logic to prefer specified type when supported |
| lib/src/ftms_bluetooth.dart | Added isDeviceDataTypeSupported method and applied formatting improvements |
| test/flutter_ftms_test.dart | New test file with comprehensive tests for preferred device type functionality |
| test/ftms_bluetooth_test.dart | Added tests for isDeviceDataTypeSupported method |
| test/flutter_ftms_test.mocks.dart | Generated mock file for new test suite |
| test/ftms_bluetooth_test.mocks.dart | Updated mocks to include CharacteristicProperties |
| example/pubspec.lock | Version bump to 1.3.0 and dependency updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
Looks good. Could you please update the |
Thanks. I've just updated README as well. |
|
Released in |
|
Thanks! Cheers! |
Hi @Malte2036,
I recently faced a problem with some cheap FTMS rower.
This rower exposed characteristics for all the machine types supported by FTMS specification:
But only one data stream is populated with data, the rower one (2ad1).
Although the FTMS specification does not forbid having multiple characteristics like that, I find this weird ...
Therefore, the FTMSBluetooth.getDeviceDataType method returns crossTrainer in that situation:
So, when calling FTMS.useDeviceDataCharacteristic, we always subscribe to the crossTrainer data stream, which is always empty on our rower.
I thought that it would be useful to add an optional parameter, named preferredDeviceDataType, to the useDeviceDataCharacteristic method as it follows:
That parameter, if set, gives a hint about what characteristic should we subscribe for. If the characteristic is supported by the device, then we subscribe to it.
If it's not supported then we continue as before.
This gives the opportunity for the caller to choose what kind of machine it is likely to support.
What do you think? Or perhaps do you have other ideas?