Compare commits

...

295 Commits

Author SHA1 Message Date
Jonas Bark
f0ad53e9d4 Merge branch 'zcv2' 2026-01-28 11:58:19 +01:00
Jonas Bark
b0bf0bd802 version++ 2026-01-28 11:57:47 +01:00
Jonas Bark
e3fc35211f cleanup 2026-01-28 11:56:01 +01:00
Jonas Bark
8c77bcea2a update translations 2026-01-28 09:59:18 +01:00
Jonas Bark
1693605305 move scan settings 2026-01-28 08:40:24 +01:00
jonasbark
93ad9d3a30 Update Wi-Fi SSID instructions for MyWhoosh Link
Clarify instructions regarding device connections for MyWhoosh Link.
2026-01-27 13:22:37 +01:00
Jonas Bark
15bc4ab2af version++ 2026-01-26 15:53:47 +01:00
Jonas Bark
6c0942acad make phone steering option more clear 2026-01-26 15:53:19 +01:00
Jonas Bark
351e702238 cleanup 2026-01-26 09:27:07 +01:00
Jonas Bark
8119d69c1a cleanup 2026-01-26 09:00:52 +01:00
Jonas Bark
13d11dd927 adjust logic 2026-01-24 14:22:12 +01:00
Jonas Bark
f4c47071fb fix build 2026-01-23 20:03:19 +01:00
Jonas Bark
7043d16108 actions 2026-01-23 19:05:42 +01:00
Jonas Bark
eb587c4341 actions 2026-01-23 18:48:06 +01:00
Jonas Bark
80bd4725d1 actions, logs fix 2026-01-23 18:31:28 +01:00
Jonas Bark
25ff46d527 update changelog, actions 2026-01-23 17:58:04 +01:00
Jonas Bark
7acd86fc94 UI adjustments 2026-01-23 17:48:29 +01:00
Jonas Bark
26047da35c update changelog, actions 2026-01-23 15:52:19 +01:00
Jonas Bark
d3ab4f8804 group buttons by device, add new unlock mechanism 2026-01-23 15:27:32 +01:00
Jonas Bark
29940d45ba version++ 2026-01-22 18:41:45 +01:00
Jonas Bark
c6296b009a version++ 2026-01-22 18:38:50 +01:00
Jonas Bark
130a638e2b version++ 2026-01-22 18:30:12 +01:00
Jonas Bark
12a5d9e52b version++ 2026-01-22 18:13:32 +01:00
Jonas Bark
2e69cdb593 version++ 2026-01-22 17:47:00 +01:00
Jonas Bark
6d6427f8cd fix macOS build issue 2026-01-22 17:31:52 +01:00
Jonas Bark
2d73d8577e fix macOS build issue 2026-01-22 17:11:17 +01:00
Jonas Bark
19e72af527 version++ 2026-01-22 16:44:48 +01:00
Jonas Bark
1692c584f4 update flutter 2026-01-22 16:44:26 +01:00
Jonas Bark
ab8e1b6afe fix build 2026-01-22 15:40:23 +01:00
Jonas Bark
9a7c4bb13a update changelog, translations 2026-01-22 14:47:17 +01:00
Jonas Bark
b97298099c Windows & macOS: allow configuration of volume keys on Bluetooth HID devices 2026-01-22 14:29:57 +01:00
Jonas Bark
a7a91e00a2 inform user to enable local connection method on Android 2026-01-22 14:10:15 +01:00
Jonas Bark
ad7d8276a2 update changelog 2026-01-22 08:22:55 +01:00
Jonas Bark
6d652ad70b show side identifier for Zwift Play 2026-01-21 13:06:26 +01:00
Jonas Bark
94d5b4ad92 improve default actions 2026-01-21 12:52:27 +01:00
Jonas Bark
792d2733ff add missing openbikecontrol actions 2026-01-21 10:33:17 +01:00
Jonas Bark
07e4b5e89f cleanup 2026-01-19 16:57:54 +01:00
Jonas Bark
fe271038cb fix media key buttons 2026-01-19 16:57:39 +01:00
Jonas Bark
51cb4859e3 fix import, adjust changelog 2026-01-19 11:18:43 +01:00
jonasbark
b4667ca894 Merge pull request #270 from jonasbark/copilot/add-device-button-config
Generalize per-device mappings for Bluetooth controllers and persist device IDs in keymaps
2026-01-19 11:02:00 +01:00
Jonas Bark
f79cfb6319 Merge branch 'main' of github.com:jonasbark/swiftcontrol 2026-01-19 11:01:45 +01:00
Jonas Bark
97279b7c16 update dependencies 2026-01-19 11:01:42 +01:00
copilot-swe-agent[bot]
5b8a64c356 refactor: generalize per-device button handling
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-19 09:55:00 +00:00
copilot-swe-agent[bot]
29777d86e0 feat: device-specific thinkrider mapping
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-19 09:37:14 +00:00
copilot-swe-agent[bot]
58440148b3 chore: update progress checklist
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-19 09:26:30 +00:00
copilot-swe-agent[bot]
bfcf43d428 feat: per-device cycplus mapping
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-19 09:23:06 +00:00
copilot-swe-agent[bot]
b8448d57e5 Initial plan 2026-01-19 09:13:25 +00:00
Jonas Bark
000104365c add OpenBikeControl protocol to onboarding 2026-01-19 08:23:30 +01:00
jonasbark
8141310f7b Update Windows Store version to 4.4.1 2026-01-17 19:08:48 +01:00
jonasbark
f432d9d187 Merge pull request #265 from jonasbark/copilot/add-special-keys-to-buttoneditor
Add Android global actions to local control button editor
2026-01-17 14:51:54 +01:00
Jonas Bark
5ab8ccc8c8 Merge branch 'copilot/add-special-keys-to-buttoneditor' of github.com:jonasbark/swiftcontrol into copilot/add-special-keys-to-buttoneditor
# Conflicts:
#	CHANGELOG.md
2026-01-17 14:48:25 +01:00
Jonas Bark
fd9818707e PR feedback 2026-01-17 14:46:22 +01:00
jonasbark
7422ff8624 Update CHANGELOG.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-17 14:39:56 +01:00
Jonas Bark
58cf7b5bf3 update changelog 2026-01-17 14:19:47 +01:00
Jonas Bark
87d71e1213 Android: simulate additional actions for local connection method (Left, Down, Right, Up, Down, Select, Back, Home, Recent Apps), allowing you to navigate in the trainer app, if supported 2026-01-17 13:52:27 +01:00
Jonas Bark
a0cde5352f Merge branch 'main' into copilot/add-special-keys-to-buttoneditor 2026-01-17 13:14:15 +01:00
copilot-swe-agent[bot]
b6ed1c047d Add Android global actions support
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-17 12:06:48 +00:00
Jonas Bark
8d8cb7381a fix configuration not updating for new buttons 2026-01-17 12:59:39 +01:00
copilot-swe-agent[bot]
f3bbf5e06c Initial plan 2026-01-17 11:50:53 +00:00
Jonas Bark
a5f9b42e6f Windows: fix media key detection 2026-01-17 12:11:14 +01:00
Jonas Bark
d053101c14 Merge branch 'main' of github.com:jonasbark/swiftcontrol 2026-01-17 12:01:26 +01:00
jonasbark
3022b15d3a Merge pull request #264 from jonasbark/copilot/fix-bikecontrol-gear-change-issue
Allow Rouvy gear changes while app is in background
2026-01-17 12:00:33 +01:00
jonas.bark@gmx.de
6b541e1d14 allow all apps to execute keyboard key in background 2026-01-17 11:58:15 +01:00
copilot-swe-agent[bot]
586b148ed3 Allow Rouvy gear changes while app is in background
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-17 09:11:34 +00:00
copilot-swe-agent[bot]
cf47a758ee Refine background window handling
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-17 09:10:56 +00:00
copilot-swe-agent[bot]
89230815a2 Allow background keypress for Rouvy
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-17 09:10:17 +00:00
copilot-swe-agent[bot]
60a176bba2 Initial plan 2026-01-17 09:07:01 +00:00
Jonas Bark
44b5c010ba cleanup 2026-01-16 13:29:44 +01:00
Jonas Bark
425c65528b change notification icon 2026-01-16 12:59:39 +01:00
Jonas Bark
8ac6f58d8e fix detection for hardware buttons when BikeControl is in foreground, change notification icon 2026-01-16 12:38:10 +01:00
Jonas Bark
f6ac724c60 fix iap logic on Android 2026-01-16 11:59:50 +01:00
Jonas Bark
9010346c0b cleanup 2026-01-16 00:44:08 +01:00
Jonas Bark
41a3a8f14d update changelog 2026-01-16 00:21:01 +01:00
Jonas Bark
a883abcd1c Merge remote-tracking branch 'origin/main' 2026-01-16 00:20:40 +01:00
Jonas Bark
ab37de8f40 fix issue #258 2026-01-16 00:20:30 +01:00
jonasbark
ac0e15eaa7 Update instructions for MyWhoosh Link connectivity 2026-01-15 17:06:46 +01:00
Jonas Bark
a6a7e7f0c2 show logs file path 2026-01-15 14:35:18 +01:00
Jonas Bark
3cacdf9a3a update changelog 2026-01-15 14:25:36 +01:00
Jonas Bark
3ebbda3690 kickr headwind: write without response to potentially fix #11 2026-01-15 08:55:03 +01:00
Jonas Bark
74abb13acf skip powermeters from connecting 2026-01-14 12:12:19 +01:00
Jonas Bark
86addc00fd Merge remote-tracking branch 'origin/win' 2026-01-13 18:42:52 +01:00
jonas.bark@gmx.de
9cebea225c fix import 2026-01-13 18:42:42 +01:00
jonasbark
59bdb30321 Merge pull request #255 from jonasbark/win
Win
2026-01-13 18:20:52 +01:00
Jonas Bark
d51fb7dfa2 update translations 2026-01-13 18:20:25 +01:00
jonas.bark@gmx.de
b955c51a91 cleanup 2026-01-13 18:07:35 +01:00
Jonas Bark
86ecd1ad20 check win package format 2026-01-13 17:57:01 +01:00
jonas.bark@gmx.de
c089b3bdbd fix test phase logic 2026-01-13 17:49:17 +01:00
Jonas Bark
9612b213aa adjust instructions 2026-01-13 11:49:27 +01:00
Jonas Bark
83c9b52708 Merge branch 'copilot/fix-bluetooth-keyboard-issue' 2026-01-12 18:43:46 +01:00
Jonas Bark
a7bde7c08a UI fix 2026-01-12 18:43:10 +01:00
Jonas Bark
c8613b5975 fix implementation 2026-01-12 18:42:54 +01:00
jonasbark
87bb728601 Merge pull request #253 from jonasbark/copilot/add-support-thinkrider-vs200
Add support for Thinkrider VS200 virtual shifter
2026-01-12 17:55:47 +01:00
copilot-swe-agent[bot]
e1f9d4fb08 Add debug logging for all received hexValues while in beta
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:55:12 +00:00
copilot-swe-agent[bot]
14e6c1186c Address code review feedback: memory leak and thread safety
- Store keymap update subscription to allow cancellation on re-init
- Fix List<String?> to List<String> in setHandledKeys signature
- Use ConcurrentHashMap.newKeySet() for thread-safe handledKeys access
- Clear and update the set instead of replacing it

Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:52:22 +00:00
copilot-swe-agent[bot]
abeb142f0b Fix case-insensitive pattern matching for VS200
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:50:52 +00:00
copilot-swe-agent[bot]
d416756614 Update VS200 logic: use only FEA0 service with specific byte patterns
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:49:48 +00:00
copilot-swe-agent[bot]
823eb9e9a4 Change approach: Use keymap-based filtering for HID key events
- Add setHandledKeys API to pass list of keys with keymaps to Android side
- Android AccessibilityService checks if key is in handled keys set before swallowing
- Dart side updates handled keys list whenever keymap changes
- Remove hardcoded media/volume key filtering
- This allows keyboards to work for typing while still capturing mapped keys

Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:49:19 +00:00
copilot-swe-agent[bot]
6579092f4a Update README with Thinkrider VS200 support
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:37:23 +00:00
copilot-swe-agent[bot]
c242c09025 Add support for Thinkrider VS200 virtual shifter
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:36:53 +00:00
copilot-swe-agent[bot]
89c9ed598c Fix Android accessibility service to only intercept media/volume keys
- Add isMediaOrVolumeKey() helper to filter key events by key code
- Only swallow media and volume keys (play/pause, next, volume up/down, etc.)
- Let all other keys (typing keys, navigation, etc.) pass through to the system
- This fixes Bluetooth keyboard interference when BikeControl is running

Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-01-12 16:36:18 +00:00
copilot-swe-agent[bot]
a3a592bd16 Initial plan 2026-01-12 16:31:49 +00:00
copilot-swe-agent[bot]
a161829913 Initial plan 2026-01-12 16:31:43 +00:00
Jonas Bark
b4473ad067 patch it 2026-01-11 15:48:57 +01:00
jonas.bark@gmx.de
4752f99fcf fix windows issue 2026-01-11 15:47:29 +01:00
Jonas Bark
6e757cf15c list supported actions of connection method 2026-01-11 13:01:10 +01:00
Jonas Bark
a87810db88 list supported actions of connection method 2026-01-11 13:00:43 +01:00
Jonas Bark
0ddb3e8081 clenaup 2026-01-11 12:11:28 +01:00
Jonas Bark
e29aed8bcf version++ 2026-01-11 11:28:43 +01:00
Jonas Bark
d99a3257af optional notification permission on macOS 2026-01-11 11:28:29 +01:00
Jonas Bark
a772b210cd don't connect to both Zwift Ride instances 2026-01-11 11:25:20 +01:00
Jonas Bark
860700ab91 version++ 2026-01-08 10:37:51 +01:00
Jonas Bark
ff5d90d468 fix Apple full version detection 2026-01-08 10:37:36 +01:00
Jonas Bark
43773310d5 ui fix, sync purchases once, Zwift Ride adjustment 2026-01-08 09:43:52 +01:00
jonasbark
2da65645b0 Update Windows Store version to 4.3.0 2026-01-07 14:04:51 +01:00
Jonas Bark
0c62d64987 version++ 2026-01-07 11:21:22 +01:00
Jonas Bark
546f6c2f8f version++ 2026-01-07 11:03:03 +01:00
Jonas Bark
a6ee15e3ba changelog adjustment 2026-01-07 10:37:46 +01:00
Jonas Bark
51793847cf performance & ui fixes 2026-01-07 10:36:41 +01:00
Jonas Bark
f308aa3847 performance & ui fixes 2026-01-07 10:19:21 +01:00
Jonas Bark
695b994577 fix shorebird logic 2026-01-06 18:08:56 +01:00
Jonas Bark
2301d04c61 refactor update UI 2026-01-06 09:10:27 +01:00
Jonas Bark
e46ec5172c OBC adjustments 2026-01-05 13:23:33 +01:00
Jonas Bark
691e108c82 OBC adjustments 2026-01-05 13:22:23 +01:00
Jonas Bark
166146a8f8 Web fixes 2026-01-03 20:50:06 +01:00
Jonas Bark
2a42cfc80f make notifications optional on macOS & iOS 2026-01-03 09:42:03 +01:00
Jonas Bark
aff1f20ebe Merge branch '4.2.4'
# Conflicts:
#	CHANGELOG.md
#	lib/utils/iap/revenuecat_service.dart
2026-01-02 21:02:54 +01:00
Jonas Bark
804fed799d fix logic 2026-01-02 21:02:02 +01:00
Jonas Bark
b6450ba47c restore button 2026-01-02 20:42:23 +01:00
Jonas Bark
14a4234583 instructions UI change 2026-01-02 15:03:46 +01:00
Jonas Bark
72cd165992 instructions for local connection method 2026-01-02 14:03:08 +01:00
Jonas Bark
239aec2083 onboarding UI 2026-01-01 13:50:02 +01:00
Jonas Bark
a43ab60dcb onboarding UI 2026-01-01 13:47:17 +01:00
Jonas Bark
484b7f74e6 onboarding UI 2026-01-01 13:44:45 +01:00
Jonas Bark
8c1ddcb019 ui adjustments 2026-01-01 12:40:45 +01:00
Jonas Bark
306a5badef onboarding for new users 2025-12-31 16:26:40 +01:00
Jonas Bark
e82003cd57 onboarding for new users 2025-12-31 16:16:37 +01:00
Jonas Bark
6a6aafe0a9 onboarding for new users 2025-12-31 15:52:30 +01:00
Jonas Bark
4bd440e167 ui adjustments 2025-12-31 13:51:47 +01:00
Jonas Bark
80d198787f ui adjustments 2025-12-31 12:26:34 +01:00
Jonas Bark
7f7bae477b debug text adjustments 2025-12-31 12:11:06 +01:00
Jonas Bark
2917814ecc alternative title during button editor 2025-12-30 17:45:06 +01:00
Jonas Bark
e268a86f20 fix media key icons 2025-12-30 14:12:55 +01:00
jonasbark
9a13831e91 Merge pull request #240 from jonasbark/copilot/enable-media-key-dispatching
Add media key dispatching for Desktop platforms
2025-12-30 14:04:12 +01:00
copilot-swe-agent[bot]
9f6e57b9ff Fix Windows compilation error: Cast UINT to WORD for wVk field
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:57:32 +00:00
Jonas Bark
86cf7491c3 Revert "issue"
This reverts commit 681ec710a1.
2025-12-30 13:55:30 +01:00
jonas.bark@gmx.de
681ec710a1 issue 2025-12-30 13:54:34 +01:00
Jonas Bark
dc40d61766 fix dart 2025-12-30 13:46:30 +01:00
copilot-swe-agent[bot]
326ff4ce24 Style: Fix code formatting and remove trailing comma in C++
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:43:50 +00:00
copilot-swe-agent[bot]
ca81642c5c Optimize: Make key maps static const for better performance
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:42:38 +00:00
copilot-swe-agent[bot]
32e4b9762b Refactor: Use maps instead of if-else chains for key mappings
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:41:13 +00:00
copilot-swe-agent[bot]
0c94852246 Use string identifiers instead of keyCode for media keys
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:39:26 +00:00
copilot-swe-agent[bot]
d2f67e402b Complete media key dispatching implementation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:36:10 +00:00
copilot-swe-agent[bot]
145e55fe68 Add proper error handling for media key dispatch
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:34:41 +00:00
copilot-swe-agent[bot]
fd6358c233 Fix command count increment order for media keys
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:33:21 +00:00
copilot-swe-agent[bot]
1d047ce9ef Fix code review issues: error message and type mismatch
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:31:44 +00:00
copilot-swe-agent[bot]
a27a0b8872 Improve documentation for macOS media stop key behavior
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:30:10 +00:00
copilot-swe-agent[bot]
0e98a9d500 Add media key dispatching support for Desktop platforms
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-30 12:27:55 +00:00
copilot-swe-agent[bot]
728b2e0b53 Initial plan 2025-12-30 12:21:42 +00:00
jonas.bark@gmx.de
220ffa49c6 fix windows notifications 2025-12-30 13:19:56 +01:00
jonas.bark@gmx.de
74d1ec58de fix a companion mode issue with delayed dispatches 2025-12-30 12:44:02 +01:00
Jonas Bark
b2d19f7e70 ignore messages when in background 2025-12-30 09:44:27 +01:00
Jonas Bark
7db8dfec62 message permission fix 2025-12-29 15:08:46 +01:00
Jonas Bark
b0c0767dc7 obp adjustments 2025-12-29 10:15:36 +01:00
Jonas Bark
2e880869f3 restore purchase 2025-12-29 09:19:06 +01:00
Jonas Bark
1edf949a7a Merge branch 'revenuecat' 2025-12-28 13:14:16 +01:00
Jonas Bark
04c85668fe Merge branch 'main' of github.com:jonasbark/swiftcontrol 2025-12-28 13:14:13 +01:00
Jonas Bark
fcefd863cd version++ 2025-12-28 13:13:57 +01:00
Jonas Bark
64bac7e50f revenue cat changes, italian translation 2025-12-28 13:12:20 +01:00
Jonas Bark
f94c1b1851 check original app version 2025-12-27 09:08:29 +01:00
Jonas Bark
3a013db311 Merge remote-tracking branch 'origin/main' into revenuecat 2025-12-27 09:04:13 +01:00
jonasbark
0fd141316e Revise MyWhoosh Link connection instructions
Updated instructions for using MyWhoosh Link connection method to clarify optional steps and improve readability.
2025-12-27 00:23:16 +01:00
Jonas Bark
2ed4f389c9 Merge branch 'main' into revenuecat 2025-12-26 23:15:47 +01:00
Jonas Bark
9a1a25ed17 unlock for now 2025-12-26 23:15:24 +01:00
Jonas Bark
173fae7472 handle old migrated purchases 2025-12-26 22:57:43 +01:00
Jonas Bark
82c9df2214 fix podfile 2025-12-26 20:35:59 +01:00
Jonas Bark
a49b6b81ae fix podfile 2025-12-26 20:35:53 +01:00
Jonas Bark
dffa7003bc Merge branch 'copilot/integrate-revenuecat-sdk' 2025-12-26 19:44:12 +01:00
Jonas Bark
818ff4909a implement logic 2025-12-26 19:36:20 +01:00
Jonas Bark
d1e054d5c5 implement logic 2025-12-26 18:48:57 +01:00
copilot-swe-agent[bot]
7689da9acd Add future improvements documentation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 13:03:53 +00:00
copilot-swe-agent[bot]
0bf336643d Add implementation summary documentation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 13:01:51 +00:00
copilot-swe-agent[bot]
70dc5d19e7 Fix async handling and improve error messages
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 13:00:52 +00:00
copilot-swe-agent[bot]
4da91b0fa3 Fix circular dependency and async issues in RevenueCat service
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 12:58:50 +00:00
copilot-swe-agent[bot]
cb219c57c4 Add comprehensive RevenueCat setup and configuration documentation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 12:55:16 +00:00
copilot-swe-agent[bot]
0be5500d78 Add RevenueCat SDK integration with paywall and customer center support
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-26 12:53:51 +00:00
copilot-swe-agent[bot]
94dcccdce3 Initial plan 2025-12-26 12:48:20 +00:00
Jonas Bark
91b6ffdbe2 version++ 2025-12-24 22:38:30 +01:00
Jonas Bark
baa3a73984 Merge branch 'hotfix' 2025-12-24 10:46:53 +01:00
Jonas Bark
dd5c231c47 hopefully fix iap issue on Android 2025-12-24 10:28:58 +01:00
Jonas Bark
3a0d4e1cbc hopefully fix iap issue on Android 2025-12-24 10:08:55 +01:00
Jonas Bark
631f031daa unit test adjustments 2025-12-23 09:10:05 +01:00
Jonas Bark
a487539e6a hotfix 2025-12-22 20:37:44 +01:00
Jonas Bark
ad7454236a hotfix 2025-12-22 20:17:27 +01:00
Jonas Bark
e182fea4d1 hotfix 2025-12-22 20:05:09 +01:00
Jonas Bark
6615061658 hotfix macOS 2025-12-22 20:00:17 +01:00
jonasbark
5c1d423806 Update CHANGELOG.md 2025-12-22 19:34:37 +01:00
Jonas Bark
171f97645f Merge branch 'main' of github.com:jonasbark/swiftcontrol 2025-12-22 19:24:14 +01:00
jonasbark
9511c233a2 Add iPadOS support to connection methods in README
Updated README to include iPadOS in connection methods.
2025-12-22 18:23:47 +01:00
jonasbark
adfc2bd8cf Update Windows Store version to 4.2.2 2025-12-22 15:29:26 +01:00
jonasbark
2adba27dca Fix formatting and clarify trainer app connection 2025-12-22 11:41:41 +01:00
Jonas Bark
b18c85fc8e improve Android notification action handling 2025-12-22 11:13:37 +01:00
Jonas Bark
2e79a43827 axs info 2025-12-22 08:21:02 +01:00
Jonas Bark
0fec34bb56 allow redeeming manually 2025-12-21 22:21:40 +01:00
Jonas Bark
db3e133199 allow redeeming manually 2025-12-21 22:17:47 +01:00
Jonas Bark
971cb91615 allow redeeming manually 2025-12-21 22:16:12 +01:00
Jonas Bark
e5e04f3d59 clarify Android transition 2025-12-21 20:33:51 +01:00
Jonas Bark
fd9f7388e8 check purchases once a day 2025-12-21 16:41:30 +01:00
Jonas Bark
6ae2297246 version++ 2025-12-21 16:00:10 +01:00
Jonas Bark
c6fb2e68b5 win fix 2025-12-21 15:43:44 +01:00
jonas.bark@gmx.de
c84c685a8f attempt to fix remaining trial days calculation 2025-12-21 15:42:17 +01:00
Jonas Bark
102f4a8818 add info for Android users regarding existing purchase 2025-12-21 13:54:08 +01:00
Jonas Bark
661d72fa8c windows adjustments 2025-12-21 10:29:53 +01:00
jonas.bark@gmx.de
38df962e43 windows trial changes 2025-12-21 10:25:52 +01:00
Jonas Bark
e02563733f fix missing entitlements on release builds for macOS 2025-12-20 20:40:53 +01:00
Jonas Bark
c246d2d1fe fix missing entitlements on release builds for macOS 2025-12-20 20:40:12 +01:00
Jonas Bark
8dbed9a8b5 wrong translation 2025-12-20 18:08:13 +01:00
Jonas Bark
6ea4fa82a7 version++ 2025-12-20 11:39:02 +01:00
Jonas Bark
0d78ca6352 version++ 2025-12-20 11:20:39 +01:00
Jonas Bark
b82ad80d1c fix windows build version 2025-12-20 10:56:19 +01:00
Jonas Bark
eece2ce7dc update changelog 2025-12-20 10:30:32 +01:00
jonasbark
3bfd7dd7ab Merge pull request #222 from jonasbark/copilot/implement-in-app-purchase
Implement IAP system with 5-day trial and command limiting
2025-12-20 10:13:33 +01:00
Jonas Bark
b0f3dffc3c screenshots 2025-12-20 10:13:20 +01:00
Jonas Bark
f5234d0c11 update changelog 2025-12-20 10:06:57 +01:00
Jonas Bark
8a12ccb01e cleanup 2025-12-20 10:04:44 +01:00
Jonas Bark
fac2e86240 bugfixes and clarifications 2025-12-20 10:01:37 +01:00
Jonas Bark
39b49bb9de sram fix 2025-12-19 21:06:13 +01:00
Jonas Bark
406ccfa2ce adjust iOS receipt logic 2025-12-19 20:41:45 +01:00
Jonas Bark
16e6b96cc7 SRAM AXS support 2025-12-19 20:41:27 +01:00
Jonas Bark
1e37c8a742 press longer for the simulator, enable long press for devices not supporting long press (e.g. Shimano Di2) 2025-12-19 11:40:07 +01:00
Jonas Bark
5f0389b36f press longer for the simulator, enable long press for devices not supporting long press (e.g. Shimano Di2) 2025-12-19 11:38:30 +01:00
Jonas Bark
8762d85d57 press longer for the simulator, enable long press for devices not supporting long press (e.g. Shimano Di2) 2025-12-19 11:33:13 +01:00
Jonas Bark
018bbd43f1 fix 2025-12-19 10:13:01 +01:00
Jonas Bark
756e3fc556 version++ 2025-12-19 10:09:06 +01:00
Jonas Bark
7ac5f5dbcb fine tune gryoscope logic to react more quickly 2025-12-19 09:29:19 +01:00
Jonas Bark
65c613fd24 fine tune gryoscope logic to react more quickly 2025-12-19 09:29:05 +01:00
Jonas Bark
e0ad9007a4 ui adjustments 2025-12-19 09:21:11 +01:00
Jonas Bark
c3cda5f547 ui adjustments, add polish translations 2025-12-19 08:56:14 +01:00
Jonas Bark
12f379c03d screenshot fix 2025-12-18 15:39:16 +01:00
Jonas Bark
e760c34ede unit test fixes 2025-12-18 15:30:14 +01:00
Jonas Bark
187a15a55d improve trainer controller view 2025-12-18 14:51:49 +01:00
Jonas Bark
3e4751a6b5 refactor sensor logic 2025-12-18 12:24:52 +01:00
Jonas Bark
b05d87196a implement functionality, refactoring 2025-12-18 12:06:34 +01:00
Jonas Bark
b8297848f6 Merge branch 'copilot/add-steering-detection-algorithm' into copilot/implement-in-app-purchase 2025-12-18 11:37:39 +01:00
Jonas Bark
de0f004a48 implement functionality, refactoring 2025-12-18 11:37:21 +01:00
Jonas Bark
0bc9c1d4d2 implement functionality, refactoring 2025-12-18 11:33:14 +01:00
Jonas Bark
3fccb59544 Merge branch 'copilot/implement-in-app-purchase' into copilot/add-steering-detection-algorithm 2025-12-18 09:46:45 +01:00
Jonas Bark
ea76aabf91 update changelog 2025-12-18 09:46:32 +01:00
Jonas Bark
dc1c900bd2 bugfix and animation 2025-12-18 09:26:25 +01:00
Jonas Bark
b1e59d8f2a auto-open key editor on key press 2025-12-18 08:46:31 +01:00
Jonas Bark
006148dbd0 move button simulator page button 2025-12-18 08:33:04 +01:00
Jonas Bark
974ba258f5 teaser new connection methods 2025-12-18 08:11:06 +01:00
copilot-swe-agent[bot]
29d833e9d1 Update README with gyroscope steering device information
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-18 06:55:33 +00:00
copilot-swe-agent[bot]
eea72405bb Fix code review issues in gyroscope steering implementation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-18 06:54:42 +00:00
copilot-swe-agent[bot]
e500f1ed0b Add unit tests for gyroscope steering algorithm
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-18 06:52:39 +00:00
copilot-swe-agent[bot]
6c3bd2e6a1 Add gyroscope/accelerometer steering support with sensor fusion
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-18 06:51:43 +00:00
copilot-swe-agent[bot]
e54d8968e8 Initial plan 2025-12-18 06:44:46 +00:00
Jonas Bark
9dca2e989a check sandbox on iOS / macOS 2025-12-17 15:57:44 +01:00
Jonas Bark
610c5d6ef5 check sandbox on iOS / macOS 2025-12-17 15:48:30 +01:00
Jonas Bark
7797b34852 improve keymap UI 2025-12-17 14:34:08 +01:00
Jonas Bark
99e9f326f7 fix build 2025-12-17 13:05:05 +01:00
Jonas Bark
0f2d73239b fix build 2025-12-17 12:57:32 +01:00
Jonas Bark
497b489ea9 remove Podfile.loc 2025-12-17 12:40:29 +01:00
Jonas Bark
51581f106a cleanup README.md 2025-12-17 12:17:00 +01:00
Jonas Bark
43e9aa02e0 cleanup README.md 2025-12-17 12:13:23 +01:00
Jonas Bark
089a41cc2b translations and ux changes 2025-12-17 11:39:39 +01:00
Jonas Bark
279ab101cc macOS fix 2025-12-17 11:13:42 +01:00
Jonas Bark
c0f278652e show connection update notifications 2025-12-17 10:54:16 +01:00
Jonas Bark
ac02cc78bc show connection update notifications 2025-12-17 10:34:40 +01:00
Jonas Bark
d42ac3af6b notifications on iOS 2025-12-17 10:20:36 +01:00
Jonas Bark
20cfe76091 limit to 80 on Android during trial period, only count sent out commands 2025-12-17 10:02:32 +01:00
Jonas Bark
b68170b489 fix purchause logic 2025-12-17 09:08:28 +01:00
Jonas Bark
21273fa9ca Merge branch 'main' into copilot/implement-in-app-purchase
# Conflicts:
#	CHANGELOG.md
#	lib/bluetooth/devices/base_device.dart
#	pubspec.yaml
2025-12-17 08:41:47 +01:00
jonasbark
700afb1050 Document local connection method for Rouvy
Added instructions for the local connection method in Rouvy.
2025-12-16 19:56:56 +01:00
Jonas Bark
d943544e56 Merge branch 'main' of github.com:jonasbark/swiftcontrol 2025-12-16 19:53:42 +01:00
Jonas Bark
e994eb01dd less confusing messages 2025-12-16 19:53:25 +01:00
jonasbark
59d953bbc4 Update Windows Store version to 4.1.0 2025-12-16 14:36:30 +01:00
Jonas Bark
fe9dd29964 cleanup, translations 2025-12-16 10:14:48 +01:00
Jonas Bark
eece2bcc0f Merge branch 'main' into copilot/implement-in-app-purchase
# Conflicts:
#	lib/bluetooth/devices/openbikecontrol/obc_ble_emulator.dart
2025-12-16 09:19:50 +01:00
jonas.bark@gmx.de
f19c6b8dd0 fix windows implementation 2025-12-15 11:12:06 +01:00
Jonas Bark
44599b2d33 fix button mapping for OpenBikeControl, button simulator changes 2025-12-15 09:48:36 +01:00
Jonas Bark
613f75fd25 Merge branch 'main' into copilot/implement-in-app-purchase 2025-12-15 09:22:18 +01:00
Jonas Bark
6f68e6cb62 iap adjustment 2025-12-15 08:37:56 +01:00
Jonas Bark
43ac412efd iap adjustment 2025-12-14 21:35:06 +01:00
Jonas Bark
7149c98564 windows #2 2025-12-14 20:15:33 +01:00
Jonas Bark
0f4e46a758 windows #1 2025-12-14 19:54:41 +01:00
Jonas Bark
23fb927cd6 in app purchase implementation on macOS / iOS 2025-12-14 19:32:23 +01:00
Jonas Bark
d055a260ab fix shadcn design usage 2025-12-14 16:48:04 +01:00
Jonas Bark
d55fa5f7c0 Merge branch 'main' into copilot/implement-in-app-purchase
# Conflicts:
#	lib/bluetooth/devices/base_device.dart
#	lib/pages/configuration.dart
#	lib/utils/settings/settings.dart
2025-12-14 16:42:50 +01:00
copilot-swe-agent[bot]
f4fd658c36 Refactor to reduce code duplication and use constants for magic numbers
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:47:41 +00:00
copilot-swe-agent[bot]
0e80d5612c Fix code review issues: remove unused import and fix negative counter display
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:45:29 +00:00
copilot-swe-agent[bot]
9302ebc667 Add restore purchases functionality to IAP widget
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:43:00 +00:00
copilot-swe-agent[bot]
2265866f58 Clarify existing user detection logic with comments
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:41:11 +00:00
copilot-swe-agent[bot]
8ec6ee5ef0 Improve IAP error handling and add documentation
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:39:13 +00:00
copilot-swe-agent[bot]
a03d250bdb Add IAP service implementation with trial and command limiting
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2025-12-12 07:37:15 +00:00
copilot-swe-agent[bot]
a0ebac41ea Initial plan 2025-12-12 07:29:07 +00:00
235 changed files with 11861 additions and 14833 deletions

View File

@@ -28,15 +28,11 @@ on:
required: false
default: true
type: boolean
build_web:
description: 'Build for Web'
required: false
default: false
type: boolean
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
FLUTTER_VERSION: 3.38.4
FLUTTER_VERSION_MAC: 3.41.0-0.0.pre
FLUTTER_VERSION: 3.38.7
jobs:
build:
@@ -52,6 +48,9 @@ jobs:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: Install certificates
if: inputs.build_mac || inputs.build_ios
@@ -97,16 +96,17 @@ jobs:
cp $PP_PATH_MACOS ~/Library/MobileDevice/Provisioning\ Profiles
- name: 🐦 Setup Shorebird
if: inputs.build_mac || inputs.build_android || inputs.build_ios || inputs.build_web
#if: inputs.build_mac || inputs.build_android || inputs.build_ios
if: inputs.build_android || inputs.build_ios
uses: shorebirdtech/setup-shorebird@v1
with:
cache: true
- name: Set Up Flutter
- name: Set Up Flutter maCOS
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'beta'
flutter-version: ${{ env.FLUTTER_VERSION_MAC }}
- name: Generate translation files
run: |
@@ -114,11 +114,23 @@ jobs:
flutter pub global run intl_utils:generate;
- name: 🚀 Shorebird Release macOS
if: inputs.build_mac
if: inputs.build_mac && false
uses: shorebirdtech/shorebird-release@v1
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
platform: macos
args: "-- --obfuscate --split-debug-info=symbols --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }}"
- name: Flutter Release macOS
if: inputs.build_mac
run:
flutter build macos --release --obfuscate --split-debug-info=symbols --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }}
- name: Set Up Flutter Rest
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Decode Keystore
if: inputs.build_android
@@ -132,22 +144,7 @@ jobs:
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
platform: android
args: "--artifact=apk"
- name: Build Web
if: inputs.build_web
run: flutter build web --release --base-href "/swiftcontrol/"
- name: Upload static files as artifact
if: inputs.build_web
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: build/web
- name: Web Deploy
if: inputs.build_web
uses: actions/deploy-pages@v4
args: "-- --obfuscate --split-debug-info=symbols --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }}"
- name: Extract latest changelog
id: changelog
@@ -168,7 +165,7 @@ jobs:
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
platform: ios
args: "--export-options-plist ios/ExportOptions.plist"
args: "--export-options-plist ios/ExportOptions.plist -- --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }}"
- name: Prepare App Store authentication key
if: inputs.build_ios || inputs.build_mac
@@ -186,7 +183,7 @@ jobs:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: de.jonasbark.swiftcontrol
releaseFiles: build/app/outputs/bundle/release/app-release.aab
track: production
track: ${{ github.ref == 'refs/heads/main' && 'production' || 'alpha' }}
whatsNewDirectory: whatsnew
- name: Upload to macOS App Store
@@ -206,41 +203,6 @@ jobs:
run: |
xcrun altool --upload-app -f build/ios/ipa/swift_play.ipa -t ios --apiKey "$APPSTORE_API_KEY" --apiIssuer "$APPSTORE_API_ISSUER_ID";
- name: Handle Android archives
if: inputs.build_android && inputs.build_github && false
run: |
cp build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/BikeControl.android.apk
- name: Code Signing of macOS app
if: inputs.build_mac && inputs.build_github && false
run: /usr/bin/codesign --deep --force -s "$DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY" --entitlements ../../../../../macos/Runner/Release.entitlements --options runtime BikeControl.app -v
working-directory: build/macos/Build/Products/Release
env:
DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY: ${{ secrets.DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY }}
- name: Handle macOS archives
if: inputs.build_mac && inputs.build_github && false
run: |
cd build/macos/Build/Products/Release/
zip -r BikeControl.macos.zip BikeControl.app/
- name: Upload Android Artifacts
if: inputs.build_android && inputs.build_github && false
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Releases
path: |
build/app/outputs/flutter-apk/BikeControl.android.apk
- name: Upload macOS Artifacts
if: inputs.build_mac && inputs.build_github && false
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Releases
path: |
build/macos/Build/Products/Release/BikeControl.macos.zip
#10 Extract Version
- name: Extract version from pubspec.yaml
@@ -250,6 +212,13 @@ jobs:
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
echo "VERSION=$version" >> $GITHUB_ENV
- name: Upload Symbols
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Symbols
path: symbols/
#13 Create Release
- name: Create Release
if: inputs.build_github
@@ -288,7 +257,7 @@ jobs:
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: 'beta'
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Generate translation files
@@ -301,6 +270,7 @@ jobs:
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
platform: windows
args: "-- --obfuscate --split-debug-info=symbols-win"
- name: Zip directory (Windows)
shell: pwsh
@@ -346,14 +316,5 @@ jobs:
overwrite: true
name: Releases
path: |
build/windows/x64/runner/Release/bike_control.windows.zip
build/windows/x64/runner/Release/bike_control.msix
- name: Update Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "build/windows/x64/runner/Release/bike_control.msix"
prerelease: true
tag: v${{ env.VERSION }}
token: ${{ secrets.TOKEN }}
symbols-win/

View File

@@ -21,6 +21,9 @@ jobs:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
@@ -91,21 +94,21 @@ jobs:
with:
platform: macos
release-version: latest
args: '--allow-asset-diffs --allow-native-diffs'
args: '--allow-asset-diffs --allow-native-diffs -- --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }}'
- name: 🚀 Shorebird Patch Android
uses: shorebirdtech/shorebird-patch@v1
with:
platform: android
release-version: latest
args: '--allow-asset-diffs --allow-native-diffs'
args: '--allow-asset-diffs --allow-native-diffs -- --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }}'
- name: 🚀 Shorebird Patch iOS
uses: shorebirdtech/shorebird-patch@v1
with:
platform: ios
release-version: latest
args: '--allow-asset-diffs --allow-native-diffs'
args: '--allow-asset-diffs --allow-native-diffs -- --dart-define=VERIFYING_SHARED_SECRET=${{ secrets.VERIFYING_SHARED_SECRET }} --dart-define=REVENUECAT_API_KEY_IOS=${{ secrets.REVENUECAT_API_KEY_IOS }}'
# shorebird struggles with the app from GitHub
- name: Build macOS

View File

@@ -17,6 +17,7 @@ jobs:
build:
name: Build Web
runs-on: macos-latest
if: false
permissions:
id-token: write
@@ -27,6 +28,9 @@ jobs:
#1 Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
#3 Setup Flutter
- name: Set Up Flutter

1
.gitignore vendored
View File

@@ -52,3 +52,4 @@ lib/gen/
service-account.json
.env
lib/generated

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "prop"]
path = prop
url = git@github.com:OpenBikeControl/prop.git

View File

@@ -1,3 +1,53 @@
### 4.6.0 (28-01-2026)
**Features**:
- Improve Zwift Click V2 connection and handling
- Buttons in Configuration are now grouped by device
### 4.5.0 (22-01-2026)
**Features**:
- Android: simulate additional actions for local connection method (Left, Down, Right, Up, Select, Back, Home, Recent Apps)
- control your phone with your controller
- control UI within the trainer app (if supported)
- BikeControl now supports individual mapping when you use more than one Cycplus BC2 and ThinkRider VS200 controller
- Windows & macOS: allow configuration of volume keys on Bluetooth HID devices
### 4.4.0 (16-01-2026)
**Features**:
- Support for Thinkrider VS200
**Fixes**:
- Android: Local connection method allows passing keyboard events to the trainer app
- macOS: Compatibility with macOS Tahoe
- Windows: send keyboard events to the correct window when using multiple monitors or when another app is focused
- Windows: fix media key detection
### 4.3.0 (07-01-2026)
**Features**:
- Onboarding for new users
- support controlling music & volume for Windows, macOS and Android
- App is now available in Italian (thanks to Connect_Thanks2613)
**Fixes**:
- Vibration setting now available for Zwift Ride devices
### 4.2.0 (20-12-2025)
BikeControl now offers a free trial period of 5 days for all features, so you can test everything before deciding to purchase a license. Please contact the support if you experience any issues!
**Features**:
- support for SRAM AXS/eTap
- only single or double click is supported (no individual button mapping possible, yet)
- use your phone/tablet for steering by attaching your device on your handlebar!
- App is now available in Polish (thanks to Wandrocek)
**Fixes**:
- You will now be notified when a connection to your controller is lost
- improved UI of the Keymap customization screen
### 4.1.0 (16-12-2025)
**Features**:

17
INSTRUCTIONS_LOCAL.md Normal file
View File

@@ -0,0 +1,17 @@
## What is the Local connection method?
*
The Local connection method works by directly controlling the target trainer app on the same device by simulating user input (taps, keyboard inputs). This method does not require any network connection or additional hardware, making it the simplest and most straightforward way to connect to the trainer app.
There are predefined keymaps (touch positions or keyboard shortcuts) for popular trainer apps, allowing users to easily set up and start using the Local connection method without needing to configure anything manually. You can configure these keymaps in the Configuration tab. Note though that supported keyboard keys depend on the trainer app.
## When to use the Local connection method?
*
The Local connection method is ideal for users who:
- Are running the trainer app on the same device as the controller app (e.g., both apps on a smartphone or tablet).
- Do not want to deal with network configurations or potential connectivity issues.
## Limitations of the Local connection method
*
While the Local connection method is easy to set up and use, it has some limitations:
- It may not work well with trainer apps that have complex user interfaces or require precise timing.
- It is limited to the device on which both the controller and trainer apps are running, meaning it cannot be used for remote control scenarios.

View File

@@ -1,31 +1,38 @@
## Instructions for using the MyWhoosh "Link" connection method
*
1) launch MyWhoosh on the device of your choice
2) launch MyWhoosh Link, check if the "Link" connection works
3) **close MyWhoosh Link** - very important!
4) open BikeControl, follow on screen instructions
2) make sure the "MyWhoosh Link" app is not active at the same time as BikeControl
3) open BikeControl, follow the on-screen instructions
Once you've confirmed the connection in BikeControl you won't have to repeat step 2 and 3 again in the future. This is just to make sure the connection works in general.
And here's a video with a few explanations:
Here's a video with a few explanations. Note it uses an older version, but the idea is the same.
[![BikeControl Instruction for iOS](https://img.youtube.com/vi/p8sgQhuufeI/0.jpg)](https://www.youtube.com/watch?v=p8sgQhuufeI)
[https://www.youtube.com/watch?v=p8sgQhuufeI](https://www.youtube.com/watch?v=p8sgQhuufeI)
## The MyWhoosh Link app itself works fine, but BikeControl doesn't connect
*
The MyWhoosh Link app must not run simultaneously with BikeControl. Make sure the MyWhoosh Link app is fully closed, then reopen BikeControl and try connecting again.
## MyWhoosh "Link" method never connects
*
The same network restrictions apply for BikeControl as it applies to MyWhoosh Link app. Please verify with the MyWhoosh Link app if a connection is possible at all.
Here are some instructions that can help:
This is a network/local-discovery problem. BikeControl needs the same kind of local network access as MyWhoosh Link.
[https://mywhoosh.com/troubleshoot/](https://mywhoosh.com/troubleshoot/)
[https://www.facebook.com/groups/mywhoosh/posts/1323791068858873/](https://www.facebook.com/groups/mywhoosh/posts/1323791068858873/)
Checklist:
- Use the MyWhoosh Link app to confirm if "Link" works in general
- Use MyWhoosh Link app and connect, then close it, then open up BikeControl - this is key for some users
- Both devices (if you use BikeControl on another device than MyWhoosh) are on the **same WiFi SSID**
- Avoid “Guest” networks
- Avoid “extenders/mesh guest mode” and networks with device isolation
- If your router has it, disable:
- “AP isolation / client isolation”
- Try moving both devices to the same band:
- Prefer **2.4 GHz** (often more reliable for local discovery than mixed/steering)
- Temporarily disable:
- VPNs
- iCloud Private Relay (if enabled)
- “Limit IP Address Tracking” (iOS WiFi option)
- iOS WiFi settings for that network:
- Turn off **Private WiFi Address**
- Turn off **Limit IP Address Tracking**
- Mesh networks: may work, but if it doesnt, test with a simple router or phone hotspot.
In essence:
- your two devices (phone, tablet) need to be on the same WiFi network
- on iOS you have to turn off "Private Wi-Fi Address" in the WiFi settings
- Limit IP Address Tracking may need to be disabled
- mesh networks may not work
Official MyWhoosh troubleshooting links:
- https://mywhoosh.com/troubleshoot/
- https://www.facebook.com/groups/mywhoosh/posts/1323791068858873/

View File

@@ -0,0 +1,4 @@
## Local Connection method
*
The local connection method (avalable on Android, Windows and macOS) allows BikeControl to directly control Rouvy either using touch or keyboard keys. This way you don't need to select any "Controllers" at all in Rouvy.
Make sure the "Virtual Shifting Controls" are enabled: https://support.rouvy.com/hc/en-us/articles/32452137189393-Virtual-Shifting#h_01K9SWGWYMAVQV108SQ9KWQAKC

View File

@@ -6,7 +6,7 @@
With BikeControl you can **control your favorite trainer app** using your Zwift Click, Zwift Ride, Zwift Play, Shimano Di2, or other similar devices. Here's what you can do with it, depending on your configuration:
- Virtual Gear shifting
- Steering/turning
- Steering / navigation
- adjust workout intensity
- control music on your device
- more? If you can do it via keyboard, mouse, or touch, you can do it with BikeControl
@@ -17,8 +17,8 @@ https://github.com/user-attachments/assets/1f81b674-1628-4763-ad66-5f3ed7a3f159
## Downloads
Best follow our landing page and the "Get Started" button: [bikecontrol.app](https://bikecontrol.app/) to understand on which platform you want to run BikeControl.
## Download
Best follow our landing page and the "Get Started" button: [bikecontrol.app](https://bikecontrol.app/) to understand on which platform you want to run BikeControl. A testing period is available, allowing you to try out the full functionality of BikeControl:
<a href="https://play.google.com/store/apps/details?id=de.jonasbark.swiftcontrol"><img width="270" height="80" alt="GetItOnGooglePlay_Badge_Web_color_English" src="https://github.com/user-attachments/assets/a059d5a1-2efb-4f65-8117-ef6a99823b21" /></a>
@@ -31,7 +31,7 @@ Best follow our landing page and the "Get Started" button: [bikecontrol.app](htt
## Supported Apps
- MyWhoosh
- Zwift
- TrainingPeaks Virtual / indieVelo
- TrainingPeaks Virtual
- Biketerra.com
- Rouvy
- [OpenBikeControl](https://openbikecontrol.org) compatible apps
@@ -45,13 +45,21 @@ Best follow our landing page and the "Get Started" button: [bikecontrol.app](htt
- Zwift Play
- Shimano Di2
- Configure your levers to use D-Fly channels with Shimano E-Tube app
- SRAM AXS/eTap
- Configure your levers not to do any action in the "SRAM AXS" app
- only single or double click is supported (no individual button mapping possible, yet)
- Wahoo Kickr Bike Shift
- Wahoo Kickr Bike Pro
- CYCPLUS BC2 Virtual Shifter
- Thinkrider VS200 Virtual Shifter (beta)
- Elite Sterzo Smart (for steering support)
- Elite Square Smart Frame (beta)
- Your Phone!
- Mount your phone on the handlebar to detect e.g. steering
- Available on Android and iOS
- Gamepads
- Keyboard input
- like a Companion App
- some trainers do not support keyboard input for all functions - now they do!
- useful when remapping keys from other devices using e.g. AutoHotkey
- Cheap Bluetooth buttons such as [these](https://www.amazon.com/s?k=bluetooth+remote) (beta)
@@ -78,19 +86,16 @@ Check the troubleshooting guide [here](TROUBLESHOOTING.md).
## How does it work?
The app connects to your Controller devices (such as Zwift ones) automatically. BikeControl uses different methods of connecting to the trainer app, depending on the trainer app and operating system:
- Connect to the trainer app on the same device or on another device using Network
- available on Android, iOS, macOS, Windows
- available on Android, iOS, iPadOS, macOS, Windows
- supported by e.g. MyWhoosh, Rouvy and Zwift
- Connect to the trainer app on another device by simulating a Bluetooth device
- available on Android, iOS, macOS, Windows
- available on Android, iOS, iPadOS, macOS, Windows
- supported by e.g. Rouvy and Zwift
- Directly control the trainer app via Accessibility features (simulating touch and keyboard input)
- available on Android, macOS, Windows
- supported by all trainer apps
- Connect to supported trainer app using the [OpenBikeControl](https://openbikecontrol.org) protocol
- available on Android, iOS, macOS, Windows
## Alternatives
- [qdomyos-zwift](https://www.qzfitness.com/) directly controls the trainer (as opposed to controlling the trainer app). This can be useful if your trainer app does not support virtual shifting.
- Connect to the supported trainer app using the [OpenBikeControl](https://openbikecontrol.org) protocol
- available on Android, iOS, iPadOS, macOS, Windows
## Donate
Please consider donating to support the development of this app :)

View File

@@ -1,23 +1,28 @@
## Click / Ride device cannot be found
*
You may need to update the firmware in Zwift Companion app.
This means BikeControl does NOT see the device via Bluetooth.
- Put the controller into pairing mode (LED should blink)
- Ensure the controller is NOT connected to another app/device (e.g. Zwift)
- Update controller firmware in Zwift Companion, if available
- Reboot Bluetooth / reboot phone/PC
## Click / Ride device does not send any data
*
You may need to update the firmware in Zwift Companion app.
## My Click v2 disconnects after a minute
## My Click v2 disconnects after a minute or buttons do not work
*
Check [this](https://github.com/jonasbark/swiftcontrol/issues/68) discussion.
To make your Click V2 work best you should connect it in the Zwift app once each day.
To make your Click V2 work best you should connect it in the Zwift app once before a workout session.
If you don't do that BikeControl will need to reconnect every minute.
1. Open Zwift app (not the Companion)
2. Log in (subscription not required) and open the device connection screen
3. Connect your Trainer, then connect the Click V2
4. Optional: some users report that keeping the Click connected for more than a few seconds is more reliable.
5. Close the Zwift app again and connect again in BikeControl
2. Log in (subscription not required) device connection screen
3. Connect trainer, then connect Click v2
4. Keep it connected for ~1030 seconds
5. Close Zwift completely, then connect in BikeControl
Details/updates: https://github.com/jonasbark/swiftcontrol/issues/68
## Android: Connection works, buttons work but nothing happens in MyWhoosh and similar
*
@@ -27,10 +32,6 @@ If you don't do that BikeControl will need to reconnect every minute.
- grant accessibility permission for BikeControl
- see [https://github.com/jonasbark/swiftcontrol/issues/38](https://github.com/OpenBikeControl/bikecontrol/issues/38) for more details
## BikeControl crashes on Windows when searching for the device
*
You're probably running into [this](https://github.com/OpenBikeControl/bikecontrol/issues/70) issue. Disconnect your controller device (e.g. Zwift Play) from Windows Bluetooth settings.
## My Clicks do not get recognized in MyWhoosh, but I am connected / use local control
*

View File

@@ -1 +1 @@
4.0.0
4.4.1

View File

@@ -90,6 +90,23 @@ enum class MediaAction(val raw: Int) {
}
}
enum class GlobalAction(val raw: Int) {
BACK(0),
DPAD_CENTER(1),
DOWN(2),
RIGHT(3),
UP(4),
LEFT(5),
HOME(6),
RECENTS(7);
companion object {
fun ofRaw(raw: Int): GlobalAction? {
return values().firstOrNull { it.raw == raw }
}
}
}
/** Generated class from Pigeon that represents data sent in messages. */
data class WindowEvent (
val packageName: String,
@@ -175,11 +192,16 @@ private open class AccessibilityApiPigeonCodec : StandardMessageCodec() {
}
}
130.toByte() -> {
return (readValue(buffer) as Long?)?.let {
GlobalAction.ofRaw(it.toInt())
}
}
131.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
WindowEvent.fromList(it)
}
}
131.toByte() -> {
132.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AKeyEvent.fromList(it)
}
@@ -193,12 +215,16 @@ private open class AccessibilityApiPigeonCodec : StandardMessageCodec() {
stream.write(129)
writeValue(stream, value.raw)
}
is WindowEvent -> {
is GlobalAction -> {
stream.write(130)
writeValue(stream, value.raw)
}
is WindowEvent -> {
stream.write(131)
writeValue(stream, value.toList())
}
is AKeyEvent -> {
stream.write(131)
stream.write(132)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
@@ -213,9 +239,11 @@ interface Accessibility {
fun hasPermission(): Boolean
fun openPermissions()
fun performTouch(x: Double, y: Double, isKeyDown: Boolean, isKeyUp: Boolean)
fun performGlobalAction(action: GlobalAction)
fun controlMedia(action: MediaAction)
fun isRunning(): Boolean
fun ignoreHidDevices()
fun setHandledKeys(keys: List<String>)
companion object {
/** The codec used by Accessibility. */
@@ -278,6 +306,24 @@ interface Accessibility {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.accessibility.Accessibility.performGlobalAction$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val actionArg = args[0] as GlobalAction
val wrapped: List<Any?> = try {
api.performGlobalAction(actionArg)
listOf(null)
} catch (exception: Throwable) {
AccessibilityApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.accessibility.Accessibility.controlMedia$separatedMessageChannelSuffix", codec)
if (api != null) {
@@ -327,6 +373,24 @@ interface Accessibility {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.accessibility.Accessibility.setHandledKeys$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val keysArg = args[0] as List<String>
val wrapped: List<Any?> = try {
api.setHandledKeys(keysArg)
listOf(null)
} catch (exception: Throwable) {
AccessibilityApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}

View File

@@ -2,6 +2,7 @@ package de.jonasbark.accessibility
import AKeyEvent
import Accessibility
import GlobalAction
import HidKeyPressedStreamHandler
import MediaAction
import PigeonEventSink
@@ -66,6 +67,10 @@ class AccessibilityPlugin: FlutterPlugin, Accessibility {
Observable.toService?.performTouch(x = x, y = y, isKeyUp = isKeyUp, isKeyDown = isKeyDown) ?: error("Service not running")
}
override fun performGlobalAction(action: GlobalAction) {
Observable.toService?.performGlobalAction(action) ?: error("Service not running")
}
override fun controlMedia(action: MediaAction) {
val audioService = context.getSystemService(Context.AUDIO_SERVICE) as android.media.AudioManager
when (action) {
@@ -90,6 +95,11 @@ class AccessibilityPlugin: FlutterPlugin, Accessibility {
Observable.ignoreHidDevices = true
}
override fun setHandledKeys(keys: List<String>) {
// Clear and update the concurrent set
Observable.handledKeys = keys.toSet()
}
}
class WindowEventListener : StreamEventsStreamHandler(), Receiver {

View File

@@ -15,6 +15,7 @@ import android.view.KeyEvent
import android.view.ViewConfiguration
import android.view.accessibility.AccessibilityEvent
import android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
import GlobalAction
class AccessibilityService : AccessibilityService(), Listener {
@@ -70,8 +71,10 @@ class AccessibilityService : AccessibilityService(), Listener {
}
override fun onKeyEvent(event: KeyEvent): Boolean {
if (!Observable.ignoreHidDevices && isBleRemote(event)) {
// Handle media and volume keys from HID devices here
val keyString = KeyEvent.keyCodeToString(event.keyCode)
// if currently active app is BikeControl => handle it, so keymap can be created
if (!Observable.ignoreHidDevices && isBleRemote(event) && (rootInActiveWindow.packageName == "de.jonasbark.swiftcontrol" || Observable.handledKeys.contains(keyString))) {
// Handle keys that have a keymap defined
Log.d(
"AccessibilityService",
"onKeyEvent: keyCode=${event.keyCode} action=${event.action} scanCode=${event.scanCode} flags=${event.flags}"
@@ -95,6 +98,20 @@ class AccessibilityService : AccessibilityService(), Listener {
}
}
override fun performGlobalAction(action: GlobalAction) {
val mappedAction = when (action) {
GlobalAction.BACK -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_BACK
GlobalAction.DPAD_CENTER -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_DPAD_CENTER
GlobalAction.DOWN -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_DPAD_DOWN
GlobalAction.RIGHT -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_DPAD_RIGHT
GlobalAction.UP -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_DPAD_UP
GlobalAction.LEFT -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_DPAD_LEFT
GlobalAction.HOME -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_HOME
GlobalAction.RECENTS -> android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_RECENTS
}
performGlobalAction(mappedAction)
}
override fun performTouch(x: Double, y: Double, isKeyDown: Boolean, isKeyUp: Boolean) {
val gestureBuilder = GestureDescription.Builder()
val path = Path()

View File

@@ -2,16 +2,21 @@ package de.jonasbark.accessibility
import android.graphics.Rect
import android.view.KeyEvent
import GlobalAction
import java.util.concurrent.ConcurrentHashMap
object Observable {
var toService: Listener? = null
var fromServiceWindow: Receiver? = null
var fromServiceKeys: Receiver? = null
var ignoreHidDevices: Boolean = false
// Use concurrent set for thread-safe access from AccessibilityService and plugin
var handledKeys: Set<String> = ConcurrentHashMap.newKeySet()
}
interface Listener {
fun performTouch(x: Double, y: Double, isKeyDown: Boolean, isKeyUp: Boolean)
fun performGlobalAction(action: GlobalAction)
}
interface Receiver {

View File

@@ -8,15 +8,30 @@ abstract class Accessibility {
void performTouch(double x, double y, {bool isKeyDown = true, bool isKeyUp = false});
void performGlobalAction(GlobalAction action);
void controlMedia(MediaAction action);
bool isRunning();
void ignoreHidDevices();
void setHandledKeys(List<String> keys);
}
enum MediaAction { playPause, next, volumeUp, volumeDown }
enum GlobalAction {
back,
dpadCenter,
down,
right,
up,
left,
home,
recents,
}
class WindowEvent {
final String packageName;
final int top;

View File

@@ -36,6 +36,17 @@ enum MediaAction {
volumeDown,
}
enum GlobalAction {
back,
dpadCenter,
down,
right,
up,
left,
home,
recents,
}
class WindowEvent {
WindowEvent({
required this.packageName,
@@ -164,11 +175,14 @@ class _PigeonCodec extends StandardMessageCodec {
} else if (value is MediaAction) {
buffer.putUint8(129);
writeValue(buffer, value.index);
} else if (value is WindowEvent) {
} else if (value is GlobalAction) {
buffer.putUint8(130);
writeValue(buffer, value.index);
} else if (value is WindowEvent) {
buffer.putUint8(131);
writeValue(buffer, value.encode());
} else if (value is AKeyEvent) {
buffer.putUint8(131);
buffer.putUint8(132);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
@@ -182,8 +196,11 @@ class _PigeonCodec extends StandardMessageCodec {
final int? value = readValue(buffer) as int?;
return value == null ? null : MediaAction.values[value];
case 130:
return WindowEvent.decode(readValue(buffer)!);
final int? value = readValue(buffer) as int?;
return value == null ? null : GlobalAction.values[value];
case 131:
return WindowEvent.decode(readValue(buffer)!);
case 132:
return AKeyEvent.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
@@ -280,6 +297,29 @@ class Accessibility {
}
}
Future<void> performGlobalAction(GlobalAction action) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.accessibility.Accessibility.performGlobalAction$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[action]);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
Future<void> controlMedia(MediaAction action) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.accessibility.Accessibility.controlMedia$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
@@ -353,6 +393,29 @@ class Accessibility {
return;
}
}
Future<void> setHandledKeys(List<String> keys) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.accessibility.Accessibility.setHandledKeys$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[keys]);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
}
Stream<WindowEvent> streamEvents( {String instanceName = ''}) {

View File

@@ -16,7 +16,7 @@ keystoreProperties.load(FileInputStream(keystorePropertiesFile))
android {
namespace = "de.jonasbark.swiftcontrol"
compileSdk = flutter.compileSdkVersion
ndkVersion = "27.0.12077973"
ndkVersion = "28.2.13676358"
compileOptions {
// Flag to enable support for the new language APIs

View File

@@ -3,6 +3,7 @@
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<!-- New Bluetooth permissions in Android 12
https://developer.android.com/about/versions/12/features/bluetooth-permissions -->
@@ -16,6 +17,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/>
<uses-permission android:name="android.permission.BILLING"/>
<!-- legacy for Android 9 or lower -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28" tools:replace="android:maxSdkVersion" />

View File

@@ -5,10 +5,10 @@ import android.os.Handler
import android.view.InputDevice
import android.view.KeyEvent
import android.view.MotionEvent
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
import org.flame_engine.gamepads_android.GamepadsCompatibleActivity
class MainActivity: FlutterActivity(), GamepadsCompatibleActivity {
class MainActivity: FlutterFragmentActivity(), GamepadsCompatibleActivity {
var keyListener: ((KeyEvent) -> Boolean)? = null
var motionListener: ((MotionEvent) -> Boolean)? = null

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*" />

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip

View File

@@ -18,7 +18,7 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.3" apply false
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}

View File

@@ -1,5 +1,6 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '13.0'
platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@@ -7,27 +7,50 @@ PODS:
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_secure_storage_darwin (10.0.0):
- Flutter
- FlutterMacOS
- flutter_volume_controller (0.0.1):
- Flutter
- gamepads_ios (0.1.1):
- Flutter
- image_picker_ios (0.0.1):
- Flutter
- in_app_purchase_storekit (0.0.1):
- Flutter
- FlutterMacOS
- in_app_review (2.0.0):
- Flutter
- integration_test (0.0.1):
- Flutter
- ios_receipt (0.0.1):
- Flutter
- media_key_detector_ios (0.0.1):
- Flutter
- nsd_ios (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.3.0):
- Flutter
- purchases_flutter (9.10.6):
- Flutter
- PurchasesHybridCommon (= 17.27.1)
- purchases_ui_flutter (9.10.6):
- Flutter
- PurchasesHybridCommonUI (= 17.27.1)
- PurchasesHybridCommon (17.27.1):
- RevenueCat (= 5.54.1)
- PurchasesHybridCommonUI (17.27.1):
- PurchasesHybridCommon (= 17.27.1)
- RevenueCatUI (= 5.54.1)
- restart_app (0.0.1):
- Flutter
- RevenueCat (5.54.1)
- RevenueCatUI (5.54.1):
- RevenueCat (= 5.54.1)
- sensors_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
@@ -44,21 +67,34 @@ DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`)
- flutter_volume_controller (from `.symlinks/plugins/flutter_volume_controller/ios`)
- gamepads_ios (from `.symlinks/plugins/gamepads_ios/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- ios_receipt (from `.symlinks/plugins/ios_receipt/ios`)
- media_key_detector_ios (from `.symlinks/plugins/media_key_detector_ios/ios`)
- nsd_ios (from `.symlinks/plugins/nsd_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- purchases_flutter (from `.symlinks/plugins/purchases_flutter/ios`)
- purchases_ui_flutter (from `.symlinks/plugins/purchases_ui_flutter/ios`)
- restart_app (from `.symlinks/plugins/restart_app/ios`)
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- universal_ble (from `.symlinks/plugins/universal_ble/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
SPEC REPOS:
trunk:
- PurchasesHybridCommon
- PurchasesHybridCommonUI
- RevenueCat
- RevenueCatUI
EXTERNAL SOURCES:
bluetooth_low_energy_darwin:
:path: ".symlinks/plugins/bluetooth_low_energy_darwin/darwin"
@@ -68,26 +104,38 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_secure_storage_darwin:
:path: ".symlinks/plugins/flutter_secure_storage_darwin/darwin"
flutter_volume_controller:
:path: ".symlinks/plugins/flutter_volume_controller/ios"
gamepads_ios:
:path: ".symlinks/plugins/gamepads_ios/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
in_app_purchase_storekit:
:path: ".symlinks/plugins/in_app_purchase_storekit/darwin"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
ios_receipt:
:path: ".symlinks/plugins/ios_receipt/ios"
media_key_detector_ios:
:path: ".symlinks/plugins/media_key_detector_ios/ios"
nsd_ios:
:path: ".symlinks/plugins/nsd_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
purchases_flutter:
:path: ".symlinks/plugins/purchases_flutter/ios"
purchases_ui_flutter:
:path: ".symlinks/plugins/purchases_ui_flutter/ios"
restart_app:
:path: ".symlinks/plugins/restart_app/ios"
sensors_plus:
:path: ".symlinks/plugins/sensors_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
universal_ble:
@@ -98,25 +146,35 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wakelock_plus/ios"
SPEC CHECKSUMS:
bluetooth_low_energy_darwin: 764d8d1ae5abefbcdb839e812b4b25c0061fcf8b
bluetooth_low_energy_darwin: 50bc79258e60586e4c4bed5948bd31d925f37fac
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_local_notifications: ff50f8405aaa0ccdc7dcfb9022ca192e8ad9688f
flutter_secure_storage_darwin: 557817588b80e60213cbecb573c45c76b788018d
flutter_volume_controller: e4d5832f08008180f76e30faf671ffd5a425e529
gamepads_ios: 1d2930c7a4450a9a1b57444ebf305a6a6cbeea0b
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
image_picker_ios: 4f2f91b01abdb52842a8e277617df877e40f905b
in_app_purchase_storekit: 2342c0a5da86593124d08dd13d920f39a52b273a
in_app_review: 436034b18594851a7328d7f1c2ed5ec235b79cfc
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
ios_receipt: c2d5b4c36953c377a024992393976214ce6951e6
media_key_detector_ios: 7ff9aefdfea00bb7b71e184132381b7d0e7e1269
nsd_ios: 8c37babdc6538e3350dbed3a52674d2edde98173
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
purchases_flutter: b3c0792197f69cd7af4c2449b71df6ac6378aace
purchases_ui_flutter: caae6d62ea23c6fe964992a28353211cc74b244a
PurchasesHybridCommon: 027f03312519c51056457eb2e4f7ee1c91b61b8f
PurchasesHybridCommonUI: 48afb5e29204958bff1276b0f7acb8e4b59fe99a
restart_app: 806659942bf932f6ce51c5372f91ce5e81c8c14a
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
RevenueCat: ecbba580fa453b0d4a0475449b904196d74ef678
RevenueCatUI: ac7492873928e9e7f297e5e27a7c4f23f9008326
sensors_plus: 7229095999f30740798f0eeef5cd120357a8f4f2
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa
wakelock_plus: 76957ab028e12bfa4e66813c99e46637f367fc7e
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
PODFILE CHECKSUM: 7ebd5c9b932b3af79d5c67e3af873118b74e970f
COCOAPODS: 1.16.2

View File

@@ -65,6 +65,7 @@
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DFFDC4B9C4D6EF6A3BDE2E73 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
EFDECED99A47773C293F8819 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
F0D040E82EEF2560009B19C0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -152,6 +153,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
F0D040E82EEF2560009B19C0 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -487,12 +489,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = UZRHKPVWN9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -673,12 +677,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = UZRHKPVWN9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -699,12 +705,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = UZRHKPVWN9;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@@ -8,6 +8,8 @@ import UIKit
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

View File

@@ -32,6 +32,8 @@
<string>BikeControl uses Bluetooth to connect to accessories.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>This app connects to your trainer app on your local network.</string>
<key>NSMotionUsageDescription</key>
<string>Access your accelerometer and gyroscope for steering support via your phone.</string>
<key>NSBonjourServices</key>
<array>
<string>_wahoo-fitness-tnp._tcp</string>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array/>
</dict>
</plist>

2
ios_receipt/.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

30
ios_receipt/.gitignore vendored Normal file
View File

@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/

30
ios_receipt/.metadata Normal file
View File

@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "367f9ea16bfae1ca451b9cc27c1366870b187ae2"
channel: "stable"
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: ios
create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

7
ios_receipt/CHANGELOG.md Normal file
View File

@@ -0,0 +1,7 @@
## 1.1.0
* Migrate to StoreKit2
## 1.0.0
* Implement main method

21
ios_receipt/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Dmytro O. Kut'ko
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

32
ios_receipt/README.md Normal file
View File

@@ -0,0 +1,32 @@
# IosReceipt
The IosReceipt package allows you to easily fetch the App Store receipt in your Flutter application on the iOS platform.
## Installation
Add the following dependency to your `pubspec.yaml` file:
```yaml
dependencies:
ios_receipt: ^0.0.1 # Use the latest version of the package
```
Then, run flutter pub get to install the package.
## Usage
Method for get transactions with StoreKit2
```dart
final transactions = await IosReceipt.getAllTransactions();
```
## Based on
This package is based on the [appStoreReceiptURL](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl) from the official Apple documentation.
## Note
- The receipt isn't necessary if you use AppTransaction to validate the app download, or Transaction to validate in-app purchases.
- If the receipt is invalid or missing in your app, use SKReceiptRefreshRequest to request a new receipt.
## Testing Environments
Keep in mind that receipts aren't initially present in iOS and iPadOS apps in the sandbox environment and in Xcode. Apps receive a receipt after the tester completes the first in-app purchase.
## License
This project is licensed under the MIT License.

View File

@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

38
ios_receipt/ios/.gitignore vendored Normal file
View File

@@ -0,0 +1,38 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh

View File

View File

@@ -0,0 +1,73 @@
import Flutter
import UIKit
import StoreKit
public class IosReceiptPlugin: NSObject, FlutterPlugin {
private func getAppleReceipt() -> String? {
guard let url = Bundle.main.appStoreReceiptURL,
FileManager.default.fileExists(atPath: url.path) else {
return nil
}
let data = try? Data(contentsOf: url, options: .alwaysMapped)
return data?.base64EncodedString()
}
private func isSandbox() -> Bool {
guard let path = Bundle.main.appStoreReceiptURL?.path else {
return false
}
return path.contains("CoreSimulator") || path.contains("sandboxReceipt")
}
private func getAllTransactions() async -> [[String: Any]] {
var list: [[String: Any]] = []
if #available(iOS 15.0, *) {
for await result in Transaction.all {
switch result {
case .verified(let tx):
var item: [String: Any] = [
"productId": tx.productID,
"transactionId": String(tx.id),
"originalTransactionId": String(tx.originalID),
"purchaseDate": ISO8601DateFormatter().string(from: tx.purchaseDate)
]
if let revocationDate = tx.revocationDate {
item["revocationDate"] = ISO8601DateFormatter().string(from: revocationDate)
}
if let reason = tx.revocationReason {
item["revocationReason"] = reason.rawValue
}
if #available(iOS 16.0, *) {
item["jws"] = result.jwsRepresentation
}
list.append(item)
case .unverified(_, _):
continue
}
}
}
return list
}
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "ios_receipt", binaryMessenger: registrar.messenger())
let instance = IosReceiptPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "getAppleReceipt":
result(getAppleReceipt())
case "isSandbox":
result(isSandbox())
case "getAllTransactions":
Task { result(await self.getAllTransactions()) }
default:
result(FlutterMethodNotImplemented)
}
}
}

View File

@@ -0,0 +1,23 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint ios_receipt.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'ios_receipt'
s.version = '0.0.1'
s.summary = 'A new Flutter plugin project.'
s.description = <<-DESC
A new Flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '15.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end

View File

@@ -0,0 +1,22 @@
import 'package:ios_receipt/models/transaction.dart';
import 'ios_receipt_platform_interface.dart';
class IosReceipt {
static Future<String?> getAppleReceipt() {
return IosReceiptPlatform.instance.getAppleReceipt();
}
static Future<bool> isSandbox() {
return IosReceiptPlatform.instance.isSandbox();
}
static Future<List<Transaction>> getAllTransactions() async {
final list = await IosReceiptPlatform.instance.getAllTransactions();
final result = <Transaction>[];
for (var data in list) {
result.add(Transaction.fromMap(data));
}
return result..sort((a, b) => a.purchaseDate.compareTo(b.purchaseDate));
}
}

View File

@@ -0,0 +1,29 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'ios_receipt_platform_interface.dart';
/// An implementation of [IosReceiptPlatform] that uses method channels.
class MethodChannelIosReceipt extends IosReceiptPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('ios_receipt');
@override
Future<String?> getAppleReceipt() async {
final version = await methodChannel.invokeMethod<String>('getAppleReceipt');
return version;
}
@override
Future<List<Map<String, dynamic>>> getAllTransactions() async {
final list = await methodChannel.invokeMethod('getAllTransactions');
return (list as List).map((e) => Map<String, dynamic>.from(e)).toList();
}
@override
Future<bool> isSandbox() async {
final isSandbox = await methodChannel.invokeMethod<bool>('isSandbox');
return isSandbox ?? false;
}
}

View File

@@ -0,0 +1,37 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'ios_receipt_method_channel.dart';
abstract class IosReceiptPlatform extends PlatformInterface {
/// Constructs a IosReceiptPlatform.
IosReceiptPlatform() : super(token: _token);
static final Object _token = Object();
static IosReceiptPlatform _instance = MethodChannelIosReceipt();
/// The default instance of [IosReceiptPlatform] to use.
///
/// Defaults to [MethodChannelIosReceipt].
static IosReceiptPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [IosReceiptPlatform] when
/// they register themselves.
static set instance(IosReceiptPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getAppleReceipt() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
Future<List<Map<String, dynamic>>> getAllTransactions() {
throw UnimplementedError('getAllTransactions() has not been implemented.');
}
Future<bool> isSandbox() async {
throw UnimplementedError('isSandbox() has not been implemented.');
}
}

View File

@@ -0,0 +1,41 @@
class Transaction {
const Transaction({
required this.jws,
required this.productId,
required this.transactionId,
required this.purchaseDate,
required this.originalTransactionId,
});
final String? jws;
final String productId;
final String transactionId;
final DateTime purchaseDate;
final String originalTransactionId;
@override
bool operator ==(covariant Transaction other) {
if (identical(this, other)) return true;
return other.jws == jws &&
other.productId == productId &&
other.transactionId == transactionId &&
other.purchaseDate == purchaseDate &&
other.originalTransactionId == originalTransactionId;
}
@override
int get hashCode =>
jws.hashCode ^
productId.hashCode ^
transactionId.hashCode ^
purchaseDate.hashCode ^
originalTransactionId.hashCode;
factory Transaction.fromMap(Map<String, dynamic> map) => Transaction(
jws: map['jws'] as String?,
productId: map['productId'] as String,
transactionId: map['transactionId'] as String,
purchaseDate: DateTime.parse(map['purchaseDate'] as String),
originalTransactionId: map['originalTransactionId'] as String,
);
}

38
ios_receipt/macos/.gitignore vendored Normal file
View File

@@ -0,0 +1,38 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh

View File

View File

@@ -0,0 +1,73 @@
import FlutterMacOS
import StoreKit
public class IosReceiptPlugin: NSObject, FlutterPlugin {
private func isSandbox() -> Bool {
guard let path = Bundle.main.appStoreReceiptURL?.path else {
return false
}
return path.contains("CoreSimulator") || path.contains("sandboxReceipt")
}
private func getAppleReceipt() -> String? {
guard let url = Bundle.main.appStoreReceiptURL,
FileManager.default.fileExists(atPath: url.path) else {
return nil
}
let data = try? Data(contentsOf: url, options: .alwaysMapped)
return data?.base64EncodedString()
}
private func getAllTransactions() async -> [[String: Any]] {
var list: [[String: Any]] = []
if #available(iOS 15.0, *) {
for await result in Transaction.all {
switch result {
case .verified(let tx):
var item: [String: Any] = [
"productId": tx.productID,
"transactionId": String(tx.id),
"originalTransactionId": String(tx.originalID),
"purchaseDate": ISO8601DateFormatter().string(from: tx.purchaseDate)
]
if let revocationDate = tx.revocationDate {
item["revocationDate"] = ISO8601DateFormatter().string(from: revocationDate)
}
if let reason = tx.revocationReason {
item["revocationReason"] = reason.rawValue
}
if #available(iOS 16.0, *) {
item["jws"] = result.jwsRepresentation
}
list.append(item)
case .unverified(_, _):
continue
}
}
}
return list
}
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "ios_receipt", binaryMessenger: registrar.messenger)
let instance = IosReceiptPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "getAppleReceipt":
result(getAppleReceipt())
case "isSandbox":
result(isSandbox())
case "getAllTransactions":
Task { result(await self.getAllTransactions()) }
default:
result(FlutterMethodNotImplemented)
}
}
}

View File

@@ -0,0 +1,23 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint ios_receipt.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'ios_receipt'
s.version = '0.0.1'
s.summary = 'A new Flutter plugin project.'
s.description = <<-DESC
A new Flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS'
s.platform = :osx, '12.00'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end

26
ios_receipt/pubspec.yaml Normal file
View File

@@ -0,0 +1,26 @@
name: ios_receipt
description: The IosReceipt package allows you to easily fetch the App Store receipt in your Flutter application on the iOS platform.
version: 1.1.0
homepage: https://github.com/DimaKutko/ios_receipt
environment:
sdk: ">=3.8.0 <4.0.0"
flutter: ">=3.32.0"
dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
flutter:
plugin:
platforms:
ios:
pluginClass: IosReceiptPlugin
macos:
pluginClass: IosReceiptPlugin

View File

@@ -38,6 +38,11 @@ class KeyPressSimulator {
return _platform.simulateKeyPress(key: key, modifiers: modifiers, keyDown: false);
}
/// Simulate media key press.
Future<void> simulateMediaKey(PhysicalKeyboardKey mediaKey) {
return _platform.simulateMediaKey(mediaKey);
}
@Deprecated('Please use simulateKeyDown & simulateKeyUp methods.')
Future<void> simulateCtrlCKeyPress() async {
const key = PhysicalKeyboardKey.keyC;

View File

@@ -22,6 +22,9 @@ public class KeypressSimulatorMacosPlugin: NSObject, FlutterPlugin {
case "simulateMouseClick":
simulateMouseClick(call, result: result)
break
case "simulateMediaKey":
simulateMediaKey(call, result: result)
break
default:
result(FlutterMethodNotImplemented)
}
@@ -114,4 +117,62 @@ public class KeypressSimulatorMacosPlugin: NSObject, FlutterPlugin {
eventKeyPress!.flags = flags
return eventKeyPress!
}
public func simulateMediaKey(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
let args:[String: Any] = call.arguments as! [String: Any]
let keyIdentifier: String = args["key"] as! String
// Map string identifier to macOS NX key codes
var mediaKeyCode: Int32 = 0
switch keyIdentifier {
case "playPause":
mediaKeyCode = NX_KEYTYPE_PLAY
case "stop":
// macOS doesn't have a dedicated stop key in its media control API.
// Following macOS conventions, we map stop to play/pause which toggles playback.
// This matches the behavior of the physical media keys on Mac keyboards.
mediaKeyCode = NX_KEYTYPE_PLAY
case "next":
mediaKeyCode = NX_KEYTYPE_FAST
case "previous":
mediaKeyCode = NX_KEYTYPE_REWIND
case "volumeUp":
mediaKeyCode = NX_KEYTYPE_SOUND_UP
case "volumeDown":
mediaKeyCode = NX_KEYTYPE_SOUND_DOWN
default:
result(FlutterError(code: "UNSUPPORTED_KEY", message: "Unsupported media key identifier", details: nil))
return
}
// Create and post the media key event (key down)
let eventDown = NSEvent.otherEvent(
with: .systemDefined,
location: NSPoint.zero,
modifierFlags: NSEvent.ModifierFlags(rawValue: 0xa00),
timestamp: 0,
windowNumber: 0,
context: nil,
subtype: 8,
data1: Int((mediaKeyCode << 16) | (0xa << 8)),
data2: -1
)
eventDown?.cgEvent?.post(tap: .cghidEventTap)
// Create and post the media key event (key up)
let eventUp = NSEvent.otherEvent(
with: .systemDefined,
location: NSPoint.zero,
modifierFlags: NSEvent.ModifierFlags(rawValue: 0xb00),
timestamp: 0,
windowNumber: 0,
context: nil,
subtype: 8,
data1: Int((mediaKeyCode << 16) | (0xb << 8)),
data2: -1
)
eventUp?.cgEvent?.post(tap: .cghidEventTap)
result(true)
}
}

View File

@@ -61,4 +61,27 @@ class MethodChannelKeyPressSimulator extends KeyPressSimulatorPlatform {
};
await methodChannel.invokeMethod('simulateMouseClick', arguments);
}
@override
Future<void> simulateMediaKey(PhysicalKeyboardKey mediaKey) async {
// Map PhysicalKeyboardKey to string identifier since keyCode is null for media keys
final keyMap = {
PhysicalKeyboardKey.mediaPlayPause: 'playPause',
PhysicalKeyboardKey.mediaStop: 'stop',
PhysicalKeyboardKey.mediaTrackNext: 'next',
PhysicalKeyboardKey.mediaTrackPrevious: 'previous',
PhysicalKeyboardKey.audioVolumeUp: 'volumeUp',
PhysicalKeyboardKey.audioVolumeDown: 'volumeDown',
};
final keyIdentifier = keyMap[mediaKey];
if (keyIdentifier == null) {
throw UnsupportedError('Unsupported media key: $mediaKey');
}
final Map<String, Object?> arguments = {
'key': keyIdentifier,
};
await methodChannel.invokeMethod('simulateMediaKey', arguments);
}
}

View File

@@ -42,6 +42,10 @@ abstract class KeyPressSimulatorPlatform extends PlatformInterface {
}
Future<void> simulateMouseClick(Offset position, {required bool keyDown}) {
throw UnimplementedError('simulateKeyPress() has not been implemented.');
throw UnimplementedError('simulateMouseClick() has not been implemented.');
}
Future<void> simulateMediaKey(PhysicalKeyboardKey mediaKey) {
throw UnimplementedError('simulateMediaKey() has not been implemented.');
}
}

View File

@@ -1,17 +1,20 @@
#include "keypress_simulator_windows_plugin.h"
// This must be included before many other Windows headers.
#include <windows.h>
#include <flutter_windows.h>
#include <psapi.h>
#include <string.h>
#include <flutter_windows.h>
#include <windows.h>
#include <flutter/method_channel.h>
#include <flutter/plugin_registrar_windows.h>
#include <flutter/standard_method_codec.h>
#include <algorithm>
#include <memory>
#include <sstream>
#include <unordered_map>
#include <vector>
using flutter::EncodableList;
using flutter::EncodableMap;
@@ -27,7 +30,8 @@ struct FindWindowData {
};
BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam);
HWND FindTargetWindow(const std::string& processName, const std::string& windowTitle);
HWND FindTargetWindow(const std::string& processName,
const std::string& windowTitle);
// static
void KeypressSimulatorWindowsPlugin::RegisterWithRegistrar(
@@ -68,26 +72,91 @@ void KeypressSimulatorWindowsPlugin::SimulateKeyPress(
}
// List of compatible training apps to look for
std::vector<std::string> compatibleApps = {
"MyWhooshHD.exe",
"indieVelo.exe",
"biketerra.exe"
};
std::vector<std::string> compatibleApps = {"MyWhooshHD.exe", "MyWhoosh.exe",
"indieVelo.exe", "biketerra.exe",
"Rouvy.exe"};
// Try to find and focus a compatible app
// Try to find and focus (or directly target) a compatible app
std::string foundProcessName;
bool supportsBackgroundInput = true;
HWND targetWindow = NULL;
for (const std::string& processName : compatibleApps) {
targetWindow = FindTargetWindow(processName, "");
if (targetWindow != NULL) {
// Only focus the window if it's not already in the foreground
if (GetForegroundWindow() != targetWindow) {
foundProcessName = processName;
if (!supportsBackgroundInput && GetForegroundWindow() != targetWindow) {
SetForegroundWindow(targetWindow);
Sleep(50); // Brief delay to ensure window is focused
Sleep(50); // Brief delay to ensure window is focused
}
break;
}
}
// If we found a target window that supports background input and it's not
// focused, send messages directly
auto postKeyMessage = [](HWND hwnd, UINT vkCode, bool down) {
const WORD scanCode =
static_cast<WORD>(MapVirtualKey(vkCode, MAPVK_VK_TO_VSC));
// Build lParam with repeat count 1 and scan code; set transition states for
// key up
LPARAM lParam = 1 | (static_cast<LPARAM>(scanCode) << 16);
if (vkCode == VK_LEFT || vkCode == VK_RIGHT || vkCode == VK_UP ||
vkCode == VK_DOWN || vkCode == VK_INSERT || vkCode == VK_DELETE ||
vkCode == VK_HOME || vkCode == VK_END || vkCode == VK_PRIOR ||
vkCode == VK_NEXT) {
lParam |= (1 << 24); // extended key
}
if (!down) {
lParam |= (1 << 30); // previous key state
lParam |= (1 << 31); // transition state
}
PostMessage(hwnd, down ? WM_KEYDOWN : WM_KEYUP, vkCode, lParam);
};
auto sendKeyToWindow = [&postKeyMessage](HWND hwnd,
const std::vector<std::string>& mods,
UINT keyCode, bool down) {
auto handleModifier = [&postKeyMessage, hwnd](UINT vk, bool press) {
postKeyMessage(hwnd, vk, press);
};
if (down) {
for (const std::string& modifier : mods) {
if (modifier == "shiftModifier") {
handleModifier(VK_SHIFT, true);
} else if (modifier == "controlModifier") {
handleModifier(VK_CONTROL, true);
} else if (modifier == "altModifier") {
handleModifier(VK_MENU, true);
} else if (modifier == "metaModifier") {
handleModifier(VK_LWIN, true);
}
}
postKeyMessage(hwnd, keyCode, true);
} else {
postKeyMessage(hwnd, keyCode, false);
// release modifiers
for (const std::string& modifier : mods) {
if (modifier == "shiftModifier") {
handleModifier(VK_SHIFT, false);
} else if (modifier == "controlModifier") {
handleModifier(VK_CONTROL, false);
} else if (modifier == "altModifier") {
handleModifier(VK_MENU, false);
} else if (modifier == "metaModifier") {
handleModifier(VK_LWIN, false);
}
}
}
};
if (targetWindow != NULL && !foundProcessName.empty() &&
supportsBackgroundInput && GetForegroundWindow() != targetWindow) {
sendKeyToWindow(targetWindow, modifiers, keyCode, keyDown);
result->Success(flutter::EncodableValue(true));
return;
}
// Helper function to send modifier key events
auto sendModifierKey = [](UINT vkCode, bool down) {
WORD sc = (WORD)MapVirtualKey(vkCode, MAPVK_VK_TO_VSC);
@@ -100,7 +169,8 @@ void KeypressSimulatorWindowsPlugin::SimulateKeyPress(
};
// Helper function to process modifiers
auto processModifiers = [&sendModifierKey](const std::vector<std::string>& mods, bool down) {
auto processModifiers = [&sendModifierKey](
const std::vector<std::string>& mods, bool down) {
for (const std::string& modifier : mods) {
if (modifier == "shiftModifier") {
sendModifierKey(VK_SHIFT, down);
@@ -124,12 +194,13 @@ void KeypressSimulatorWindowsPlugin::SimulateKeyPress(
INPUT in = {0};
in.type = INPUT_KEYBOARD;
in.ki.wVk = 0; // when using SCANCODE, set VK=0
in.ki.wVk = 0; // when using SCANCODE, set VK=0
in.ki.wScan = sc;
in.ki.dwFlags = KEYEVENTF_SCANCODE | (keyDown ? 0 : KEYEVENTF_KEYUP);
if (keyCode == VK_LEFT || keyCode == VK_RIGHT || keyCode == VK_UP || keyCode == VK_DOWN ||
keyCode == VK_INSERT || keyCode == VK_DELETE || keyCode == VK_HOME || keyCode == VK_END ||
keyCode == VK_PRIOR || keyCode == VK_NEXT) {
if (keyCode == VK_LEFT || keyCode == VK_RIGHT || keyCode == VK_UP ||
keyCode == VK_DOWN || keyCode == VK_INSERT || keyCode == VK_DELETE ||
keyCode == VK_HOME || keyCode == VK_END || keyCode == VK_PRIOR ||
keyCode == VK_NEXT) {
in.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
}
SendInput(1, &in, sizeof(INPUT));
@@ -148,7 +219,6 @@ void KeypressSimulatorWindowsPlugin::SimulateKeyPress(
void KeypressSimulatorWindowsPlugin::SimulateMouseClick(
const flutter::MethodCall<flutter::EncodableValue>& method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
const EncodableMap& args = std::get<EncodableMap>(*method_call.arguments());
double x = 0;
double y = 0;
@@ -156,12 +226,12 @@ void KeypressSimulatorWindowsPlugin::SimulateMouseClick(
bool keyDown = std::get<bool>(args.at(EncodableValue("keyDown")));
auto it_x = args.find(EncodableValue("x"));
if (it_x != args.end() && std::holds_alternative<double>(it_x->second)) {
x = std::get<double>(it_x->second);
x = std::get<double>(it_x->second);
}
auto it_y = args.find(EncodableValue("y"));
if (it_y != args.end() && std::holds_alternative<double>(it_y->second)) {
y = std::get<double>(it_y->second);
y = std::get<double>(it_y->second);
}
// Get the monitor containing the target point and its DPI
@@ -169,7 +239,7 @@ void KeypressSimulatorWindowsPlugin::SimulateMouseClick(
HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
double scale_factor = dpi / 96.0;
// Scale the coordinates according to the DPI scaling
int scaled_x = static_cast<int>(x * scale_factor);
int scaled_y = static_cast<int>(y * scale_factor);
@@ -182,14 +252,14 @@ void KeypressSimulatorWindowsPlugin::SimulateMouseClick(
input.type = INPUT_MOUSE;
if (keyDown) {
// Mouse left button down
input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &input, sizeof(INPUT));
// Mouse left button down
input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &input, sizeof(INPUT));
} else {
// Mouse left button up
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &input, sizeof(INPUT));
// Mouse left button up
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &input, sizeof(INPUT));
}
result->Success(flutter::EncodableValue(true));
@@ -200,7 +270,7 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) {
// Check if window is visible and not minimized
if (!IsWindowVisible(hwnd) || IsIconic(hwnd)) {
return TRUE; // Continue enumeration
return TRUE; // Continue enumeration
}
// Get window title
@@ -210,7 +280,8 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) {
// Get process name
DWORD processId;
GetWindowThreadProcessId(hwnd, &processId);
HANDLE hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processId);
HANDLE hProcess =
OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, processId);
char processName[MAX_PATH];
if (hProcess) {
DWORD size = sizeof(processName);
@@ -218,7 +289,7 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) {
// Extract just the filename from the full path
char* filename = strrchr(processName, '\\');
if (filename) {
filename++; // Skip the backslash
filename++; // Skip the backslash
} else {
filename = processName;
}
@@ -227,7 +298,7 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) {
if (!data->targetProcessName.empty() &&
_stricmp(filename, data->targetProcessName.c_str()) == 0) {
data->foundWindow = hwnd;
return FALSE; // Stop enumeration
return FALSE; // Stop enumeration
}
}
CloseHandle(hProcess);
@@ -237,13 +308,14 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) {
if (!data->targetWindowTitle.empty() &&
_stricmp(windowTitle, data->targetWindowTitle.c_str()) == 0) {
data->foundWindow = hwnd;
return FALSE; // Stop enumeration
return FALSE; // Stop enumeration
}
return TRUE; // Continue enumeration
return TRUE; // Continue enumeration
}
HWND FindTargetWindow(const std::string& processName, const std::string& windowTitle) {
HWND FindTargetWindow(const std::string& processName,
const std::string& windowTitle) {
FindWindowData data;
data.targetProcessName = processName;
data.targetWindowTitle = windowTitle;
@@ -253,7 +325,45 @@ HWND FindTargetWindow(const std::string& processName, const std::string& windowT
return data.foundWindow;
}
void KeypressSimulatorWindowsPlugin::SimulateMediaKey(
const flutter::MethodCall<flutter::EncodableValue>& method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
const EncodableMap& args = std::get<EncodableMap>(*method_call.arguments());
std::string keyIdentifier =
std::get<std::string>(args.at(EncodableValue("key")));
// Map string identifier to Windows virtual key codes
static const std::unordered_map<std::string, UINT> keyMap = {
{"playPause", VK_MEDIA_PLAY_PAUSE}, {"stop", VK_MEDIA_STOP},
{"next", VK_MEDIA_NEXT_TRACK}, {"previous", VK_MEDIA_PREV_TRACK},
{"volumeUp", VK_VOLUME_UP}, {"volumeDown", VK_VOLUME_DOWN}};
auto it = keyMap.find(keyIdentifier);
if (it == keyMap.end()) {
result->Error("UNSUPPORTED_KEY", "Unsupported media key identifier");
return;
}
UINT vkCode = it->second;
// Send key down event
INPUT inputs[2] = {};
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = static_cast<WORD>(vkCode);
inputs[0].ki.dwFlags = 0; // Key down
// Send key up event
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = static_cast<WORD>(vkCode);
inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
UINT eventsSent = SendInput(2, inputs, sizeof(INPUT));
if (eventsSent != 2) {
result->Error("SEND_INPUT_FAILED", "Failed to send media key input events");
return;
}
result->Success(flutter::EncodableValue(true));
}
void KeypressSimulatorWindowsPlugin::HandleMethodCall(
const flutter::MethodCall<flutter::EncodableValue>& method_call,
@@ -262,6 +372,8 @@ void KeypressSimulatorWindowsPlugin::HandleMethodCall(
SimulateKeyPress(method_call, std::move(result));
} else if (method_call.method_name().compare("simulateMouseClick") == 0) {
SimulateMouseClick(method_call, std::move(result));
} else if (method_call.method_name().compare("simulateMediaKey") == 0) {
SimulateMediaKey(method_call, std::move(result));
} else {
result->NotImplemented();
}

View File

@@ -30,7 +30,9 @@ class KeypressSimulatorWindowsPlugin : public flutter::Plugin {
const flutter::MethodCall<flutter::EncodableValue>& method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
void KeypressSimulatorWindowsPlugin::SimulateMediaKey(
const flutter::MethodCall<flutter::EncodableValue>& method_call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
// Called when a method is called on this plugin's channel from Dart.
void HandleMethodCall(

View File

@@ -1,22 +1,21 @@
import 'dart:async';
import 'dart:io';
import 'package:bike_control/bluetooth/devices/bluetooth_device.dart';
import 'package:bike_control/bluetooth/devices/gamepad/gamepad_device.dart';
import 'package:bike_control/bluetooth/devices/gyroscope/gyroscope_steering.dart';
import 'package:bike_control/bluetooth/devices/hid/hid_device.dart';
import 'package:bike_control/bluetooth/devices/wahoo/wahoo_kickr_headwind.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/iap/iap_manager.dart';
import 'package:bike_control/utils/requirements/android.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:gamepads/gamepads.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:bike_control/bluetooth/devices/bluetooth_device.dart';
import 'package:bike_control/bluetooth/devices/gamepad/gamepad_device.dart';
import 'package:bike_control/bluetooth/devices/hid/hid_device.dart';
import 'package:bike_control/bluetooth/devices/wahoo/wahoo_kickr_headwind.dart';
import 'package:bike_control/bluetooth/devices/zwift/ftms_mdns_emulator.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/actions/android.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:bike_control/utils/requirements/android.dart';
import 'package:prop/prop.dart';
import 'package:universal_ble/universal_ble.dart';
import 'devices/base_device.dart';
@@ -28,10 +27,12 @@ class Connection {
List<BluetoothDevice> get bluetoothDevices => devices.whereType<BluetoothDevice>().toList();
List<GamepadDevice> get gamepadDevices => devices.whereType<GamepadDevice>().toList();
List<GyroscopeSteering> get gyroscopeDevices => devices.whereType<GyroscopeSteering>().toList();
List<WahooKickrHeadwind> get accessories => devices.whereType<WahooKickrHeadwind>().toList();
List<BaseDevice> get controllerDevices => [
...bluetoothDevices.where((d) => d is! WahooKickrHeadwind),
...gamepadDevices,
...gyroscopeDevices,
...devices.whereType<HidDevice>(),
];
@@ -48,6 +49,8 @@ class Connection {
final Map<BaseDevice, StreamSubscription<bool>> _connectionSubscriptions = {};
final StreamController<BaseDevice> _connectionStreams = StreamController<BaseDevice>.broadcast();
Stream<BaseDevice> get connectionStream => _connectionStreams.stream;
final StreamController<BluetoothDevice> _rssiConnectionStreams = StreamController<BluetoothDevice>.broadcast();
Stream<BluetoothDevice> get rssiConnectionStream => _rssiConnectionStreams.stream;
final _lastScanResult = <BleDevice>[];
final ValueNotifier<bool> hasDevices = ValueNotifier(false);
@@ -61,6 +64,10 @@ class Connection {
lastLogEntries = lastLogEntries.takeLast(kIsWeb ? 1000 : 60).toList();
});
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows)) {
core.mediaKeyHandler.initialize();
}
UniversalBle.onAvailabilityChange = (available) {
_actionStreams.add(BluetoothAvailabilityNotification(available == AvailabilityState.poweredOn));
if (available == AvailabilityState.poweredOn && !kIsWeb) {
@@ -70,7 +77,8 @@ class Connection {
}
});
} else if (available == AvailabilityState.poweredOff) {
reset();
disconnectAll();
stop();
}
};
UniversalBle.onScanResult = (result) {
@@ -80,20 +88,22 @@ class Connection {
);
if (existingDevice != null && existingDevice.rssi != result.rssi) {
existingDevice.rssi = result.rssi;
_connectionStreams.add(existingDevice); // Notify UI of update
_rssiConnectionStreams.add(existingDevice); // Notify UI of update
}
if (_lastScanResult.none((e) => e.deviceId == result.deviceId && e.services.contentEquals(result.services))) {
_lastScanResult.add(result);
if (kDebugMode) {
print('Scan result: ${result.name} - ${result.deviceId}');
if (false) {
debugPrint('Scan result: ${result.name} - ${result.deviceId}');
}
final scanResult = BluetoothDevice.fromScanResult(result);
if (scanResult != null) {
_actionStreams.add(LogNotification('Found new device: ${kIsWeb ? scanResult.name : scanResult.runtimeType}'));
_actionStreams.add(
LogNotification('Found new device: ${kIsWeb ? scanResult.toString() : scanResult.runtimeType}'),
);
addDevices([scanResult]);
} else {
final manufacturerData = result.manufacturerDataList;
@@ -120,7 +130,7 @@ class Connection {
// on web, log all characteristic changes for debugging
_actionStreams.add(
LogNotification(
'Characteristic update for device ${device.name}, char: $characteristicUuid, value: ${bytesToReadableHex(value)}',
'Characteristic update for device ${device.toString()}, char: $characteristicUuid, value: ${bytesToReadableHex(value)}',
),
);
}
@@ -129,7 +139,7 @@ class Connection {
} catch (e, backtrace) {
_actionStreams.add(
LogNotification(
"Error processing characteristic for device ${device.name} and char: $characteristicUuid: $e\n$backtrace",
"Error processing characteristic for device ${device.toString()} and char: $characteristicUuid: $e\n$backtrace",
),
);
if (kDebugMode) {
@@ -154,6 +164,9 @@ class Connection {
performScanning();
}
});
if (core.settings.getPhoneSteeringEnabled()) {
toggleGyroscopeSteering(true);
}
}
}
@@ -164,6 +177,10 @@ class Connection {
isScanning.value = true;
_actionStreams.add(LogNotification('Scanning for devices...'));
if (screenshotMode) {
return;
}
// does not work on web, may not work on Windows
if (!kIsWeb && !Platform.isWindows) {
UniversalBle.getSystemDevices(
@@ -202,14 +219,6 @@ class Connection {
} else {
isScanning.value = false;
}
if (devices.isNotEmpty && !_androidNotificationsSetup && !kIsWeb && Platform.isAndroid) {
_androidNotificationsSetup = true;
// start foreground service only when app is in foreground
NotificationRequirement.setup().catchError((e) {
_actionStreams.add(LogNotification(e.toString()));
});
}
}
Future<void> startMyWhooshServer() {
@@ -248,16 +257,28 @@ class Connection {
hasDevices.value = devices.isNotEmpty;
}
void toggleGyroscopeSteering(bool enable) {
final existing = gyroscopeDevices.firstOrNull;
if (existing != null && !enable) {
// Remove gyroscope steering
disconnect(existing, forget: true, persistForget: false);
} else if (enable) {
// Add gyroscope steering
final gyroDevice = GyroscopeSteering();
addDevices([gyroDevice]);
}
}
void _handleConnectionQueue() {
// windows apparently has issues when connecting to multiple devices at once, so don't
if (_connectionQueue.isNotEmpty && !_handlingConnectionQueue && !screenshotMode) {
_handlingConnectionQueue = true;
final device = _connectionQueue.removeAt(0);
_actionStreams.add(AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connecting to: ${device.name}'));
_actionStreams.add(AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connecting to: ${device.toString()}'));
_connect(device)
.then((_) {
_handlingConnectionQueue = false;
_actionStreams.add(AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connection finished: ${device.name}'));
_actionStreams.add(AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connection finished: ${device.toString()}'));
if (_connectionQueue.isNotEmpty) {
_handleConnectionQueue();
}
@@ -267,11 +288,11 @@ class Connection {
_handlingConnectionQueue = false;
if (e is TimeoutException) {
_actionStreams.add(
AlertNotification(LogLevel.LOGLEVEL_WARNING, 'Unable to connect to ${device.name}: Timeout'),
AlertNotification(LogLevel.LOGLEVEL_WARNING, 'Unable to connect to ${device.toString()}: Timeout'),
);
} else {
_actionStreams.add(
AlertNotification(LogLevel.LOGLEVEL_ERROR, 'Connection failed: ${device.name} - $e'),
AlertNotification(LogLevel.LOGLEVEL_ERROR, 'Connection failed: ${device.toString()} - $e'),
);
}
if (_connectionQueue.isNotEmpty) {
@@ -287,9 +308,18 @@ class Connection {
_actionStreams.add(data);
});
if (device is BluetoothDevice) {
final connectionStateSubscription = UniversalBle.connectionStream(device.device.deviceId).listen((state) {
final connectionStateSubscription = device.device.connectionStream.listen((state) {
device.isConnected = state;
_connectionStreams.add(device);
core.flutterLocalNotificationsPlugin.show(
1338,
'${device.toString()} ${state ? AppLocalizations.current.connected.decapitalize() : AppLocalizations.current.disconnected.decapitalize()}',
!state ? AppLocalizations.current.tryingToConnectAgain : null,
NotificationDetails(
android: AndroidNotificationDetails('Connection', 'Connection Status'),
iOS: DarwinNotificationDetails(presentAlert: true, presentSound: false),
),
);
if (!device.isConnected) {
disconnect(device, forget: false, persistForget: false);
// try reconnect
@@ -302,22 +332,19 @@ class Connection {
await device.connect();
signalChange(device);
final newButtons = device.availableButtons.filter(
(button) => core.actionHandler.supportedApp?.keymap.getKeyPair(button) == null,
);
for (final button in newButtons) {
core.actionHandler.supportedApp?.keymap.addKeyPair(
KeyPair(
touchPosition: Offset.zero,
buttons: [button],
physicalKey: null,
logicalKey: null,
isLongPress: false,
),
);
}
IAPManager.instance.setAttributes();
core.actionHandler.supportedApp?.keymap.addNewButtons(device.availableButtons);
_streamSubscriptions[device] = actionSubscription;
if (devices.isNotEmpty && !_androidNotificationsSetup && !kIsWeb && Platform.isAndroid) {
_androidNotificationsSetup = true;
// start foreground service only when app is in foreground
NotificationRequirement.addPersistentNotification().catchError((e) {
_actionStreams.add(LogNotification(e.toString()));
});
}
} catch (e, backtrace) {
_actionStreams.add(LogNotification("$e\n$backtrace"));
if (kDebugMode) {
@@ -328,31 +355,6 @@ class Connection {
}
}
Future<void> reset() async {
_actionStreams.add(LogNotification('Disconnecting all devices'));
if (core.actionHandler is AndroidActions) {
AndroidFlutterLocalNotificationsPlugin().stopForegroundService();
_androidNotificationsSetup = false;
}
final isBtEnabled = (await UniversalBle.getBluetoothAvailabilityState()) == AvailabilityState.poweredOn;
if (isBtEnabled) {
UniversalBle.stopScan();
}
isScanning.value = false;
for (var device in bluetoothDevices) {
_streamSubscriptions[device]?.cancel();
_streamSubscriptions.remove(device);
_connectionSubscriptions[device]?.cancel();
_connectionSubscriptions.remove(device);
UniversalBle.disconnect(device.device.deviceId);
signalChange(device);
}
_gamePadSearchTimer?.cancel();
_lastScanResult.clear();
hasDevices.value = false;
devices.clear();
}
void signalNotification(BaseNotification notification) {
_actionStreams.add(notification);
}
@@ -369,8 +371,8 @@ class Connection {
if (device is BluetoothDevice) {
if (persistForget) {
// Add device to ignored list when forgetting
await core.settings.addIgnoredDevice(device.device.deviceId, device.name);
_actionStreams.add(LogNotification('Device ignored: ${device.name}'));
await core.settings.addIgnoredDevice(device.device.deviceId, device.toString());
_actionStreams.add(LogNotification('Device ignored: ${device.toString()}'));
}
if (!forget) {
// allow reconnection
@@ -383,6 +385,16 @@ class Connection {
_connectionSubscriptions[device]?.cancel();
_connectionSubscriptions.remove(device);
// Remove device from the list
devices.remove(device);
hasDevices.value = devices.isNotEmpty;
} else if (device is GyroscopeSteering) {
// Clean up subscriptions
_streamSubscriptions[device]?.cancel();
_streamSubscriptions.remove(device);
_connectionSubscriptions[device]?.cancel();
_connectionSubscriptions.remove(device);
// Remove device from the list
devices.remove(device);
hasDevices.value = devices.isNotEmpty;
@@ -390,4 +402,29 @@ class Connection {
signalChange(device);
}
Future<void> disconnectAll() async {
_actionStreams.add(LogNotification('Disconnecting all devices'));
for (var device in bluetoothDevices) {
_streamSubscriptions[device]?.cancel();
_streamSubscriptions.remove(device);
_connectionSubscriptions[device]?.cancel();
_connectionSubscriptions.remove(device);
device.disconnect();
signalChange(device);
devices.remove(device);
}
_gamePadSearchTimer?.cancel();
_lastScanResult.clear();
hasDevices.value = false;
}
Future<void> stop() async {
final isBtEnabled = (await UniversalBle.getBluetoothAvailabilityState()) == AvailabilityState.poweredOn;
if (isBtEnabled) {
UniversalBle.stopScan();
}
isScanning.value = false;
_androidNotificationsSetup = false;
}
}

View File

@@ -1,25 +1,43 @@
import 'dart:async';
import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/actions/desktop.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/iap/iap_manager.dart';
import 'package:bike_control/utils/keymap/apps/custom_app.dart';
import 'package:bike_control/utils/keymap/manager.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:prop/prop.dart' show LogLevel;
import '../../utils/keymap/buttons.dart';
import '../messages/notification.dart';
abstract class BaseDevice {
final String name;
final String? _name;
final bool isBeta;
final String uniqueId;
final List<ControllerButton> availableButtons;
BaseDevice(this.name, {required this.availableButtons, this.isBeta = false}) {
BaseDevice(
this._name, {
required this.uniqueId,
required this.availableButtons,
this.isBeta = false,
String? buttonPrefix,
}) {
if (availableButtons.isEmpty && core.actionHandler.supportedApp is CustomApp) {
// TODO we should verify where the buttons came from
final allButtons = core.actionHandler.supportedApp!.keymap.keyPairs.flatMap((e) => e.buttons);
final allButtons = core.actionHandler.supportedApp!.keymap.keyPairs
.flatMap((e) => e.buttons)
.filter(
(e) =>
e.sourceDeviceId == uniqueId ||
(e.sourceDeviceId == null && buttonPrefix != null && e.name.startsWith(buttonPrefix)),
)
.toSet();
availableButtons.addAll(allButtons);
}
}
@@ -29,17 +47,18 @@ abstract class BaseDevice {
Timer? _longPressTimer;
Set<ControllerButton> _previouslyPressedButtons = <ControllerButton>{};
String get name => _name ?? runtimeType.toString();
@override
bool operator ==(Object other) =>
identical(this, other) || other is BaseDevice && runtimeType == other.runtimeType && name == other.name;
identical(this, other) ||
other is BaseDevice && runtimeType == other.runtimeType && toString() == other.toString();
@override
int get hashCode => name.hashCode;
@override
String toString() {
return name;
}
String toString() => name;
final StreamController<BaseNotification> actionStreamInternal = StreamController<BaseNotification>.broadcast();
@@ -47,9 +66,26 @@ abstract class BaseDevice {
Future<void> connect();
Future<void> handleButtonsClicked(List<ControllerButton>? buttonsClicked) async {
Future<void> handleButtonsClickedWithoutLongPressSupport(List<ControllerButton> clickedButtons) async {
await handleButtonsClicked(clickedButtons, longPress: true);
if (clickedButtons.length == 1) {
final keyPair = core.actionHandler.supportedApp?.keymap.getKeyPair(clickedButtons.single);
if (keyPair != null && (keyPair.isLongPress || keyPair.inGameAction?.isLongPress == true)) {
// simulate release after click
_longPressTimer?.cancel();
await Future.delayed(const Duration(milliseconds: 800));
await handleButtonsClicked([], longPress: true);
} else {
await handleButtonsClicked([], longPress: true);
}
} else {
await handleButtonsClicked([]);
}
}
Future<void> handleButtonsClicked(List<ControllerButton>? buttonsClicked, {bool longPress = false}) async {
try {
await _handleButtonsClickedInternal(buttonsClicked);
await _handleButtonsClickedInternal(buttonsClicked, longPress: longPress);
} catch (e, st) {
actionStreamInternal.add(
LogNotification('Error handling button clicks: $e\n$st'),
@@ -57,7 +93,7 @@ abstract class BaseDevice {
}
}
Future<void> _handleButtonsClickedInternal(List<ControllerButton>? buttonsClicked) async {
Future<void> _handleButtonsClickedInternal(List<ControllerButton>? buttonsClicked, {required bool longPress}) async {
if (buttonsClicked == null) {
// ignore, no changes
} else if (buttonsClicked.isEmpty) {
@@ -67,8 +103,9 @@ abstract class BaseDevice {
// Handle release events for long press keys
final buttonsReleased = _previouslyPressedButtons.toList();
final isLongPress =
longPress ||
buttonsReleased.singleOrNull != null &&
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsReleased.single)?.isLongPress == true;
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsReleased.single)?.isLongPress == true;
if (buttonsReleased.isNotEmpty && isLongPress) {
await performRelease(buttonsReleased);
}
@@ -79,15 +116,17 @@ abstract class BaseDevice {
// Handle release events for buttons that are no longer pressed
final buttonsReleased = _previouslyPressedButtons.difference(buttonsClicked.toSet()).toList();
final wasLongPress =
longPress ||
buttonsReleased.singleOrNull != null &&
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsReleased.single)?.isLongPress == true;
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsReleased.single)?.isLongPress == true;
if (buttonsReleased.isNotEmpty && wasLongPress) {
await performRelease(buttonsReleased);
}
final isLongPress =
longPress ||
buttonsClicked.singleOrNull != null &&
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsClicked.single)?.isLongPress == true;
core.actionHandler.supportedApp?.keymap.getKeyPair(buttonsClicked.single)?.isLongPress == true;
if (!isLongPress &&
!(buttonsClicked.singleOrNull == ZwiftButtons.onOffLeft ||
@@ -109,16 +148,46 @@ abstract class BaseDevice {
}
}
String _getCommandLimitMessage() {
return AppLocalizations.current.dailyCommandLimitReachedNotification;
}
String _getCommandLimitTitle() {
return AppLocalizations.current
.dailyLimitReached(IAPManager.dailyCommandLimit, IAPManager.dailyCommandLimit)
.replaceAll(
'${IAPManager.dailyCommandLimit}/${IAPManager.dailyCommandLimit}',
IAPManager.dailyCommandLimit.toString(),
)
.replaceAll(
'${IAPManager.dailyCommandLimit} / ${IAPManager.dailyCommandLimit}',
IAPManager.dailyCommandLimit.toString(),
);
}
Future<void> performDown(List<ControllerButton> buttonsClicked) async {
for (final action in buttonsClicked) {
// Check IAP status before executing command
if (!IAPManager.instance.canExecuteCommand) {
//actionStreamInternal.add(AlertNotification(LogLevel.LOGLEVEL_ERROR, _getCommandLimitMessage()));
continue;
}
// For repeated actions, don't trigger key down/up events (useful for long press)
final result = await core.actionHandler.performAction(action, isKeyDown: true, isKeyUp: false);
actionStreamInternal.add(LogNotification(result.message));
actionStreamInternal.add(ActionNotification(result));
}
}
Future<void> performClick(List<ControllerButton> buttonsClicked) async {
for (final action in buttonsClicked) {
// Check IAP status before executing command
if (!IAPManager.instance.canExecuteCommand) {
_showCommandLimitAlert();
continue;
}
final result = await core.actionHandler.performAction(action, isKeyDown: true, isKeyUp: true);
actionStreamInternal.add(ActionNotification(result));
}
@@ -126,8 +195,14 @@ abstract class BaseDevice {
Future<void> performRelease(List<ControllerButton> buttonsReleased) async {
for (final action in buttonsReleased) {
// Check IAP status before executing command
if (!IAPManager.instance.canExecuteCommand) {
_showCommandLimitAlert();
continue;
}
final result = await core.actionHandler.performAction(action, isKeyDown: false, isKeyUp: true);
actionStreamInternal.add(ActionNotification(result));
actionStreamInternal.add(LogNotification(result.message));
}
}
@@ -144,12 +219,19 @@ abstract class BaseDevice {
Widget showInformation(BuildContext context);
ControllerButton getOrAddButton(String key, ControllerButton Function() creator) {
if (core.actionHandler.supportedApp == null) {
return creator();
}
if (core.actionHandler.supportedApp is! CustomApp) {
final currentProfile = core.actionHandler.supportedApp!.name;
// should we display this to the user?
KeymapManager().duplicateSync(currentProfile, '$currentProfile (Copy)');
}
final button = core.actionHandler.supportedApp!.keymap.getOrAddButton(key, creator);
var createdButton = creator();
if (createdButton.sourceDeviceId == null) {
createdButton = createdButton.copyWith(sourceDeviceId: uniqueId);
}
final button = core.actionHandler.supportedApp!.keymap.getOrAddButton(key, createdButton);
if (availableButtons.none((e) => e.name == button.name)) {
availableButtons.add(button);
@@ -157,4 +239,26 @@ abstract class BaseDevice {
}
return button;
}
void _showCommandLimitAlert() {
actionStreamInternal.add(
AlertNotification(
LogLevel.LOGLEVEL_ERROR,
_getCommandLimitMessage(),
buttonTitle: AppLocalizations.current.purchase,
onTap: () {
IAPManager.instance.purchaseFullVersion(navigatorKey.currentContext!);
},
),
);
core.flutterLocalNotificationsPlugin.show(
1337,
_getCommandLimitTitle(),
_getCommandLimitMessage(),
NotificationDetails(
android: AndroidNotificationDetails('Limit', 'Limit reached'),
iOS: DarwinNotificationDetails(presentAlert: true),
),
);
}
}

View File

@@ -4,6 +4,7 @@ import 'package:bike_control/bluetooth/ble.dart';
import 'package:bike_control/bluetooth/devices/base_device.dart';
import 'package:bike_control/bluetooth/devices/openbikecontrol/openbikecontrol_device.dart';
import 'package:bike_control/bluetooth/devices/shimano/shimano_di2.dart';
import 'package:bike_control/bluetooth/devices/sram/sram_axs.dart';
import 'package:bike_control/bluetooth/devices/wahoo/wahoo_kickr_bike_pro.dart';
import 'package:bike_control/bluetooth/devices/wahoo/wahoo_kickr_bike_shift.dart';
import 'package:bike_control/bluetooth/devices/wahoo/wahoo_kickr_headwind.dart';
@@ -17,9 +18,12 @@ import 'package:bike_control/main.dart';
import 'package:bike_control/pages/device.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/widgets/ui/beta_pill.dart';
import 'package:bike_control/widgets/ui/device_info.dart';
import 'package:bike_control/widgets/ui/loading_widget.dart';
import 'package:bike_control/widgets/ui/small_progress_indicator.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
@@ -28,12 +32,26 @@ import 'package:universal_ble/universal_ble.dart';
import 'cycplus/cycplus_bc2.dart';
import 'elite/elite_square.dart';
import 'elite/elite_sterzo.dart';
import 'thinkrider/thinkrider_vs200.dart';
abstract class BluetoothDevice extends BaseDevice {
final BleDevice scanResult;
BluetoothDevice(this.scanResult, {required super.availableButtons, super.isBeta = false})
: super(scanResult.name ?? 'Unknown Device') {
BluetoothDevice(
this.scanResult, {
required List<ControllerButton> availableButtons,
bool allowMultiple = false,
bool isBeta = false,
String? buttonPrefix,
}) : super(
scanResult.name,
uniqueId: scanResult.deviceId,
availableButtons: allowMultiple
? availableButtons.map((b) => b.copyWith(sourceDeviceId: scanResult.deviceId)).toList()
: availableButtons,
isBeta: isBeta,
buttonPrefix: buttonPrefix,
) {
rssi = scanResult.rssi;
}
@@ -52,15 +70,24 @@ abstract class BluetoothDevice extends BaseDevice {
ShimanoDi2Constants.SERVICE_UUID,
ShimanoDi2Constants.SERVICE_UUID_ALTERNATIVE,
OpenBikeControlConstants.SERVICE_UUID,
ThinkRiderVs200Constants.SERVICE_UUID,
];
static final List<String> _ignoredNames = ['ASSIOMA', 'QUARQ', 'POWERCRANK'];
static BluetoothDevice? fromScanResult(BleDevice scanResult) {
// skip devices with ignored names
if (scanResult.name != null &&
_ignoredNames.any((ignoredName) => scanResult.name!.toUpperCase().startsWith(ignoredName))) {
return null;
}
// Use the name first as the "System Devices" and Web (android sometimes Windows) don't have manufacturer data
BluetoothDevice? device;
if (kIsWeb) {
device = switch (scanResult.name) {
'Zwift Ride' => ZwiftRide(scanResult),
'Zwift Play' => ZwiftPlay(scanResult),
'Zwift Play' => ZwiftPlay(scanResult, deviceType: ZwiftDeviceType.playLeft),
'Zwift Click' => ZwiftClickV2(scanResult),
'SQUARE' => EliteSquare(scanResult),
'OpenBike' => OpenBikeControlDevice(scanResult),
@@ -71,7 +98,9 @@ abstract class BluetoothDevice extends BaseDevice {
_ when scanResult.name!.toUpperCase().startsWith('KICKR BIKE PRO') => WahooKickrBikePro(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('CYCPLUS') && scanResult.name!.toUpperCase().contains('BC2') =>
CycplusBc2(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('THINK VS') => ThinkRiderVs200(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('RDR') => ShimanoDi2(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('SRAM') => SramAxs(scanResult),
_ => null,
};
} else {
@@ -79,7 +108,7 @@ abstract class BluetoothDevice extends BaseDevice {
null => null,
//'Zwift Ride' => ZwiftRide(scanResult), special case for Zwift Ride: we must only connect to the left controller
// https://www.makinolo.com/blog/2024/07/26/zwift-ride-protocol/
'Zwift Play' => ZwiftPlay(scanResult),
//'Zwift Play' => ZwiftPlay(scanResult),
//'Zwift Click' => ZwiftClick(scanResult), special case for Zwift Click v2: we must only connect to the left controller
_ when scanResult.name!.toUpperCase().startsWith('HEADWIND') => WahooKickrHeadwind(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('SQUARE') => EliteSquare(scanResult),
@@ -88,11 +117,15 @@ abstract class BluetoothDevice extends BaseDevice {
_ when scanResult.name!.toUpperCase().startsWith('KICKR BIKE PRO') => WahooKickrBikePro(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('CYCPLUS') && scanResult.name!.toUpperCase().contains('BC2') =>
CycplusBc2(scanResult),
_ when scanResult.services.contains(CycplusBc2Constants.SERVICE_UUID.toLowerCase()) => CycplusBc2(scanResult),
_ when scanResult.name!.toUpperCase().startsWith('THINK VS') => ThinkRiderVs200(scanResult),
//_ when scanResult.services.contains(CycplusBc2Constants.SERVICE_UUID.toLowerCase()) => CycplusBc2(scanResult),
_ when scanResult.services.contains(ShimanoDi2Constants.SERVICE_UUID.toLowerCase()) => ShimanoDi2(scanResult),
_ when scanResult.services.contains(ShimanoDi2Constants.SERVICE_UUID_ALTERNATIVE.toLowerCase()) => ShimanoDi2(
scanResult,
),
_ when scanResult.services.contains(SramAxsConstants.SERVICE_UUID.toLowerCase()) => SramAxs(
scanResult,
),
_ when scanResult.services.contains(OpenBikeControlConstants.SERVICE_UUID.toLowerCase()) =>
OpenBikeControlDevice(scanResult),
_ when scanResult.services.contains(WahooKickrHeadwindConstants.SERVICE_UUID.toLowerCase()) =>
@@ -115,28 +148,34 @@ abstract class BluetoothDevice extends BaseDevice {
?.payload;
if (data == null || data.isEmpty) {
return null;
} else {
final type = ZwiftDeviceType.fromManufacturerData(data.first);
device = switch (type) {
ZwiftDeviceType.click => ZwiftClick(scanResult),
ZwiftDeviceType.playRight => ZwiftPlay(scanResult, deviceType: type!),
ZwiftDeviceType.playLeft => ZwiftPlay(scanResult, deviceType: type!),
ZwiftDeviceType.rideLeft => ZwiftRide(scanResult),
//DeviceType.rideRight => ZwiftRide(scanResult), // see comment above
ZwiftDeviceType.clickV2Left => ZwiftClickV2(scanResult),
//DeviceType.clickV2Right => ZwiftClickV2(scanResult), // see comment above
_ => null,
};
}
final type = ZwiftDeviceType.fromManufacturerData(data.first);
return switch (type) {
ZwiftDeviceType.click => ZwiftClick(scanResult),
ZwiftDeviceType.playRight => ZwiftPlay(scanResult),
ZwiftDeviceType.playLeft => ZwiftPlay(scanResult),
ZwiftDeviceType.rideLeft => ZwiftRide(scanResult),
//DeviceType.rideRight => ZwiftRide(scanResult), // see comment above
ZwiftDeviceType.clickV2Left => ZwiftClickV2(scanResult),
//DeviceType.clickV2Right => ZwiftClickV2(scanResult), // see comment above
_
when scanResult.name == 'Zwift Ride' &&
type != ZwiftDeviceType.rideRight &&
type != ZwiftDeviceType.rideLeft =>
ZwiftRide(scanResult), // e.g. old firmware
_ => null,
};
} else {
return null;
}
if (scanResult.name == 'Zwift Ride' &&
device == null &&
core.connection.controllerDevices.none((d) => d is ZwiftRide)) {
// Fallback for Zwift Ride if nothing else matched => old firmware
if (navigatorKey.currentContext?.mounted ?? false) {
buildToast(
navigatorKey.currentContext!,
title: 'You may need to update your Zwift Ride firmware.',
duration: Duration(seconds: 6),
);
}
}
return device;
}
@override
@@ -147,11 +186,6 @@ abstract class BluetoothDevice extends BaseDevice {
@override
int get hashCode => scanResult.deviceId.hashCode;
@override
String toString() {
return name + (firmwareVersion != null ? ' v$firmwareVersion' : '');
}
BleDevice get device => scanResult;
@override
@@ -225,7 +259,7 @@ abstract class BluetoothDevice extends BaseDevice {
spacing: 8,
children: [
Text(
device.name?.screenshot ?? runtimeType.toString(),
toString().screenshot ?? runtimeType.toString(),
style: TextStyle(fontWeight: FontWeight.bold),
),
if (isBeta) BetaPill(),
@@ -273,113 +307,79 @@ abstract class BluetoothDevice extends BaseDevice {
spacing: 12,
runSpacing: 12,
children: [
SizedBox(
width: screenshotMode ? 160 : null,
height: screenshotMode ? 70 : null,
child: Card(
filled: true,
fillColor: Theme.of(context).colorScheme.background,
padding: EdgeInsets.all(12),
child: Basic(
title: Text(context.i18n.connection).xSmall,
trailingAlignment: Alignment.centerRight,
trailing: Icon(switch (isConnected) {
true => Icons.bluetooth_connected_outlined,
false => Icons.bluetooth_disabled_outlined,
}),
subtitle: Text(
isConnected ? context.i18n.connected : context.i18n.disconnected,
style: TextStyle(fontSize: 12),
),
),
),
DeviceInfo(
title: context.i18n.connection,
icon: switch (isConnected) {
true => Icons.bluetooth_connected_outlined,
false => Icons.bluetooth_disabled_outlined,
},
value: isConnected ? context.i18n.connected : context.i18n.disconnected,
),
if (batteryLevel != null)
SizedBox(
width: screenshotMode ? 160 : null,
height: screenshotMode ? 70 : null,
child: Card(
filled: true,
fillColor: Theme.of(context).colorScheme.background,
padding: EdgeInsets.all(12),
child: Basic(
title: Text(context.i18n.battery).xSmall,
trailingAlignment: Alignment.centerRight,
trailing: Icon(switch (batteryLevel!) {
>= 80 => Icons.battery_full,
>= 60 => Icons.battery_6_bar,
>= 50 => Icons.battery_5_bar,
>= 25 => Icons.battery_4_bar,
>= 10 => Icons.battery_2_bar,
_ => Icons.battery_alert,
}),
subtitle: Text(
'$batteryLevel%',
style: TextStyle(fontSize: 12),
),
),
),
DeviceInfo(
title: context.i18n.battery,
icon: switch (batteryLevel!) {
>= 80 => Icons.battery_full,
>= 60 => Icons.battery_6_bar,
>= 50 => Icons.battery_5_bar,
>= 25 => Icons.battery_4_bar,
>= 10 => Icons.battery_2_bar,
_ => Icons.battery_alert,
},
value: '$batteryLevel%',
),
if (firmwareVersion != null)
SizedBox(
width: screenshotMode ? 160 : null,
height: screenshotMode ? 70 : null,
child: Card(
filled: true,
padding: EdgeInsets.all(12),
fillColor: Theme.of(context).colorScheme.background,
child: Basic(
title: Text(context.i18n.firmware).xSmall,
subtitle: Row(
children: [
Text(
'$firmwareVersion',
style: TextStyle(fontSize: 12),
),
if (this is ZwiftDevice && firmwareVersion != (this as ZwiftDevice).latestFirmwareVersion)
Text(
' (${context.i18n.latestVersion((this as ZwiftDevice).latestFirmwareVersion)})',
style: TextStyle(color: Theme.of(context).colorScheme.destructive, fontSize: 12),
),
],
),
trailingAlignment: Alignment.centerRight,
trailing: this is ZwiftDevice && firmwareVersion != (this as ZwiftDevice).latestFirmwareVersion
? Icon(Icons.warning, color: Theme.of(context).colorScheme.destructive)
: Icon(Icons.text_fields_sharp),
),
),
DeviceInfo(
title: context.i18n.firmware,
icon: this is ZwiftDevice && firmwareVersion != (this as ZwiftDevice).latestFirmwareVersion
? Icons.warning
: Icons.text_fields_sharp,
value: firmwareVersion!,
additionalInfo: (this is ZwiftDevice && firmwareVersion != (this as ZwiftDevice).latestFirmwareVersion)
? Text(
' (${context.i18n.latestVersion((this as ZwiftDevice).latestFirmwareVersion)})',
style: TextStyle(color: Theme.of(context).colorScheme.destructive, fontSize: 12),
)
: null,
),
if (rssi != null)
SizedBox(
width: screenshotMode ? 160 : null,
height: screenshotMode ? 70 : null,
child: Card(
filled: true,
padding: EdgeInsets.all(12),
fillColor: Theme.of(context).colorScheme.background,
child: Basic(
title: Text(context.i18n.signal).xSmall,
trailingAlignment: Alignment.centerRight,
trailing: Icon(
switch (rssi!) {
>= -50 => Icons.signal_cellular_4_bar,
>= -60 => Icons.signal_cellular_alt_2_bar,
>= -70 => Icons.signal_cellular_alt_1_bar,
_ => Icons.signal_cellular_alt,
},
size: 18,
),
subtitle: Text(
'$rssi dBm',
style: TextStyle(fontSize: 12),
),
),
),
StreamBuilder(
stream: core.connection.rssiConnectionStream
.where((device) => device == this)
.map((event) => event.rssi),
builder: (context, rssiValue) {
return DeviceInfo(
title: context.i18n.signal,
icon: switch (rssiValue.data ?? rssi!) {
>= -50 => Icons.signal_cellular_4_bar,
>= -60 => Icons.signal_cellular_alt_2_bar,
>= -70 => Icons.signal_cellular_alt_1_bar,
_ => Icons.signal_cellular_alt,
},
value: '$rssi dBm',
);
},
),
],
),
],
);
}
void debugSubscribeToAll(List<BleService> services) {
for (final service in services) {
for (final characteristic in service.characteristics) {
if (characteristic.properties.contains(CharacteristicProperty.indicate)) {
debugPrint('Subscribing to indications for ${service.uuid} / ${characteristic.uuid}');
UniversalBle.subscribeIndications(device.deviceId, service.uuid, characteristic.uuid);
}
if (characteristic.properties.contains(CharacteristicProperty.notify)) {
debugPrint('Subscribing to notifications for ${service.uuid} / ${characteristic.uuid}');
UniversalBle.subscribeNotifications(device.deviceId, service.uuid, characteristic.uuid);
}
}
}
}
}

View File

@@ -11,6 +11,7 @@ class CycplusBc2 extends BluetoothDevice {
CycplusBc2(super.scanResult)
: super(
availableButtons: CycplusBc2Buttons.values,
allowMultiple: true,
);
@override
@@ -40,7 +41,7 @@ class CycplusBc2 extends BluetoothDevice {
// Process index 6 (shift up)
final currentByte6 = bytes[6];
if (_shouldTriggerShift(currentByte6, _lastStateIndex6)) {
buttonsToPress.add(CycplusBc2Buttons.shiftUp);
buttonsToPress.add(availableButtons[0]);
_lastStateIndex6 = 0x00; // Reset after successful press
} else {
_updateState(currentByte6, (val) => _lastStateIndex6 = val);
@@ -49,7 +50,7 @@ class CycplusBc2 extends BluetoothDevice {
// Process index 7 (shift down)
final currentByte7 = bytes[7];
if (_shouldTriggerShift(currentByte7, _lastStateIndex7)) {
buttonsToPress.add(CycplusBc2Buttons.shiftDown);
buttonsToPress.add(availableButtons[1]);
_lastStateIndex7 = 0x00; // Reset after successful press
} else {
_updateState(currentByte7, (val) => _lastStateIndex7 = val);

View File

@@ -1,18 +1,20 @@
import 'dart:io';
import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:gamepads/gamepads.dart';
import 'package:bike_control/bluetooth/devices/base_device.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/pages/device.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/widgets/ui/beta_pill.dart';
import 'package:bike_control/widgets/ui/warning.dart';
import 'package:dartx/dartx.dart';
import 'package:gamepads/gamepads.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
class GamepadDevice extends BaseDevice {
final String id;
GamepadDevice(super.name, {required this.id}) : super(availableButtons: []);
GamepadDevice(super.name, {required this.id}) : super(availableButtons: [], uniqueId: id);
List<ControllerButton> _lastButtonsClicked = [];
@@ -30,7 +32,7 @@ class GamepadDevice extends BaseDevice {
final buttonKey = event.type == KeyType.analog ? '${event.key}_$normalizedValue' : event.key;
ControllerButton button = getOrAddButton(
buttonKey,
() => ControllerButton(buttonKey),
() => ControllerButton(buttonKey, sourceDeviceId: id),
);
switch (event.type) {
@@ -68,12 +70,20 @@ class GamepadDevice extends BaseDevice {
spacing: 8,
children: [
Text(
name.screenshot,
toString().screenshot,
style: TextStyle(fontWeight: FontWeight.bold),
),
if (isBeta) BetaPill(),
],
),
if (Platform.isAndroid && !core.settings.getLocalEnabled())
Warning(
children: [
Text(
'For it to work properly, even when BikeControl is in the background, you need to enable the local connection method in the next tab.',
).small,
],
),
],
),
);

View File

@@ -0,0 +1,317 @@
import 'dart:async';
import 'package:bike_control/bluetooth/devices/base_device.dart';
import 'package:bike_control/bluetooth/devices/gyroscope/steering_estimator.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/pages/device.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/widgets/ui/beta_pill.dart';
import 'package:bike_control/widgets/ui/device_info.dart';
import 'package:bike_control/widgets/ui/small_progress_indicator.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
import 'package:sensors_plus/sensors_plus.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
/// Gyroscope and Accelerometer based steering device
/// Detects handlebar movement when the phone is mounted on the handlebar
class GyroscopeSteering extends BaseDevice {
GyroscopeSteering()
: super(
'Phone Steering',
availableButtons: GyroscopeSteeringButtons.values,
isBeta: true,
uniqueId: 'gyroscope_steering_device',
buttonPrefix: 'gyro',
);
StreamSubscription<GyroscopeEvent>? _gyroscopeSubscription;
StreamSubscription<AccelerometerEvent>? _accelerometerSubscription;
// Calibration state
final SteeringEstimator _estimator = SteeringEstimator();
bool _isCalibrated = false;
ControllerButton? _lastSteeringButton;
// Accelerometer raw data
bool _hasAccelData = false;
// Time tracking for integration
DateTime? _lastGyroUpdate;
// Last rounded angle for change detection
int? _lastRoundedAngle;
// Debounce timer for PWM-like keypress behavior
Timer? _keypressTimer;
bool _isProcessingKeypresses = false;
// Configuration (can be made customizable later)
static const double STEERING_THRESHOLD = 5.0; // degrees
static const double LEVEL_DEGREE_STEP = 10.0; // degrees per level
static const int MAX_LEVELS = 5;
static const int KEY_REPEAT_INTERVAL_MS = 40;
static const double COMPLEMENTARY_FILTER_ALPHA = 0.98; // Weight for gyroscope
static const double LOW_PASS_FILTER_ALPHA = 0.9; // Smoothing factor
@override
Future<void> connect() async {
if (isConnected) {
return;
}
try {
// Start listening to sensors
_gyroscopeSubscription = gyroscopeEventStream().listen(
_handleGyroscopeEvent,
onError: (error) {
actionStreamInternal.add(LogNotification('Gyroscope error: $error'));
},
);
_accelerometerSubscription = accelerometerEventStream().listen(
_handleAccelerometerEvent,
onError: (error) {
actionStreamInternal.add(LogNotification('Accelerometer error: $error'));
},
);
isConnected = true;
actionStreamInternal.add(LogNotification('Gyroscope Steering: Connected - Calibrating...'));
// Reset calibration/estimator
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
_lastGyroUpdate = null;
_lastRoundedAngle = null;
_lastSteeringButton = null;
} catch (e) {
actionStreamInternal.add(LogNotification('Failed to connect Gyroscope Steering: $e'));
isConnected = false;
rethrow;
}
}
void _handleGyroscopeEvent(GyroscopeEvent event) {
final now = DateTime.now();
if (!_hasAccelData) {
_lastGyroUpdate = now;
return;
}
final dt = _lastGyroUpdate != null ? (now.difference(_lastGyroUpdate!).inMicroseconds / 1000000.0) : 0.0;
_lastGyroUpdate = now;
if (dt <= 0 || dt >= 1.0) {
return;
}
// iOS drift fix:
// - integrate bias-corrected gyro z (yaw) into an estimator
// - learn bias while the device is still
final angleDeg = _estimator.updateGyro(wz: event.z, dt: dt);
if (!_isCalibrated) {
// Consider calibration complete once we have a bit of stillness and sensor data.
// This gives the bias estimator time to settle.
if (_estimator.stillTimeSec >= 0.6) {
_estimator.calibrate(seedBiasZRadPerSec: _estimator.biasZRadPerSec);
_isCalibrated = true;
actionStreamInternal.add(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Calibration complete.'),
);
}
return;
}
_processSteeringAngle(angleDeg);
}
void _handleAccelerometerEvent(AccelerometerEvent event) {
_hasAccelData = true;
_estimator.updateAccel(x: event.x, y: event.y, z: event.z);
}
void _processSteeringAngle(double steeringAngleDeg) {
final roundedAngle = steeringAngleDeg.round();
if (_lastRoundedAngle != roundedAngle) {
if (kDebugMode) {
actionStreamInternal.add(
LogNotification(
'Steering angle: $roundedAngle° (biasZ=${_estimator.biasZRadPerSec.toStringAsFixed(4)} rad/s)',
),
);
}
_lastRoundedAngle = roundedAngle;
_applyPWMSteering(roundedAngle);
}
}
/// Applies PWM-like steering behavior with repeated keypresses proportional to angle magnitude
void _applyPWMSteering(int roundedAngle) {
// Cancel any pending keypress timer
_keypressTimer?.cancel();
// Determine if we're steering
if (roundedAngle.abs() > core.settings.getPhoneSteeringThreshold()) {
// Determine direction
final button = roundedAngle < 0 ? GyroscopeSteeringButtons.rightSteer : GyroscopeSteeringButtons.leftSteer;
if (_lastSteeringButton != button) {
// New steering direction - reset any previous state
_lastSteeringButton = button;
} else {
return;
}
handleButtonsClicked([button]);
} else {
_lastSteeringButton = null;
// Center position - release any held buttons
handleButtonsClicked([]);
}
}
@override
Future<void> disconnect() async {
await _gyroscopeSubscription?.cancel();
await _accelerometerSubscription?.cancel();
_gyroscopeSubscription = null;
_accelerometerSubscription = null;
_keypressTimer?.cancel();
isConnected = false;
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
actionStreamInternal.add(LogNotification('Gyroscope Steering: Disconnected'));
}
@override
Widget showInformation(BuildContext context) {
return StatefulBuilder(
builder: (c, setState) => Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12,
children: [
Row(
spacing: 12,
children: [
Text(
toString().screenshot,
style: TextStyle(fontWeight: FontWeight.bold),
),
if (isBeta) BetaPill(),
],
),
Wrap(
spacing: 12,
runSpacing: 12,
children: [
DeviceInfo(
title: 'Calibration',
icon: BootstrapIcons.wrenchAdjustable,
value: _isCalibrated ? 'Complete' : 'In Progress',
),
DeviceInfo(
title: 'Steering Angle',
icon: RadixIcons.angle,
value: _isCalibrated ? '${_estimator.angleDeg.toStringAsFixed(2)}°' : 'Calibrating...',
),
if (kDebugMode)
DeviceInfo(
title: 'Gyro Bias',
icon: BootstrapIcons.speedometer,
value: '${_estimator.biasZRadPerSec.toStringAsFixed(4)} rad/s',
),
],
),
Row(
spacing: 8,
children: [
PrimaryButton(
size: ButtonSize.small,
leading: !_isCalibrated ? SmallProgressIndicator() : null,
onPressed: !_isCalibrated
? null
: () {
// Reset calibration
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
_lastGyroUpdate = null;
_lastRoundedAngle = null;
_lastSteeringButton = null;
actionStreamInternal.add(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Calibrating the sensors now.'),
);
setState(() {});
},
child: Text(_isCalibrated ? 'Calibrate' : 'Calibrating...'),
),
Builder(
builder: (context) {
return PrimaryButton(
size: ButtonSize.small,
trailing: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.destructive,
borderRadius: BorderRadius.circular(4),
),
child: Text('${core.settings.getPhoneSteeringThreshold().toInt()}°'),
),
onPressed: () {
final values = [for (var i = 3; i <= 12; i += 1) i];
showDropdown(
context: context,
builder: (b) => DropdownMenu(
children: values
.map(
(v) => MenuButton(
child: Text('$v°'),
onPressed: (c) {
core.settings.setPhoneSteeringThreshold(v);
setState(() {});
},
),
)
.toList(),
),
);
},
child: Text('Trigger Threshold:'),
);
},
),
],
),
if (!_isCalibrated)
Text(
'Calibrating the sensors now. Attach your phone/tablet on your handlebar and keep it still for a second.',
).xSmall,
],
),
);
}
}
class GyroscopeSteeringButtons {
static final ControllerButton leftSteer = ControllerButton(
'gyroLeftSteer',
action: InGameAction.steerLeft,
);
static final ControllerButton rightSteer = ControllerButton(
'gyroRightSteer',
action: InGameAction.steerRight,
);
static List<ControllerButton> get values => [
leftSteer,
rightSteer,
];
}

View File

@@ -0,0 +1,200 @@
import 'dart:math';
/// Pure-Dart steering estimator for phone-on-handlebar steering.
///
/// Design goals:
/// - Avoid long-term drift on platforms like iOS by continuously estimating
/// and subtracting gyro bias.
/// - Keep it testable (no Flutter/sensors dependencies).
///
/// NOTE: This is not a full AHRS. It uses bias-corrected integration and
/// a "stillness" detector to learn gyro bias and optionally auto-recenter.
class SteeringEstimator {
SteeringEstimator({
this.biasLearningRate = 0.02,
this.gyroStillThresholdRadPerSec = 0.03,
this.accelStillThresholdMS2 = 0.6,
this.minStillTimeForBiasSec = 0.35,
this.biasLearningDeadbandDeg = 3.0,
this.minStillTimeForRecenterSec = double.infinity,
this.recenterHalfLifeSec = 0.7,
this.recenterDeadbandDeg = 2.0,
this.maxAngleAbsDeg = 60,
this.lowPassAlpha = 0.9,
// Responsiveness / smoothing tuning.
// When steering changes quickly we reduce smoothing, but keep more
// smoothing when stable to avoid jitter.
this.lowPassAlphaStable = 0.9,
this.lowPassAlphaMoving = 0.55,
this.motionAngleRateDegPerSecForMinAlpha = 90.0,
// Cap dt to avoid "freezing" the estimator on occasional long frames.
this.maxDtSec = 0.05,
});
// Tunables
final double biasLearningRate;
final double gyroStillThresholdRadPerSec;
final double accelStillThresholdMS2;
final double minStillTimeForBiasSec;
final double biasLearningDeadbandDeg;
final double minStillTimeForRecenterSec;
final double recenterHalfLifeSec;
final double recenterDeadbandDeg;
final double maxAngleAbsDeg;
/// Backwards-compatible, kept as-is.
///
/// If you set `lowPassAlpha = 0.0`, filtering is disabled.
final double lowPassAlpha;
/// Smoothing used when the angle is stable.
///
/// Default mirrors the original behavior (`0.9`).
final double lowPassAlphaStable;
/// Smoothing used when the angle is changing quickly.
///
/// Lower alpha => faster response.
final double lowPassAlphaMoving;
/// Angle rate (deg/s) at which we reach `lowPassAlphaMoving`.
final double motionAngleRateDegPerSecForMinAlpha;
/// Maximum timestep used for integration/bias learning.
final double maxDtSec;
// State
double _accelX = 0, _accelY = 0, _accelZ = 0;
bool _hasAccel = false;
double _biasZ = 0.0; // rad/s
double _yawDeg = 0.0;
double _filteredYawDeg = 0.0;
double _stillTimeSec = 0.0;
/// Resets the estimator state.
void reset() {
_biasZ = 0.0;
_yawDeg = 0.0;
_filteredYawDeg = 0.0;
_stillTimeSec = 0.0;
_hasAccel = false;
_accelX = _accelY = _accelZ = 0;
}
/// One-time calibration: assume device is held still and centered.
///
/// This resets yaw and also seeds the bias to the current z gyro rate.
void calibrate({double? seedBiasZRadPerSec}) {
_yawDeg = 0.0;
_filteredYawDeg = 0.0;
_stillTimeSec = 0.0;
if (seedBiasZRadPerSec != null) {
_biasZ = seedBiasZRadPerSec;
}
}
void updateAccel({required double x, required double y, required double z}) {
_accelX = x;
_accelY = y;
_accelZ = z;
_hasAccel = true;
}
/// Update with gyro z-rate (rad/s) and dt (seconds).
///
/// Returns the current filtered steering angle in degrees.
double updateGyro({required double wz, required double dt}) {
if (dt <= 0) {
return angleDeg;
}
// If dt spikes (app paused/jank), cap it instead of bailing out.
// This keeps the estimator responsive and avoids "stuck" output.
final usedDt = dt > maxDtSec ? maxDtSec : dt;
final still = _isStill(wz);
if (still) {
_stillTimeSec += usedDt;
// Learn gyro bias only when we're still AND near our calibrated center.
// Otherwise, if the user holds a steady steering angle, wz≈0 and we'd
// incorrectly move bias towards 0 and cause the angle to be wrong when
// they return to center.
final nearCenter = _yawDeg.abs() <= biasLearningDeadbandDeg;
if (nearCenter && _stillTimeSec >= minStillTimeForBiasSec) {
// Exponential moving average towards the observed rate.
_biasZ = (1.0 - biasLearningRate) * _biasZ + biasLearningRate * wz;
}
// IMPORTANT: only auto-recenter when we're already close to center.
// Users may hold a constant steering angle for several seconds.
final canRecenter = _stillTimeSec >= minStillTimeForRecenterSec && _yawDeg.abs() <= recenterDeadbandDeg;
if (canRecenter) {
_applyRecenter(usedDt);
}
} else {
_stillTimeSec = 0.0;
}
final correctedWz = wz - _biasZ;
_yawDeg += correctedWz * usedDt * (180.0 / pi);
// Clamp to avoid runaway if something goes wrong.
_yawDeg = _yawDeg.clamp(-maxAngleAbsDeg, maxAngleAbsDeg).toDouble();
// Low-pass filter for noise smoothing.
//
// Make it adaptive: when the angle is changing fast, we reduce smoothing
// (more responsive). When stable, we keep stronger smoothing.
//
// If user forces lowPassAlpha=0.0 (existing tests do), we keep behavior
// equivalent (no filtering).
if (lowPassAlpha <= 0.0) {
_filteredYawDeg = _yawDeg;
} else {
final stableAlpha = ((lowPassAlphaStable.isFinite ? lowPassAlphaStable : lowPassAlpha)).clamp(0.0, 0.999);
final movingAlpha = lowPassAlphaMoving.clamp(0.0, stableAlpha);
// Use a rate estimate derived from the filtered-vs-raw divergence.
final rateDegPerSec = ((_yawDeg - _filteredYawDeg).abs()) / usedDt;
final t = (rateDegPerSec / motionAngleRateDegPerSecForMinAlpha).clamp(0.0, 1.0);
final alpha = stableAlpha + (movingAlpha - stableAlpha) * t;
_filteredYawDeg = alpha * _filteredYawDeg + (1 - alpha) * _yawDeg;
}
return angleDeg;
}
double get angleDeg => _filteredYawDeg;
double get biasZRadPerSec => _biasZ;
double get stillTimeSec => _stillTimeSec;
bool _isStill(double wz) {
// If we don't have accel yet, be conservative: don't learn bias.
if (!_hasAccel) return false;
final gyroOk = wz.abs() < gyroStillThresholdRadPerSec;
// Check accel magnitude close to gravity (device not being bumped).
final aMag = sqrt(_accelX * _accelX + _accelY * _accelY + _accelZ * _accelZ);
const g = 9.80665;
final accelOk = (aMag - g).abs() < accelStillThresholdMS2;
return gyroOk && accelOk;
}
void _applyRecenter(double dt) {
// Exponential decay towards 0 with given half-life.
// decay = 0.5^(dt/halfLife)
if (recenterHalfLifeSec <= 0) return;
final decay = pow(0.5, dt / recenterHalfLifeSec).toDouble();
_yawDeg *= decay;
}
}

View File

@@ -1,10 +1,14 @@
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:bike_control/bluetooth/devices/base_device.dart';
import 'package:bike_control/utils/actions/android.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/widgets/ui/warning.dart';
import 'package:flutter/material.dart' show PopupMenuButton, PopupMenuItem;
import 'package:shadcn_flutter/shadcn_flutter.dart';
class HidDevice extends BaseDevice {
HidDevice(super.name) : super(availableButtons: []);
HidDevice(super.name) : super(availableButtons: [], uniqueId: name!);
@override
Future<void> connect() {
@@ -13,24 +17,36 @@ class HidDevice extends BaseDevice {
@override
Widget showInformation(BuildContext context) {
return Row(
return Column(
children: [
Expanded(child: Text(name)),
PopupMenuButton(
itemBuilder: (c) => [
PopupMenuItem(
child: Text('Ignore'),
onTap: () {
core.connection.disconnect(this, forget: true, persistForget: true);
if (core.actionHandler is AndroidActions) {
(core.actionHandler as AndroidActions).ignoreHidDevices();
} else if (core.mediaKeyHandler.isMediaKeyDetectionEnabled.value) {
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value = false;
}
},
Row(
children: [
Expanded(child: Text(toString()).bold),
PopupMenuButton(
itemBuilder: (c) => [
PopupMenuItem(
child: Text('Ignore'),
onTap: () {
core.connection.disconnect(this, forget: true, persistForget: true);
if (core.actionHandler is AndroidActions) {
(core.actionHandler as AndroidActions).ignoreHidDevices();
} else if (core.mediaKeyHandler.isMediaKeyDetectionEnabled.value) {
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value = false;
}
},
),
],
),
],
),
if (Platform.isAndroid && !core.settings.getLocalEnabled())
Warning(
children: [
Text(
'For it to work properly, even when BikeControl is in the background, you need to enable the local connection method in the next tab.',
).small,
],
),
],
);
}

View File

@@ -1,9 +1,8 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:prop/prop.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
@@ -11,14 +10,17 @@ import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:bike_control/utils/requirements/multi.dart';
import 'package:flutter/foundation.dart';
class WhooshLink extends TrainerConnection {
Socket? _socket;
ServerSocket? _server;
static const String connectionTitle = 'MyWhoosh Link';
WhooshLink()
: super(
title: 'MyWhoosh Link',
title: connectionTitle,
supportedActions: [
InGameAction.shiftUp,
InGameAction.shiftDown,
@@ -155,7 +157,7 @@ class WhooshLink extends TrainerConnection {
InGameAction.steerRight,
];
if (jsonObject != null && !isKeyDown && !supportsIsKeyUpActions.contains(keyPair.inGameAction)) {
return Success('No Action sent on key down for action: ${keyPair.inGameAction}');
return Ignored('No Action sent on key down for action: ${keyPair.inGameAction}');
} else if (jsonObject != null) {
final jsonString = jsonEncode(jsonObject);
_socket?.writeln(jsonString);

View File

@@ -1,9 +1,10 @@
import 'dart:io';
import 'package:bike_control/bluetooth/ble.dart';
import 'package:bike_control/bluetooth/devices/openbikecontrol/openbikecontrol_device.dart';
import 'package:bike_control/bluetooth/devices/openbikecontrol/protocol_parser.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pbenum.dart';
import 'package:bike_control/bluetooth/messages/notification.dart' show AlertNotification, LogNotification;
import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
@@ -12,8 +13,7 @@ import 'package:bike_control/widgets/title.dart';
import 'package:bluetooth_low_energy/bluetooth_low_energy.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import '../../messages/notification.dart' show AlertNotification;
import 'package:prop/prop.dart';
class OpenBikeControlBluetoothEmulator extends TrainerConnection {
late final _peripheralManager = PeripheralManager();
@@ -24,9 +24,11 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
late GATTCharacteristic _buttonCharacteristic;
static const String connectionTitle = 'OpenBikeControl BLE Emulator';
OpenBikeControlBluetoothEmulator()
: super(
title: 'OpenBikeControl BLE Emulator',
title: connectionTitle,
supportedActions: InGameAction.values,
);
@@ -77,6 +79,12 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
print('Read request for characteristic: ${eventArgs.characteristic.uuid}');
switch (eventArgs.characteristic.uuid.toString().toUpperCase()) {
case BleUuid.DEVICE_INFORMATION_CHARACTERISTIC_BATTERY_LEVEL:
await _peripheralManager.respondReadRequestWithValue(
eventArgs.request,
value: Uint8List.fromList([100]),
);
return;
default:
print('Unhandled read request for characteristic: ${eventArgs.characteristic.uuid}');
}
@@ -114,9 +122,9 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connected to app: ${appInfo.appId}'),
);
print('Parsed App Info: $appInfo');
core.connection.signalNotification(LogNotification('Parsed App Info: $appInfo'));
} catch (e) {
print('Error parsing App Info: $e');
core.connection.signalNotification(LogNotification('Error parsing App Info ${bytesToHex(value)}: $e'));
}
break;
default:

View File

@@ -3,8 +3,6 @@ import 'dart:io';
import 'package:bike_control/bluetooth/devices/openbikecontrol/openbikecontrol_device.dart';
import 'package:bike_control/bluetooth/devices/openbikecontrol/protocol_parser.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/ftms_mdns_emulator.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/core.dart';
@@ -13,18 +11,21 @@ import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:nsd/nsd.dart';
import 'package:prop/prop.dart';
class OpenBikeControlMdnsEmulator extends TrainerConnection {
ServerSocket? _server;
Registration? _mdnsRegistration;
static const String connectionTitle = 'OpenBikeControl mDNS Emulator';
final ValueNotifier<AppInfo?> connectedApp = ValueNotifier(null);
Socket? _socket;
OpenBikeControlMdnsEmulator()
: super(
title: 'OpenBikeControl mDNS Emulator',
title: connectionTitle,
supportedActions: InGameAction.values,
);
@@ -50,7 +51,7 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
throw 'Could not find network interface';
}
_createTcpServer();
await _createTcpServer();
if (kDebugMode) {
enableLogging(LogTopic.calls);
@@ -134,14 +135,18 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
final messageType = data[0];
switch (messageType) {
case OpenBikeProtocolParser.MSG_TYPE_APP_INFO:
final appInfo = OpenBikeProtocolParser.parseAppInfo(Uint8List.fromList(data));
isConnected.value = true;
connectedApp.value = appInfo;
try {
final appInfo = OpenBikeProtocolParser.parseAppInfo(Uint8List.fromList(data));
isConnected.value = true;
connectedApp.value = appInfo;
supportedActions = appInfo.supportedButtons.mapNotNull((b) => b.action).toList();
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connected to app: ${appInfo.appId}'),
);
supportedActions = appInfo.supportedButtons.mapNotNull((b) => b.action).toList();
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Connected to app: ${appInfo.appId}'),
);
} catch (e) {
core.connection.signalNotification(LogNotification('Failed to parse app info: $e'));
}
break;
default:
print('Unknown message type: $messageType');

View File

@@ -1,6 +1,6 @@
import 'dart:typed_data';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:prop/prop.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/widgets/title.dart';
import 'package:universal_ble/universal_ble.dart';

View File

@@ -10,6 +10,7 @@ import 'dart:typed_data';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:dartx/dartx.dart';
import 'package:prop/prop.dart';
class ProtocolParseException implements Exception {
final String message;
@@ -17,7 +18,7 @@ class ProtocolParseException implements Exception {
ProtocolParseException(this.message, [this.raw]);
@override
String toString() => 'ProtocolParseException: $message${raw != null ? ' raw=${raw!.length}' : ''}';
String toString() => 'ProtocolParseException: $message${raw != null ? ' raw=${bytesToReadableHex(raw!)}' : ''}';
}
class OpenBikeProtocolParser {
@@ -28,20 +29,19 @@ class OpenBikeProtocolParser {
0x02: ControllerButton('Shift Down', identifier: 0x02, action: InGameAction.shiftDown),
0x03: ControllerButton('Gear Set', identifier: 0x03),
// Navigation (0x10-0x1F)
0x10: ControllerButton('Up/Steer Left', identifier: 0x10, action: InGameAction.steerLeft),
0x11: ControllerButton('Down/Steer Right', identifier: 0x11, action: InGameAction.steerRight),
0x10: ControllerButton('Up', identifier: 0x10, action: InGameAction.up),
0x11: ControllerButton('Down', identifier: 0x11, action: InGameAction.down),
0x12: ControllerButton('Left/Look Left', identifier: 0x12, action: InGameAction.navigateLeft),
0x13: ControllerButton('Right/Look Right', identifier: 0x13, action: InGameAction.navigateRight),
0x14: ControllerButton('Select/Confirm', identifier: 0x14, action: InGameAction.select),
0x15: ControllerButton('Back/Cancel', identifier: 0x15, action: InGameAction.back),
0x16: ControllerButton('Menu', identifier: 0x16),
0x17: ControllerButton('Home', identifier: 0x17),
0x16: ControllerButton('Menu', identifier: 0x16, action: InGameAction.menu),
0x17: ControllerButton('Home', identifier: 0x17, action: InGameAction.home),
0x18: ControllerButton('Steer Left', identifier: 0x18, action: InGameAction.steerLeft),
0x19: ControllerButton('Steer Right', identifier: 0x19, action: InGameAction.steerRight),
// Social/Emotes (0x20-0x2F)
0x20: ControllerButton('Wave', identifier: 0x20, action: InGameAction.emote),
0x21: ControllerButton('Thumbs Up', identifier: 0x21, action: InGameAction.emote),
0x22: ControllerButton('Hammer Time', identifier: 0x22, action: InGameAction.emote),
0x23: ControllerButton('Bell', identifier: 0x23),
0x24: ControllerButton('Screenshot', identifier: 0x24),
0x20: ControllerButton('Emote', identifier: 0x20, action: InGameAction.emote),
0x21: ControllerButton('Push to Talk', identifier: 0x21),
// Training Controls (0x30-0x3F)
0x30: ControllerButton('ERG Up', identifier: 0x30, action: InGameAction.increaseResistance),
0x31: ControllerButton('ERG Down', identifier: 0x31, action: InGameAction.decreaseResistance),

View File

@@ -10,7 +10,7 @@ import 'package:universal_ble/universal_ble.dart';
import '../bluetooth_device.dart';
class ShimanoDi2 extends BluetoothDevice {
ShimanoDi2(super.scanResult) : super(availableButtons: []);
ShimanoDi2(super.scanResult) : super(availableButtons: [], buttonPrefix: 'D-Fly Channel ');
@override
Future<void> handleServices(List<BleService> services) async {
@@ -30,7 +30,7 @@ class ShimanoDi2 extends BluetoothDevice {
bool _isInitialized = false;
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) {
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (characteristic.toLowerCase() == ShimanoDi2Constants.D_FLY_CHANNEL_UUID) {
final channels = bytes.sublist(1);
@@ -42,7 +42,7 @@ class ShimanoDi2 extends BluetoothDevice {
getOrAddButton(
'D-Fly Channel $readableIndex',
() => ControllerButton('D-Fly Channel $readableIndex'),
() => ControllerButton('D-Fly Channel $readableIndex', sourceDeviceId: device.deviceId),
);
});
_isInitialized = true;
@@ -59,7 +59,7 @@ class ShimanoDi2 extends BluetoothDevice {
final button = getOrAddButton(
'D-Fly Channel $readableIndex',
() => ControllerButton('D-Fly Channel $readableIndex'),
() => ControllerButton('D-Fly Channel $readableIndex', sourceDeviceId: device.deviceId),
);
if (didChange) {
clickedButtons.add(button);
@@ -67,8 +67,7 @@ class ShimanoDi2 extends BluetoothDevice {
});
if (clickedButtons.isNotEmpty) {
handleButtonsClicked(clickedButtons);
handleButtonsClicked([]);
await handleButtonsClickedWithoutLongPressSupport(clickedButtons);
}
}
return Future.value();

View File

@@ -0,0 +1,172 @@
import 'dart:async';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:universal_ble/universal_ble.dart';
import '../bluetooth_device.dart';
class SramAxs extends BluetoothDevice {
SramAxs(super.scanResult) : super(availableButtons: [], isBeta: true);
Timer? _singleClickTimer;
int _tapCount = 0;
@override
Future<void> disconnect() async {
_singleClickTimer?.cancel();
_singleClickTimer = null;
_tapCount = 0;
await super.disconnect();
}
@override
Future<void> handleServices(List<BleService> services) async {
final service = services.firstWhere(
(e) => e.uuid.toLowerCase() == SramAxsConstants.SERVICE_UUID_RELEVANT.toLowerCase(),
orElse: () => throw Exception('Service not found: ${SramAxsConstants.SERVICE_UUID_RELEVANT}'),
);
final characteristic = service.characteristics.firstWhere(
(e) => e.uuid.toLowerCase() == SramAxsConstants.TRIGGER_UUID.toLowerCase(),
orElse: () => throw Exception('Characteristic not found: ${SramAxsConstants.TRIGGER_UUID}'),
);
await UniversalBle.subscribeNotifications(device.deviceId, service.uuid, characteristic.uuid);
// add both buttons
_singleClickButton();
_doubleClickButton();
}
ControllerButton _singleClickButton() => getOrAddButton(
'SRAM Tap',
() => ControllerButton('SRAM Tap', action: InGameAction.shiftUp, sourceDeviceId: device.deviceId),
);
ControllerButton _doubleClickButton() => getOrAddButton(
'SRAM Double Tap',
() => ControllerButton('SRAM Double Tap', action: InGameAction.shiftDown, sourceDeviceId: device.deviceId),
);
void _emitClick(ControllerButton button) {
// Use the common pipeline so long-press handling and app action execution stays consistent.
handleButtonsClickedWithoutLongPressSupport([button]);
}
void _registerTap() {
final windowMs = core.settings.getSramAxsDoubleClickWindowMs();
_tapCount++;
// First tap: start a timer. If no second tap arrives in time => single click.
if (_tapCount == 1) {
_singleClickTimer?.cancel();
_singleClickTimer = Timer(Duration(milliseconds: windowMs), () {
if (_tapCount == 1) {
_emitClick(_singleClickButton());
}
_tapCount = 0;
});
return;
}
// Second tap within window: double click.
if (_tapCount == 2) {
_singleClickTimer?.cancel();
_singleClickTimer = null;
_emitClick(_doubleClickButton());
_tapCount = 0;
return;
}
// If we get more than two taps fast, treat as a double click and restart counting.
_singleClickTimer?.cancel();
_singleClickTimer = null;
_emitClick(_doubleClickButton());
_tapCount = 0;
}
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (kDebugMode) {
debugPrint('SramAxs: Received data on characteristic $characteristic: ${bytesToHex(bytes)}');
}
if (characteristic.toLowerCase() == SramAxsConstants.TRIGGER_UUID.toLowerCase()) {
// At the moment we can only detect "some button pressed". We therefore interpret each
// notification as a tap and provide two logical buttons (single & double click).
_registerTap();
}
return Future.value();
}
@override
Widget showInformation(BuildContext context) {
final windowMs = core.settings.getSramAxsDoubleClickWindowMs();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12,
children: [
super.showInformation(context),
Text(
"Don't forget to turn off the function of the button you want to use in the SRAM AXS app!\n"
"Unfortunately, at the moment it's not possible to determine which physical button was pressed on your SRAM AXS device. Let us know if you have a contact at SRAM who can help :)\n\n"
'So the app exposes two logical buttons:\n'
'• SRAM Tap, assigned to Shift Up\n'
'• SRAM Double Tap, assigned to Shift Down\n\n'
'You can assign an action to each in the app settings.',
).xSmall,
Builder(
builder: (context) {
return PrimaryButton(
size: ButtonSize.small,
trailing: Container(
padding: const EdgeInsets.symmetric(horizontal: 4),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(4),
),
child: Text('${windowMs}ms'),
),
onPressed: () {
final values = [
for (var v = 150; v <= 600; v += 50) v,
];
showDropdown(
context: context,
builder: (b) => DropdownMenu(
children: values
.map(
(v) => MenuButton(
child: Text('${v}ms'),
onPressed: (c) async {
await core.settings.setSramAxsDoubleClickWindowMs(v);
// Force rebuild to show new value.
(context as Element).markNeedsBuild();
},
),
)
.toList(),
),
);
},
child: const Text('Double-click window:'),
);
},
),
],
);
}
}
class SramAxsConstants {
static const String SERVICE_UUID = "0000fe51-0000-1000-8000-00805f9b34fb";
static const String SERVICE_UUID_RELEVANT = "d9050053-90aa-4c7c-b036-1e01fb8eb7ee";
static const String TRIGGER_UUID = "d9050054-90aa-4c7c-b036-1e01fb8eb7ee";
}

View File

@@ -0,0 +1,90 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:universal_ble/universal_ble.dart';
import '../bluetooth_device.dart';
class ThinkRiderVs200 extends BluetoothDevice {
ThinkRiderVs200(super.scanResult)
: super(
availableButtons: ThinkRiderVs200Buttons.values,
isBeta: true,
allowMultiple: true,
);
@override
Future<void> handleServices(List<BleService> services) async {
// Only subscribe to service 0xFEA0
final service = services.firstWhere(
(e) => e.uuid.toLowerCase() == ThinkRiderVs200Constants.SERVICE_UUID.toLowerCase(),
orElse: () => throw Exception('Service not found: ${ThinkRiderVs200Constants.SERVICE_UUID}'),
);
final characteristic = service.characteristics.firstWhere(
(e) => e.uuid.toLowerCase() == ThinkRiderVs200Constants.CHARACTERISTIC_UUID.toLowerCase(),
orElse: () => throw Exception('Characteristic not found: ${ThinkRiderVs200Constants.CHARACTERISTIC_UUID}'),
);
await UniversalBle.subscribeNotifications(device.deviceId, service.uuid, characteristic.uuid);
}
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) {
if (characteristic.toLowerCase() == ThinkRiderVs200Constants.CHARACTERISTIC_UUID.toLowerCase()) {
final hexValue = _bytesToHex(bytes).toLowerCase();
// Log all received values while in beta
if (isBeta) {
actionStreamInternal.add(LogNotification('VS200 received: $hexValue'));
}
// Check for specific byte patterns
if (hexValue == ThinkRiderVs200Constants.SHIFT_UP_PATTERN) {
// Plus button pressed
actionStreamInternal.add(LogNotification('Shift Up detected: $hexValue'));
handleButtonsClickedWithoutLongPressSupport([availableButtons[0]]);
} else if (hexValue == ThinkRiderVs200Constants.SHIFT_DOWN_PATTERN) {
// Minus button pressed
actionStreamInternal.add(LogNotification('Shift Down detected: $hexValue'));
handleButtonsClickedWithoutLongPressSupport([availableButtons[1]]);
}
}
return Future.value();
}
String _bytesToHex(List<int> bytes) {
return bytes.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join();
}
}
class ThinkRiderVs200Constants {
// Service and characteristic UUIDs based on the nRF Connect screenshot
static const String SERVICE_UUID = "0000fea0-0000-1000-8000-00805f9b34fb";
static const String CHARACTERISTIC_UUID = "0000fea1-0000-1000-8000-00805f9b34fb";
// Byte patterns for button detection
static const String SHIFT_UP_PATTERN = "f3050301fc";
static const String SHIFT_DOWN_PATTERN = "f3050300fb";
}
class ThinkRiderVs200Buttons {
static const ControllerButton shiftUp = ControllerButton(
'shiftUp',
action: InGameAction.shiftUp,
icon: Icons.add,
);
static const ControllerButton shiftDown = ControllerButton(
'shiftDown',
action: InGameAction.shiftDown,
icon: Icons.remove,
);
static const List<ControllerButton> values = [
shiftUp,
shiftDown,
];
}

View File

@@ -1,10 +1,10 @@
import 'dart:typed_data';
import 'package:bike_control/bluetooth/devices/zwift/ftms_mdns_emulator.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:prop/prop.dart';
import 'package:universal_ble/universal_ble.dart';
import '../bluetooth_device.dart';
@@ -80,6 +80,7 @@ class WahooKickrHeadwind extends BluetoothDevice {
service,
characteristic,
manualModeData,
withoutResponse: true,
);
_currentMode = HeadwindMode.manual;
}
@@ -93,6 +94,7 @@ class WahooKickrHeadwind extends BluetoothDevice {
service,
characteristic,
data,
withoutResponse: true,
);
_currentSpeed = speedPercent;
}
@@ -109,6 +111,7 @@ class WahooKickrHeadwind extends BluetoothDevice {
service,
characteristic,
data,
withoutResponse: true,
);
_currentMode = HeadwindMode.heartRate;
}

View File

@@ -1,7 +1,7 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:flutter/material.dart';
class ZwiftConstants {
static const ZWIFT_CUSTOM_SERVICE_UUID = "00000001-19CA-4651-86E5-FA29DCDD09D1";
@@ -59,13 +59,13 @@ class ZwiftButtons {
// left controller
static const ControllerButton navigationUp = ControllerButton(
'navigationUp',
action: InGameAction.toggleUi,
action: InGameAction.up,
icon: Icons.keyboard_arrow_up,
color: Colors.black,
);
static const ControllerButton navigationDown = ControllerButton(
'navigationDown',
action: InGameAction.uturn,
action: InGameAction.down,
icon: Icons.keyboard_arrow_down,
color: Colors.black,
);
@@ -101,8 +101,12 @@ class ZwiftButtons {
// right controller
static const ControllerButton a = ControllerButton('a', action: InGameAction.select, color: Colors.lightGreen);
static const ControllerButton b = ControllerButton('b', action: InGameAction.back, color: Colors.pinkAccent);
static const ControllerButton z = ControllerButton('z', action: null, color: Colors.deepOrangeAccent);
static const ControllerButton y = ControllerButton('y', action: null, color: Colors.lightBlue);
static const ControllerButton z = ControllerButton(
'z',
action: InGameAction.rideOnBomb,
color: Colors.deepOrangeAccent,
);
static const ControllerButton y = ControllerButton('y', action: InGameAction.menu, color: Colors.lightBlue);
static const ControllerButton onOffRight = ControllerButton('onOffRight', action: InGameAction.toggleUi);
static const ControllerButton sideButtonRight = ControllerButton('sideButtonRight', action: InGameAction.shiftUp);
static const ControllerButton paddleRight = ControllerButton('paddleRight', action: InGameAction.shiftUp);

View File

@@ -1,12 +1,4 @@
import 'dart:io';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:nsd/nsd.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pbenum.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zwift.pb.dart' show RideKeyPadStatus;
import 'package:bike_control/bluetooth/devices/zwift/zwift_ride.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
@@ -14,17 +6,18 @@ import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart' hide RideButtonMask;
class FtmsMdnsEmulator extends TrainerConnection {
ServerSocket? _tcpServer;
Registration? _mdnsRegistration;
static const String connectionTitle = 'Zwift Network Emulator';
Socket? _socket;
late final ClickEmulator clickEmulator = ClickEmulator();
var lastMessageId = 0;
FtmsMdnsEmulator()
: super(
title: 'Zwift Network Emulator',
title: connectionTitle,
supportedActions: [
InGameAction.shiftUp,
InGameAction.shiftDown,
@@ -37,298 +30,30 @@ class FtmsMdnsEmulator extends TrainerConnection {
InGameAction.back,
InGameAction.rideOnBomb,
],
);
Future<void> startServer() async {
isStarted.value = true;
print('Starting mDNS server...');
// Get local IP
final interfaces = await NetworkInterface.list();
InternetAddress? localIP;
for (final interface in interfaces) {
for (final addr in interface.addresses) {
if (addr.type == InternetAddressType.IPv4 && !addr.isLoopback) {
localIP = addr;
break;
}
}
if (localIP != null) break;
}
if (localIP == null) {
throw 'Could not find network interface';
}
_createTcpServer();
if (kDebugMode) {
enableLogging(LogTopic.calls);
enableLogging(LogTopic.errors);
}
disableServiceTypeValidation(true);
_mdnsRegistration = await register(
Service(
name: 'KICKR BIKE PRO 1337',
addresses: [localIP],
port: 36867,
type: '_wahoo-fitness-tnp._tcp',
txt: {
'ble-service-uuids': Uint8List.fromList('FC82'.codeUnits),
'mac-address': Uint8List.fromList('50-50-25-6C-66-9C'.codeUnits),
'serial-number': Uint8List.fromList('244700181'.codeUnits),
},
),
);
print('Server started - advertising service!');
}
void stop() {
isStarted.value = false;
isConnected.value = false;
_tcpServer?.close();
if (_mdnsRegistration != null) {
unregister(_mdnsRegistration!);
}
_tcpServer = null;
_mdnsRegistration = null;
_socket = null;
print('Stopped FtmsMdnsEmulator');
}
Future<void> _createTcpServer() async {
try {
_tcpServer = await ServerSocket.bind(
InternetAddress.anyIPv6,
36867,
shared: true,
v6Only: false,
);
} catch (e) {
if (kDebugMode) {
print('Failed to start server: $e');
}
rethrow;
}
if (kDebugMode) {
print('Server started on port ${_tcpServer!.port}');
}
// Accept connection
_tcpServer!.listen(
(Socket socket) {
_socket = socket;
isConnected.value = true;
if (kDebugMode) {
print('Client connected: ${socket.remoteAddress.address}:${socket.remotePort}');
}
) {
clickEmulator.isStarted.addListener(() {
isStarted.value = clickEmulator.isStarted.value;
});
clickEmulator.isConnected.addListener(() {
isConnected.value = clickEmulator.isConnected.value;
if (isConnected.value) {
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, AppLocalizations.current.connected),
);
// Listen for data from the client
socket.listen(
(List<int> data) {
if (kDebugMode) {
print('Received message: ${bytesToHex(data)}');
}
final mutable = data.toList();
while (mutable.isNotEmpty) {
final msgVersion = mutable.takeUInt8();
final msgId = mutable.takeUInt8();
lastMessageId = msgId;
final seqNum = mutable.takeUInt8();
final respCode = mutable.takeUInt8(); // Response Code
final length = mutable.takeUInt16BE(); // Length of the message body
final body = mutable.takeBytes(length);
if (kDebugMode) {
print('Parsed message: ID: $msgId, Body: ${bytesToHex(body)}');
}
Uint8List buildHeader(int responseCode, int bodyLength) {
return Uint8List.fromList([
msgVersion,
msgId,
seqNum,
responseCode,
(bodyLength >> 8) & 0xFF,
bodyLength & 0xFF,
]);
}
switch (msgId) {
case FtmsMdnsConstants.DC_MESSAGE_DISCOVER_SERVICES:
final body = hexToBytes(ZwiftConstants.ZWIFT_RIDE_CUSTOM_SERVICE_UUID.toNonDash());
final header = buildHeader(FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY, body.length);
final bytes = [...header, ...body];
// Expected 0101000000100000fc8200001000800000805f9b34fb
// Got 0101000000100000fc8200001000800000805f9b34fb
_write(socket, bytes);
case FtmsMdnsConstants.DC_MESSAGE_DISCOVER_CHARACTERISTICS:
final rawUUID = body.takeBytes(16);
final serviceUUID = bytesToHex(rawUUID).toUUID();
if (serviceUUID == ZwiftConstants.ZWIFT_RIDE_CUSTOM_SERVICE_UUID) {
final responseBody = [
...rawUUID,
...hexToBytes(ZwiftConstants.ZWIFT_SYNC_RX_CHARACTERISTIC_UUID.toNonDash()),
...[
_propertyVal(['write']),
],
...hexToBytes(ZwiftConstants.ZWIFT_ASYNC_CHARACTERISTIC_UUID.toNonDash()),
...[
_propertyVal(['notify']),
],
...hexToBytes(ZwiftConstants.ZWIFT_SYNC_TX_CHARACTERISTIC_UUID.toNonDash()),
...[
_propertyVal(['notify']),
],
];
final responseData = [
...buildHeader(
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
responseBody.length,
),
...responseBody,
];
// OK: 0102010000430000fc8200001000800000805f9b34fb0000000319ca465186e5fa29dcdd09d1020000000219ca465186e5fa29dcdd09d1040000000419ca465186e5fa29dcdd09d104
_write(socket, responseData);
}
case FtmsMdnsConstants.DC_MESSAGE_READ_CHARACTERISTIC:
final rawUUID = body.takeBytes(16);
final characteristicUUID = bytesToHex(rawUUID).toUUID();
print(
'Got Read Characteristic UUID: $characteristicUUID',
);
final responseBody = rawUUID;
final responseData = [
...buildHeader(
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
responseBody.length,
),
...responseBody,
];
_write(socket, responseData);
case FtmsMdnsConstants.DC_MESSAGE_WRITE_CHARACTERISTIC:
final rawUUID = body.takeBytes(16);
final characteristicUUID = bytesToHex(rawUUID).toUUID();
final characteristicData = body.takeBytes(body.length);
print(
'Got Write Characteristic UUID: $characteristicUUID, Data: ${bytesToHex(characteristicData)}',
);
final responseBody = rawUUID;
final responseData = [
...buildHeader(
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
responseBody.length,
),
...responseBody,
];
_write(socket, responseData);
final response = core.zwiftEmulator.handleWriteRequest(
characteristicUUID,
Uint8List.fromList(characteristicData),
);
if (response != null) {
final seqNum = (lastMessageId + 1) % 256;
lastMessageId = seqNum;
final responseBody = [
...hexToBytes(ZwiftConstants.ZWIFT_SYNC_TX_CHARACTERISTIC_UUID.toLowerCase().toNonDash()),
...response,
];
final responseData = [
// header
...Uint8List.fromList([
msgVersion,
FtmsMdnsConstants.DC_MESSAGE_CHARACTERISTIC_NOTIFICATION,
seqNum,
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
(responseBody.length >> 8) & 0xFF,
responseBody.length & 0xFF,
]),
// body
...responseBody,
];
// 0106050000180000000419ca465186e5fa29dcdd09d1526964654f6e0203
_write(socket, responseData);
if (response.contentEquals(ZwiftConstants.RIDE_ON)) {
_sendKeepAlive();
}
}
return;
case FtmsMdnsConstants.DC_MESSAGE_ENABLE_CHARACTERISTIC_NOTIFICATIONS:
final rawUUID = body.takeBytes(16);
final characteristicUUID = bytesToHex(rawUUID).toUUID();
final enabled = body.takeUInt8();
print(
'Got Enable Notifications for Characteristic UUID: $characteristicUUID, Enabled: $enabled',
);
final responseBody = rawUUID;
final responseData = [
...buildHeader(
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
responseBody.length,
),
...responseBody,
];
_write(socket, responseData);
case FtmsMdnsConstants.DC_MESSAGE_CHARACTERISTIC_NOTIFICATION:
print('Hamlo');
default:
throw 'DC_ERROR_UNKNOWN_MESSAGE_TYPE';
}
}
},
onDone: () {
print('Client disconnected: $socket');
isConnected.value = false;
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, AppLocalizations.current.disconnected),
);
_socket = null;
},
} else {
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, AppLocalizations.current.disconnected),
);
},
);
}
});
}
void _write(Socket socket, List<int> responseData) {
if (kDebugMode) {
print('Sending response: ${bytesToHex(responseData)}');
}
socket.add(responseData);
Future<void> startServer() async {
return clickEmulator.startServer();
}
int _propertyVal(List<String> properties) {
int res = 0;
if (properties.contains('read')) res |= 0x01;
if (properties.contains('write')) res |= 0x02;
if (properties.contains('indicate')) res |= 0x03;
if (properties.contains('notify')) res |= 0x04;
return res;
void stop() {
clickEmulator.stop();
}
@override
@@ -358,125 +83,19 @@ class FtmsMdnsEmulator extends TrainerConnection {
final bytes = status.writeToBuffer();
final commandProto = _buildNotify(
ZwiftConstants.ZWIFT_ASYNC_CHARACTERISTIC_UUID,
Uint8List.fromList([
Opcode.CONTROLLER_NOTIFICATION.value,
...bytes,
]),
);
_write(_socket!, commandProto);
clickEmulator.write(bytes);
}
if (isKeyUp) {
final zero = _buildNotify(
ZwiftConstants.ZWIFT_ASYNC_CHARACTERISTIC_UUID,
clickEmulator.write(
Uint8List.fromList([Opcode.CONTROLLER_NOTIFICATION.value, 0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F]),
);
_write(_socket!, zero);
}
if (kDebugMode) {
print('Sent action ${keyPair.inGameAction!.title} to Zwift Emulator');
print('Sent action $isKeyUp vs $isKeyDown ${keyPair.inGameAction!.title} to Zwift Emulator');
}
return Success('Sent action: ${keyPair.inGameAction!.title}');
}
List<int> _buildNotify(String uuid, final List<int> data) {
final seqNum = (lastMessageId + 1) % 256;
lastMessageId = seqNum;
final responseBody = [
...hexToBytes(uuid.toLowerCase().toNonDash()),
...data,
];
final responseData = [
// header
...Uint8List.fromList([
0x01,
FtmsMdnsConstants.DC_MESSAGE_CHARACTERISTIC_NOTIFICATION,
seqNum,
FtmsMdnsConstants.DC_RC_REQUEST_COMPLETED_SUCCESSFULLY,
(responseBody.length >> 8) & 0xFF,
responseBody.length & 0xFF,
]),
// body
...responseBody,
];
return responseData;
}
Future<void> _sendKeepAlive() async {
await Future.delayed(const Duration(seconds: 5));
if (_socket != null) {
_write(
_socket!,
_buildNotify(
ZwiftConstants.ZWIFT_SYNC_TX_CHARACTERISTIC_UUID,
hexToBytes('B70100002041201C00180004001B4F00B701000020798EC5BDEFCBE4563418269E4926FBE1'),
),
);
_sendKeepAlive();
}
}
}
extension on String {
String toNonDash() {
return replaceAll('-', '');
}
String toUUID() {
return '${substring(0, 8)}-${substring(8, 12)}-${substring(12, 16)}-${substring(16, 20)}-${substring(20)}';
}
}
extension on List<int> {
int takeUInt8() {
final value = this[0];
removeAt(0);
return value;
}
int readUInt8(int offset) {
return this[offset];
}
int takeUInt16BE() {
final value = (this[0] << 8) | this[0 + 1];
removeAt(0);
removeAt(0);
return value;
}
List<int> takeBytes(int length) {
final value = sublist(0, length);
removeRange(0, length);
return value;
}
int readUInt16BE(int i) {
final value = (this[i] << 8) | this[i + 1];
return value;
}
}
String bytesToHex(List<int> bytes) {
return bytes.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join();
}
String bytesToReadableHex(List<int> bytes) {
return bytes.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join(' ');
}
List<int> hexToBytes(String hex) {
final bytes = <int>[];
for (var i = 0; i < hex.length; i += 2) {
final byte = hex.substring(i, i + 2);
bytes.add(int.parse(byte, radix: 16));
}
return bytes;
}
class FtmsMdnsConstants {

File diff suppressed because it is too large Load Diff

View File

@@ -1,583 +0,0 @@
//
// Generated code. Do not modify.
// source: zp.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// ///////////////////////////////////////////////////////////////
/// Enumerations
/// ///////////////////////////////////////////////////////////////
class Opcode extends $pb.ProtobufEnum {
static const Opcode GET = Opcode._(0, _omitEnumNames ? '' : 'GET');
static const Opcode DEV_INFO_STATUS = Opcode._(1, _omitEnumNames ? '' : 'DEV_INFO_STATUS');
static const Opcode BLE_SECURITY_REQUEST = Opcode._(2, _omitEnumNames ? '' : 'BLE_SECURITY_REQUEST');
static const Opcode TRAINER_NOTIF = Opcode._(3, _omitEnumNames ? '' : 'TRAINER_NOTIF');
static const Opcode TRAINER_CONFIG_SET = Opcode._(4, _omitEnumNames ? '' : 'TRAINER_CONFIG_SET');
static const Opcode TRAINER_CONFIG_STATUS = Opcode._(5, _omitEnumNames ? '' : 'TRAINER_CONFIG_STATUS');
static const Opcode DEV_INFO_SET = Opcode._(12, _omitEnumNames ? '' : 'DEV_INFO_SET');
static const Opcode POWER_OFF = Opcode._(15, _omitEnumNames ? '' : 'POWER_OFF');
static const Opcode RESET = Opcode._(24, _omitEnumNames ? '' : 'RESET');
static const Opcode BATTERY_NOTIF = Opcode._(25, _omitEnumNames ? '' : 'BATTERY_NOTIF');
static const Opcode CONTROLLER_NOTIFICATION = Opcode._(35, _omitEnumNames ? '' : 'CONTROLLER_NOTIFICATION');
static const Opcode LOG_DATA = Opcode._(42, _omitEnumNames ? '' : 'LOG_DATA');
static const Opcode SPINDOWN_REQUEST = Opcode._(58, _omitEnumNames ? '' : 'SPINDOWN_REQUEST');
static const Opcode SPINDOWN_NOTIFICATION = Opcode._(59, _omitEnumNames ? '' : 'SPINDOWN_NOTIFICATION');
static const Opcode GET_RESPONSE = Opcode._(60, _omitEnumNames ? '' : 'GET_RESPONSE');
static const Opcode STATUS_RESPONSE = Opcode._(62, _omitEnumNames ? '' : 'STATUS_RESPONSE');
static const Opcode SET = Opcode._(63, _omitEnumNames ? '' : 'SET');
static const Opcode SET_RESPONSE = Opcode._(64, _omitEnumNames ? '' : 'SET_RESPONSE');
static const Opcode LOG_LEVEL_SET = Opcode._(65, _omitEnumNames ? '' : 'LOG_LEVEL_SET');
static const Opcode DATA_CHANGE_NOTIFICATION = Opcode._(66, _omitEnumNames ? '' : 'DATA_CHANGE_NOTIFICATION');
static const Opcode GAME_STATE_NOTIFICATION = Opcode._(67, _omitEnumNames ? '' : 'GAME_STATE_NOTIFICATION');
static const Opcode SENSOR_RELAY_CONFIG = Opcode._(68, _omitEnumNames ? '' : 'SENSOR_RELAY_CONFIG');
static const Opcode SENSOR_RELAY_GET = Opcode._(69, _omitEnumNames ? '' : 'SENSOR_RELAY_GET');
static const Opcode SENSOR_RELAY_RESPONSE = Opcode._(70, _omitEnumNames ? '' : 'SENSOR_RELAY_RESPONSE');
static const Opcode SENSOR_RELAY_NOTIFICATION = Opcode._(71, _omitEnumNames ? '' : 'SENSOR_RELAY_NOTIFICATION');
static const Opcode HRM_DATA_NOTIFICATION = Opcode._(72, _omitEnumNames ? '' : 'HRM_DATA_NOTIFICATION');
static const Opcode WIFI_CONFIG_REQUEST = Opcode._(73, _omitEnumNames ? '' : 'WIFI_CONFIG_REQUEST');
static const Opcode WIFI_NOTIFICATION = Opcode._(74, _omitEnumNames ? '' : 'WIFI_NOTIFICATION');
static const Opcode POWER_METER_NOTIFICATION = Opcode._(75, _omitEnumNames ? '' : 'POWER_METER_NOTIFICATION');
static const Opcode CADENCE_SENSOR_NOTIFICATION = Opcode._(76, _omitEnumNames ? '' : 'CADENCE_SENSOR_NOTIFICATION');
static const Opcode DEVICE_UPDATE_REQUEST = Opcode._(77, _omitEnumNames ? '' : 'DEVICE_UPDATE_REQUEST');
static const Opcode RELAY_ZP_MESSAGE = Opcode._(78, _omitEnumNames ? '' : 'RELAY_ZP_MESSAGE');
static const Opcode RIDE_ON = Opcode._(82, _omitEnumNames ? '' : 'RIDE_ON');
static const Opcode RESERVED = Opcode._(253, _omitEnumNames ? '' : 'RESERVED');
static const Opcode LOST_CONTROL = Opcode._(254, _omitEnumNames ? '' : 'LOST_CONTROL');
static const Opcode VENDOR_MESSAGE = Opcode._(255, _omitEnumNames ? '' : 'VENDOR_MESSAGE');
static const $core.List<Opcode> values = <Opcode> [
GET,
DEV_INFO_STATUS,
BLE_SECURITY_REQUEST,
TRAINER_NOTIF,
TRAINER_CONFIG_SET,
TRAINER_CONFIG_STATUS,
DEV_INFO_SET,
POWER_OFF,
RESET,
BATTERY_NOTIF,
CONTROLLER_NOTIFICATION,
LOG_DATA,
SPINDOWN_REQUEST,
SPINDOWN_NOTIFICATION,
GET_RESPONSE,
STATUS_RESPONSE,
SET,
SET_RESPONSE,
LOG_LEVEL_SET,
DATA_CHANGE_NOTIFICATION,
GAME_STATE_NOTIFICATION,
SENSOR_RELAY_CONFIG,
SENSOR_RELAY_GET,
SENSOR_RELAY_RESPONSE,
SENSOR_RELAY_NOTIFICATION,
HRM_DATA_NOTIFICATION,
WIFI_CONFIG_REQUEST,
WIFI_NOTIFICATION,
POWER_METER_NOTIFICATION,
CADENCE_SENSOR_NOTIFICATION,
DEVICE_UPDATE_REQUEST,
RELAY_ZP_MESSAGE,
RIDE_ON,
RESERVED,
LOST_CONTROL,
VENDOR_MESSAGE,
];
static final $core.Map<$core.int, Opcode> _byValue = $pb.ProtobufEnum.initByValue(values);
static Opcode? valueOf($core.int value) => _byValue[value];
const Opcode._($core.int v, $core.String n) : super(v, n);
}
/// Data Objects
class DO extends $pb.ProtobufEnum {
static const DO PAGE_DEV_INFO = DO._(0, _omitEnumNames ? '' : 'PAGE_DEV_INFO');
static const DO PROTOCOL_VERSION = DO._(1, _omitEnumNames ? '' : 'PROTOCOL_VERSION');
static const DO SYSTEM_FW_VERSION = DO._(2, _omitEnumNames ? '' : 'SYSTEM_FW_VERSION');
static const DO DEVICE_NAME = DO._(3, _omitEnumNames ? '' : 'DEVICE_NAME');
static const DO SERIAL_NUMBER = DO._(5, _omitEnumNames ? '' : 'SERIAL_NUMBER');
static const DO SYSTEM_HW_REVISION = DO._(6, _omitEnumNames ? '' : 'SYSTEM_HW_REVISION');
static const DO DEVICE_CAPABILITIES = DO._(7, _omitEnumNames ? '' : 'DEVICE_CAPABILITIES');
static const DO MANUFACTURER_ID = DO._(8, _omitEnumNames ? '' : 'MANUFACTURER_ID');
static const DO PRODUCT_ID = DO._(9, _omitEnumNames ? '' : 'PRODUCT_ID');
static const DO DEVICE_UID = DO._(10, _omitEnumNames ? '' : 'DEVICE_UID');
static const DO PAGE_CLIENT_SERVER_CONFIGURATION = DO._(16, _omitEnumNames ? '' : 'PAGE_CLIENT_SERVER_CONFIGURATION');
static const DO CLIENT_SERVER_NOTIFICATIONS = DO._(17, _omitEnumNames ? '' : 'CLIENT_SERVER_NOTIFICATIONS');
static const DO PAGE_DEVICE_UPDATE_INFO = DO._(32, _omitEnumNames ? '' : 'PAGE_DEVICE_UPDATE_INFO');
static const DO DEVICE_UPDATE_STATUS = DO._(33, _omitEnumNames ? '' : 'DEVICE_UPDATE_STATUS');
static const DO DEVICE_UPDATE_NEW_VERSION = DO._(34, _omitEnumNames ? '' : 'DEVICE_UPDATE_NEW_VERSION');
static const DO PAGE_DATE_TIME = DO._(48, _omitEnumNames ? '' : 'PAGE_DATE_TIME');
static const DO UTC_DATE_TIME = DO._(49, _omitEnumNames ? '' : 'UTC_DATE_TIME');
static const DO PAGE_BLE_SECURITY = DO._(64, _omitEnumNames ? '' : 'PAGE_BLE_SECURITY');
static const DO BLE_SECURE_CONNECTION_STATUS = DO._(65, _omitEnumNames ? '' : 'BLE_SECURE_CONNECTION_STATUS');
static const DO BLE_SECURE_CONNECTION_WINDOW_STATUS = DO._(66, _omitEnumNames ? '' : 'BLE_SECURE_CONNECTION_WINDOW_STATUS');
static const DO PAGE_TRAINER_CONFIG = DO._(512, _omitEnumNames ? '' : 'PAGE_TRAINER_CONFIG');
static const DO TRAINER_MODE = DO._(513, _omitEnumNames ? '' : 'TRAINER_MODE');
static const DO CFG_RESISTANCE = DO._(514, _omitEnumNames ? '' : 'CFG_RESISTANCE');
static const DO ERG_POWER = DO._(515, _omitEnumNames ? '' : 'ERG_POWER');
static const DO AVERAGING_WINDOW = DO._(516, _omitEnumNames ? '' : 'AVERAGING_WINDOW');
static const DO SIM_WIND = DO._(517, _omitEnumNames ? '' : 'SIM_WIND');
static const DO SIM_GRADE = DO._(518, _omitEnumNames ? '' : 'SIM_GRADE');
static const DO SIM_REAL_GEAR_RATIO = DO._(519, _omitEnumNames ? '' : 'SIM_REAL_GEAR_RATIO');
static const DO SIM_VIRT_GEAR_RATIO = DO._(520, _omitEnumNames ? '' : 'SIM_VIRT_GEAR_RATIO');
static const DO SIM_CW = DO._(521, _omitEnumNames ? '' : 'SIM_CW');
static const DO SIM_WHEEL_DIAMETER = DO._(522, _omitEnumNames ? '' : 'SIM_WHEEL_DIAMETER');
static const DO SIM_BIKE_MASS = DO._(523, _omitEnumNames ? '' : 'SIM_BIKE_MASS');
static const DO SIM_RIDER_MASS = DO._(524, _omitEnumNames ? '' : 'SIM_RIDER_MASS');
static const DO SIM_CRR = DO._(525, _omitEnumNames ? '' : 'SIM_CRR');
static const DO SIM_RESERVED_FRONTAL_AREA = DO._(526, _omitEnumNames ? '' : 'SIM_RESERVED_FRONTAL_AREA');
static const DO SIM_EBRAKE = DO._(527, _omitEnumNames ? '' : 'SIM_EBRAKE');
static const DO PAGE_TRAINER_GEAR_INDEX_CONFIG = DO._(528, _omitEnumNames ? '' : 'PAGE_TRAINER_GEAR_INDEX_CONFIG');
static const DO FRONT_GEAR_INDEX = DO._(529, _omitEnumNames ? '' : 'FRONT_GEAR_INDEX');
static const DO FRONT_GEAR_INDEX_MAX = DO._(530, _omitEnumNames ? '' : 'FRONT_GEAR_INDEX_MAX');
static const DO FRONT_GEAR_INDEX_MIN = DO._(531, _omitEnumNames ? '' : 'FRONT_GEAR_INDEX_MIN');
static const DO REAR_GEAR_INDEX = DO._(532, _omitEnumNames ? '' : 'REAR_GEAR_INDEX');
static const DO REAR_GEAR_INDEX_MAX = DO._(533, _omitEnumNames ? '' : 'REAR_GEAR_INDEX_MAX');
static const DO REAR_GEAR_INDEX_MIN = DO._(534, _omitEnumNames ? '' : 'REAR_GEAR_INDEX_MIN');
static const DO PAGE_TRAINER_CONFIG2 = DO._(544, _omitEnumNames ? '' : 'PAGE_TRAINER_CONFIG2');
static const DO HIGH_SPEED_DATA = DO._(545, _omitEnumNames ? '' : 'HIGH_SPEED_DATA');
static const DO ERG_POWER_SMOOTHING = DO._(546, _omitEnumNames ? '' : 'ERG_POWER_SMOOTHING');
static const DO VIRTUAL_SHIFTING_MODE = DO._(547, _omitEnumNames ? '' : 'VIRTUAL_SHIFTING_MODE');
static const DO PAGE_DEVICE_TILT_CONFIG = DO._(560, _omitEnumNames ? '' : 'PAGE_DEVICE_TILT_CONFIG');
static const DO DEVICE_TILT_ENABLED = DO._(561, _omitEnumNames ? '' : 'DEVICE_TILT_ENABLED');
static const DO DEVICE_TILT_GRADIENT_MIN = DO._(562, _omitEnumNames ? '' : 'DEVICE_TILT_GRADIENT_MIN');
static const DO DEVICE_TILT_GRADIENT_MAX = DO._(563, _omitEnumNames ? '' : 'DEVICE_TILT_GRADIENT_MAX');
static const DO DEVICE_TILT_GRADIENT = DO._(564, _omitEnumNames ? '' : 'DEVICE_TILT_GRADIENT');
static const DO BATTERY_STATE = DO._(771, _omitEnumNames ? '' : 'BATTERY_STATE');
static const DO PAGE_CONTROLLER_INPUT_CONFIG = DO._(1024, _omitEnumNames ? '' : 'PAGE_CONTROLLER_INPUT_CONFIG');
static const DO INPUT_SUPPORTED_DIGITAL_INPUTS = DO._(1025, _omitEnumNames ? '' : 'INPUT_SUPPORTED_DIGITAL_INPUTS');
static const DO INPUT_SUPPORTED_ANALOG_INPUTS = DO._(1026, _omitEnumNames ? '' : 'INPUT_SUPPORTED_ANALOG_INPUTS');
static const DO INPUT_ANALOG_INPUT_RANGE = DO._(1027, _omitEnumNames ? '' : 'INPUT_ANALOG_INPUT_RANGE');
static const DO INPUT_ANALOG_INPUT_DEADZONE = DO._(1028, _omitEnumNames ? '' : 'INPUT_ANALOG_INPUT_DEADZONE');
static const DO PAGE_WIFI_CONFIGURATION = DO._(1056, _omitEnumNames ? '' : 'PAGE_WIFI_CONFIGURATION');
static const DO WIFI_ENABLED = DO._(1057, _omitEnumNames ? '' : 'WIFI_ENABLED');
static const DO WIFI_STATUS = DO._(1058, _omitEnumNames ? '' : 'WIFI_STATUS');
static const DO WIFI_SSID = DO._(1059, _omitEnumNames ? '' : 'WIFI_SSID');
static const DO WIFI_BAND = DO._(1060, _omitEnumNames ? '' : 'WIFI_BAND');
static const DO WIFI_RSSI = DO._(1061, _omitEnumNames ? '' : 'WIFI_RSSI');
static const DO WIFI_REGION_CODE = DO._(1062, _omitEnumNames ? '' : 'WIFI_REGION_CODE');
static const DO SENSOR_RELAY_DATA_PAGE = DO._(1280, _omitEnumNames ? '' : 'SENSOR_RELAY_DATA_PAGE');
static const DO SENSOR_RELAY_SUPPORTED_SENSORS = DO._(1281, _omitEnumNames ? '' : 'SENSOR_RELAY_SUPPORTED_SENSORS');
static const DO SENSOR_RELAY_PAIRED_SENSORS = DO._(1282, _omitEnumNames ? '' : 'SENSOR_RELAY_PAIRED_SENSORS');
static const $core.List<DO> values = <DO> [
PAGE_DEV_INFO,
PROTOCOL_VERSION,
SYSTEM_FW_VERSION,
DEVICE_NAME,
SERIAL_NUMBER,
SYSTEM_HW_REVISION,
DEVICE_CAPABILITIES,
MANUFACTURER_ID,
PRODUCT_ID,
DEVICE_UID,
PAGE_CLIENT_SERVER_CONFIGURATION,
CLIENT_SERVER_NOTIFICATIONS,
PAGE_DEVICE_UPDATE_INFO,
DEVICE_UPDATE_STATUS,
DEVICE_UPDATE_NEW_VERSION,
PAGE_DATE_TIME,
UTC_DATE_TIME,
PAGE_BLE_SECURITY,
BLE_SECURE_CONNECTION_STATUS,
BLE_SECURE_CONNECTION_WINDOW_STATUS,
PAGE_TRAINER_CONFIG,
TRAINER_MODE,
CFG_RESISTANCE,
ERG_POWER,
AVERAGING_WINDOW,
SIM_WIND,
SIM_GRADE,
SIM_REAL_GEAR_RATIO,
SIM_VIRT_GEAR_RATIO,
SIM_CW,
SIM_WHEEL_DIAMETER,
SIM_BIKE_MASS,
SIM_RIDER_MASS,
SIM_CRR,
SIM_RESERVED_FRONTAL_AREA,
SIM_EBRAKE,
PAGE_TRAINER_GEAR_INDEX_CONFIG,
FRONT_GEAR_INDEX,
FRONT_GEAR_INDEX_MAX,
FRONT_GEAR_INDEX_MIN,
REAR_GEAR_INDEX,
REAR_GEAR_INDEX_MAX,
REAR_GEAR_INDEX_MIN,
PAGE_TRAINER_CONFIG2,
HIGH_SPEED_DATA,
ERG_POWER_SMOOTHING,
VIRTUAL_SHIFTING_MODE,
PAGE_DEVICE_TILT_CONFIG,
DEVICE_TILT_ENABLED,
DEVICE_TILT_GRADIENT_MIN,
DEVICE_TILT_GRADIENT_MAX,
DEVICE_TILT_GRADIENT,
BATTERY_STATE,
PAGE_CONTROLLER_INPUT_CONFIG,
INPUT_SUPPORTED_DIGITAL_INPUTS,
INPUT_SUPPORTED_ANALOG_INPUTS,
INPUT_ANALOG_INPUT_RANGE,
INPUT_ANALOG_INPUT_DEADZONE,
PAGE_WIFI_CONFIGURATION,
WIFI_ENABLED,
WIFI_STATUS,
WIFI_SSID,
WIFI_BAND,
WIFI_RSSI,
WIFI_REGION_CODE,
SENSOR_RELAY_DATA_PAGE,
SENSOR_RELAY_SUPPORTED_SENSORS,
SENSOR_RELAY_PAIRED_SENSORS,
];
static final $core.Map<$core.int, DO> _byValue = $pb.ProtobufEnum.initByValue(values);
static DO? valueOf($core.int value) => _byValue[value];
const DO._($core.int v, $core.String n) : super(v, n);
}
class Status extends $pb.ProtobufEnum {
static const Status SUCCESS = Status._(0, _omitEnumNames ? '' : 'SUCCESS');
static const Status FAILURE = Status._(1, _omitEnumNames ? '' : 'FAILURE');
static const Status BUSY = Status._(2, _omitEnumNames ? '' : 'BUSY');
static const Status INVALID_PARAM = Status._(3, _omitEnumNames ? '' : 'INVALID_PARAM');
static const Status NOT_PERMITTED = Status._(4, _omitEnumNames ? '' : 'NOT_PERMITTED');
static const Status NOT_SUPPORTED = Status._(5, _omitEnumNames ? '' : 'NOT_SUPPORTED');
static const Status INVALID_MODE = Status._(6, _omitEnumNames ? '' : 'INVALID_MODE');
static const $core.List<Status> values = <Status> [
SUCCESS,
FAILURE,
BUSY,
INVALID_PARAM,
NOT_PERMITTED,
NOT_SUPPORTED,
INVALID_MODE,
];
static final $core.Map<$core.int, Status> _byValue = $pb.ProtobufEnum.initByValue(values);
static Status? valueOf($core.int value) => _byValue[value];
const Status._($core.int v, $core.String n) : super(v, n);
}
class DeviceType extends $pb.ProtobufEnum {
static const DeviceType UNDEFINED = DeviceType._(0, _omitEnumNames ? '' : 'UNDEFINED');
static const DeviceType CYCLING_TURBO_TRAINER = DeviceType._(1, _omitEnumNames ? '' : 'CYCLING_TURBO_TRAINER');
static const DeviceType USER_INPUT_DEVICE = DeviceType._(2, _omitEnumNames ? '' : 'USER_INPUT_DEVICE');
static const DeviceType TREADMILL = DeviceType._(3, _omitEnumNames ? '' : 'TREADMILL');
static const DeviceType SENSOR_RELAY = DeviceType._(4, _omitEnumNames ? '' : 'SENSOR_RELAY');
static const DeviceType HEART_RATE_MONITOR = DeviceType._(5, _omitEnumNames ? '' : 'HEART_RATE_MONITOR');
static const DeviceType POWER_METER = DeviceType._(6, _omitEnumNames ? '' : 'POWER_METER');
static const DeviceType CADENCE_SENSOR = DeviceType._(7, _omitEnumNames ? '' : 'CADENCE_SENSOR');
static const DeviceType WIFI = DeviceType._(8, _omitEnumNames ? '' : 'WIFI');
static const $core.List<DeviceType> values = <DeviceType> [
UNDEFINED,
CYCLING_TURBO_TRAINER,
USER_INPUT_DEVICE,
TREADMILL,
SENSOR_RELAY,
HEART_RATE_MONITOR,
POWER_METER,
CADENCE_SENSOR,
WIFI,
];
static final $core.Map<$core.int, DeviceType> _byValue = $pb.ProtobufEnum.initByValue(values);
static DeviceType? valueOf($core.int value) => _byValue[value];
const DeviceType._($core.int v, $core.String n) : super(v, n);
}
class TrainerMode extends $pb.ProtobufEnum {
static const TrainerMode MODE_UNKNOWN = TrainerMode._(0, _omitEnumNames ? '' : 'MODE_UNKNOWN');
static const TrainerMode MODE_ERG = TrainerMode._(1, _omitEnumNames ? '' : 'MODE_ERG');
static const TrainerMode MODE_RESISTANCE = TrainerMode._(2, _omitEnumNames ? '' : 'MODE_RESISTANCE');
static const TrainerMode MODE_SIM = TrainerMode._(3, _omitEnumNames ? '' : 'MODE_SIM');
static const $core.List<TrainerMode> values = <TrainerMode> [
MODE_UNKNOWN,
MODE_ERG,
MODE_RESISTANCE,
MODE_SIM,
];
static final $core.Map<$core.int, TrainerMode> _byValue = $pb.ProtobufEnum.initByValue(values);
static TrainerMode? valueOf($core.int value) => _byValue[value];
const TrainerMode._($core.int v, $core.String n) : super(v, n);
}
class ChargingState extends $pb.ProtobufEnum {
static const ChargingState CHARGING_IDLE = ChargingState._(0, _omitEnumNames ? '' : 'CHARGING_IDLE');
static const ChargingState CHARGING_PROGRESS = ChargingState._(1, _omitEnumNames ? '' : 'CHARGING_PROGRESS');
static const ChargingState CHARGING_DONE = ChargingState._(2, _omitEnumNames ? '' : 'CHARGING_DONE');
static const $core.List<ChargingState> values = <ChargingState> [
CHARGING_IDLE,
CHARGING_PROGRESS,
CHARGING_DONE,
];
static final $core.Map<$core.int, ChargingState> _byValue = $pb.ProtobufEnum.initByValue(values);
static ChargingState? valueOf($core.int value) => _byValue[value];
const ChargingState._($core.int v, $core.String n) : super(v, n);
}
class SpindownStatus extends $pb.ProtobufEnum {
static const SpindownStatus SPINDOWN_IDLE = SpindownStatus._(0, _omitEnumNames ? '' : 'SPINDOWN_IDLE');
static const SpindownStatus SPINDOWN_REQUESTED = SpindownStatus._(1, _omitEnumNames ? '' : 'SPINDOWN_REQUESTED');
static const SpindownStatus SPINDOWN_SUCCESS = SpindownStatus._(2, _omitEnumNames ? '' : 'SPINDOWN_SUCCESS');
static const SpindownStatus SPINDOWN_ERROR = SpindownStatus._(3, _omitEnumNames ? '' : 'SPINDOWN_ERROR');
static const SpindownStatus SPINDOWN_STOP_PEDALLING = SpindownStatus._(4, _omitEnumNames ? '' : 'SPINDOWN_STOP_PEDALLING');
static const SpindownStatus SPINDOWN_ERROR_TIMEOUT = SpindownStatus._(5, _omitEnumNames ? '' : 'SPINDOWN_ERROR_TIMEOUT');
static const SpindownStatus SPINDOWN_ERROR_TOSHORT = SpindownStatus._(6, _omitEnumNames ? '' : 'SPINDOWN_ERROR_TOSHORT');
static const SpindownStatus SPINDOWN_ERROR_TOSLOW = SpindownStatus._(7, _omitEnumNames ? '' : 'SPINDOWN_ERROR_TOSLOW');
static const SpindownStatus SPINDOWN_ERROR_TOFAST = SpindownStatus._(8, _omitEnumNames ? '' : 'SPINDOWN_ERROR_TOFAST');
static const SpindownStatus SPINDOWN_ERROR_SAMPLEERROR = SpindownStatus._(9, _omitEnumNames ? '' : 'SPINDOWN_ERROR_SAMPLEERROR');
static const SpindownStatus SPINDOWN_ERROR_ABORT = SpindownStatus._(10, _omitEnumNames ? '' : 'SPINDOWN_ERROR_ABORT');
static const $core.List<SpindownStatus> values = <SpindownStatus> [
SPINDOWN_IDLE,
SPINDOWN_REQUESTED,
SPINDOWN_SUCCESS,
SPINDOWN_ERROR,
SPINDOWN_STOP_PEDALLING,
SPINDOWN_ERROR_TIMEOUT,
SPINDOWN_ERROR_TOSHORT,
SPINDOWN_ERROR_TOSLOW,
SPINDOWN_ERROR_TOFAST,
SPINDOWN_ERROR_SAMPLEERROR,
SPINDOWN_ERROR_ABORT,
];
static final $core.Map<$core.int, SpindownStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static SpindownStatus? valueOf($core.int value) => _byValue[value];
const SpindownStatus._($core.int v, $core.String n) : super(v, n);
}
class LogLevel extends $pb.ProtobufEnum {
static const LogLevel LOGLEVEL_OFF = LogLevel._(0, _omitEnumNames ? '' : 'LOGLEVEL_OFF');
static const LogLevel LOGLEVEL_ERROR = LogLevel._(1, _omitEnumNames ? '' : 'LOGLEVEL_ERROR');
static const LogLevel LOGLEVEL_WARNING = LogLevel._(2, _omitEnumNames ? '' : 'LOGLEVEL_WARNING');
static const LogLevel LOGLEVEL_INFO = LogLevel._(3, _omitEnumNames ? '' : 'LOGLEVEL_INFO');
static const LogLevel LOGLEVEL_DEBUG = LogLevel._(4, _omitEnumNames ? '' : 'LOGLEVEL_DEBUG');
static const LogLevel LOGLEVEL_TRACE = LogLevel._(5, _omitEnumNames ? '' : 'LOGLEVEL_TRACE');
static const $core.List<LogLevel> values = <LogLevel> [
LOGLEVEL_OFF,
LOGLEVEL_ERROR,
LOGLEVEL_WARNING,
LOGLEVEL_INFO,
LOGLEVEL_DEBUG,
LOGLEVEL_TRACE,
];
static final $core.Map<$core.int, LogLevel> _byValue = $pb.ProtobufEnum.initByValue(values);
static LogLevel? valueOf($core.int value) => _byValue[value];
const LogLevel._($core.int v, $core.String n) : super(v, n);
}
class RoadSurfaceType extends $pb.ProtobufEnum {
static const RoadSurfaceType ROAD_SURFACE_SMOOTH_TARMAC = RoadSurfaceType._(0, _omitEnumNames ? '' : 'ROAD_SURFACE_SMOOTH_TARMAC');
static const RoadSurfaceType ROAD_SURFACE_BRICK_ROAD = RoadSurfaceType._(1, _omitEnumNames ? '' : 'ROAD_SURFACE_BRICK_ROAD');
static const RoadSurfaceType ROAD_SURFACE_HARD_COBBLES = RoadSurfaceType._(2, _omitEnumNames ? '' : 'ROAD_SURFACE_HARD_COBBLES');
static const RoadSurfaceType ROAD_SURFACE_SOFT_COBBLES = RoadSurfaceType._(3, _omitEnumNames ? '' : 'ROAD_SURFACE_SOFT_COBBLES');
static const RoadSurfaceType ROAD_SURFACE_NARROW_WOODEN_PLANKS = RoadSurfaceType._(4, _omitEnumNames ? '' : 'ROAD_SURFACE_NARROW_WOODEN_PLANKS');
static const RoadSurfaceType ROAD_SURFACE_WIDE_WOODEN_PLANKS = RoadSurfaceType._(5, _omitEnumNames ? '' : 'ROAD_SURFACE_WIDE_WOODEN_PLANKS');
static const RoadSurfaceType ROAD_SURFACE_DIRT = RoadSurfaceType._(6, _omitEnumNames ? '' : 'ROAD_SURFACE_DIRT');
static const RoadSurfaceType ROAD_SURFACE_GRAVEL = RoadSurfaceType._(7, _omitEnumNames ? '' : 'ROAD_SURFACE_GRAVEL');
static const RoadSurfaceType ROAD_SURFACE_CATTLE_GRID = RoadSurfaceType._(8, _omitEnumNames ? '' : 'ROAD_SURFACE_CATTLE_GRID');
static const RoadSurfaceType ROAD_SURFACE_CONCRETE_FLAG_STONES = RoadSurfaceType._(9, _omitEnumNames ? '' : 'ROAD_SURFACE_CONCRETE_FLAG_STONES');
static const RoadSurfaceType ROAD_SURFACE_ICE = RoadSurfaceType._(10, _omitEnumNames ? '' : 'ROAD_SURFACE_ICE');
static const $core.List<RoadSurfaceType> values = <RoadSurfaceType> [
ROAD_SURFACE_SMOOTH_TARMAC,
ROAD_SURFACE_BRICK_ROAD,
ROAD_SURFACE_HARD_COBBLES,
ROAD_SURFACE_SOFT_COBBLES,
ROAD_SURFACE_NARROW_WOODEN_PLANKS,
ROAD_SURFACE_WIDE_WOODEN_PLANKS,
ROAD_SURFACE_DIRT,
ROAD_SURFACE_GRAVEL,
ROAD_SURFACE_CATTLE_GRID,
ROAD_SURFACE_CONCRETE_FLAG_STONES,
ROAD_SURFACE_ICE,
];
static final $core.Map<$core.int, RoadSurfaceType> _byValue = $pb.ProtobufEnum.initByValue(values);
static RoadSurfaceType? valueOf($core.int value) => _byValue[value];
const RoadSurfaceType._($core.int v, $core.String n) : super(v, n);
}
class WifiStatusCode extends $pb.ProtobufEnum {
static const WifiStatusCode WIFI_STATUS_DISABLED = WifiStatusCode._(0, _omitEnumNames ? '' : 'WIFI_STATUS_DISABLED');
static const WifiStatusCode WIFI_STATUS_NOT_PROVISIONED = WifiStatusCode._(1, _omitEnumNames ? '' : 'WIFI_STATUS_NOT_PROVISIONED');
static const WifiStatusCode WIFI_STATUS_SCANNING = WifiStatusCode._(2, _omitEnumNames ? '' : 'WIFI_STATUS_SCANNING');
static const WifiStatusCode WIFI_STATUS_DISCONNECTED = WifiStatusCode._(3, _omitEnumNames ? '' : 'WIFI_STATUS_DISCONNECTED');
static const WifiStatusCode WIFI_STATUS_CONNECTING = WifiStatusCode._(4, _omitEnumNames ? '' : 'WIFI_STATUS_CONNECTING');
static const WifiStatusCode WIFI_STATUS_CONNECTED = WifiStatusCode._(5, _omitEnumNames ? '' : 'WIFI_STATUS_CONNECTED');
static const WifiStatusCode WIFI_STATUS_ERROR = WifiStatusCode._(6, _omitEnumNames ? '' : 'WIFI_STATUS_ERROR');
static const $core.List<WifiStatusCode> values = <WifiStatusCode> [
WIFI_STATUS_DISABLED,
WIFI_STATUS_NOT_PROVISIONED,
WIFI_STATUS_SCANNING,
WIFI_STATUS_DISCONNECTED,
WIFI_STATUS_CONNECTING,
WIFI_STATUS_CONNECTED,
WIFI_STATUS_ERROR,
];
static final $core.Map<$core.int, WifiStatusCode> _byValue = $pb.ProtobufEnum.initByValue(values);
static WifiStatusCode? valueOf($core.int value) => _byValue[value];
const WifiStatusCode._($core.int v, $core.String n) : super(v, n);
}
class WifiErrorCode extends $pb.ProtobufEnum {
static const WifiErrorCode WIFI_ERROR_UNKNOWN = WifiErrorCode._(0, _omitEnumNames ? '' : 'WIFI_ERROR_UNKNOWN');
static const WifiErrorCode WIFI_ERROR_NO_MEMORY = WifiErrorCode._(1, _omitEnumNames ? '' : 'WIFI_ERROR_NO_MEMORY');
static const WifiErrorCode WIFI_ERROR_INVALID_PARAMETERS = WifiErrorCode._(2, _omitEnumNames ? '' : 'WIFI_ERROR_INVALID_PARAMETERS');
static const WifiErrorCode WIFI_ERROR_INVALID_STATE = WifiErrorCode._(3, _omitEnumNames ? '' : 'WIFI_ERROR_INVALID_STATE');
static const WifiErrorCode WIFI_ERROR_NOT_FOUND = WifiErrorCode._(4, _omitEnumNames ? '' : 'WIFI_ERROR_NOT_FOUND');
static const WifiErrorCode WIFI_ERROR_NOT_SUPPORTED = WifiErrorCode._(5, _omitEnumNames ? '' : 'WIFI_ERROR_NOT_SUPPORTED');
static const WifiErrorCode WIFI_ERROR_NOT_ALLOWED = WifiErrorCode._(6, _omitEnumNames ? '' : 'WIFI_ERROR_NOT_ALLOWED');
static const WifiErrorCode WIFI_ERROR_NOT_INITIALISED = WifiErrorCode._(7, _omitEnumNames ? '' : 'WIFI_ERROR_NOT_INITIALISED');
static const WifiErrorCode WIFI_ERROR_NOT_STARTED = WifiErrorCode._(8, _omitEnumNames ? '' : 'WIFI_ERROR_NOT_STARTED');
static const WifiErrorCode WIFI_ERROR_TIMEOUT = WifiErrorCode._(9, _omitEnumNames ? '' : 'WIFI_ERROR_TIMEOUT');
static const WifiErrorCode WIFI_ERROR_MODE = WifiErrorCode._(10, _omitEnumNames ? '' : 'WIFI_ERROR_MODE');
static const WifiErrorCode WIFI_ERROR_SSID_INVALID = WifiErrorCode._(11, _omitEnumNames ? '' : 'WIFI_ERROR_SSID_INVALID');
static const $core.List<WifiErrorCode> values = <WifiErrorCode> [
WIFI_ERROR_UNKNOWN,
WIFI_ERROR_NO_MEMORY,
WIFI_ERROR_INVALID_PARAMETERS,
WIFI_ERROR_INVALID_STATE,
WIFI_ERROR_NOT_FOUND,
WIFI_ERROR_NOT_SUPPORTED,
WIFI_ERROR_NOT_ALLOWED,
WIFI_ERROR_NOT_INITIALISED,
WIFI_ERROR_NOT_STARTED,
WIFI_ERROR_TIMEOUT,
WIFI_ERROR_MODE,
WIFI_ERROR_SSID_INVALID,
];
static final $core.Map<$core.int, WifiErrorCode> _byValue = $pb.ProtobufEnum.initByValue(values);
static WifiErrorCode? valueOf($core.int value) => _byValue[value];
const WifiErrorCode._($core.int v, $core.String n) : super(v, n);
}
class InterfaceType extends $pb.ProtobufEnum {
static const InterfaceType INTERFACE_BLE = InterfaceType._(1, _omitEnumNames ? '' : 'INTERFACE_BLE');
static const InterfaceType INTERFACE_ANT = InterfaceType._(2, _omitEnumNames ? '' : 'INTERFACE_ANT');
static const InterfaceType INTERFACE_USB = InterfaceType._(3, _omitEnumNames ? '' : 'INTERFACE_USB');
static const InterfaceType INTERFACE_ETH = InterfaceType._(4, _omitEnumNames ? '' : 'INTERFACE_ETH');
static const InterfaceType INTERFACE_WIFI = InterfaceType._(5, _omitEnumNames ? '' : 'INTERFACE_WIFI');
static const $core.List<InterfaceType> values = <InterfaceType> [
INTERFACE_BLE,
INTERFACE_ANT,
INTERFACE_USB,
INTERFACE_ETH,
INTERFACE_WIFI,
];
static final $core.Map<$core.int, InterfaceType> _byValue = $pb.ProtobufEnum.initByValue(values);
static InterfaceType? valueOf($core.int value) => _byValue[value];
const InterfaceType._($core.int v, $core.String n) : super(v, n);
}
class SensorConnectionStatus extends $pb.ProtobufEnum {
static const SensorConnectionStatus SENSOR_STATUS_DISCOVERED = SensorConnectionStatus._(1, _omitEnumNames ? '' : 'SENSOR_STATUS_DISCOVERED');
static const SensorConnectionStatus SENSOR_STATUS_DISCONNECTED = SensorConnectionStatus._(2, _omitEnumNames ? '' : 'SENSOR_STATUS_DISCONNECTED');
static const SensorConnectionStatus SENSOR_STATUS_PAIRING = SensorConnectionStatus._(3, _omitEnumNames ? '' : 'SENSOR_STATUS_PAIRING');
static const SensorConnectionStatus SENSOR_STATUS_CONNECTED = SensorConnectionStatus._(4, _omitEnumNames ? '' : 'SENSOR_STATUS_CONNECTED');
static const $core.List<SensorConnectionStatus> values = <SensorConnectionStatus> [
SENSOR_STATUS_DISCOVERED,
SENSOR_STATUS_DISCONNECTED,
SENSOR_STATUS_PAIRING,
SENSOR_STATUS_CONNECTED,
];
static final $core.Map<$core.int, SensorConnectionStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static SensorConnectionStatus? valueOf($core.int value) => _byValue[value];
const SensorConnectionStatus._($core.int v, $core.String n) : super(v, n);
}
class BleSecureConnectionStatus extends $pb.ProtobufEnum {
static const BleSecureConnectionStatus BLE_CONNECTION_SECURITY_STATUS_NONE = BleSecureConnectionStatus._(0, _omitEnumNames ? '' : 'BLE_CONNECTION_SECURITY_STATUS_NONE');
static const BleSecureConnectionStatus BLE_CONNECTION_SECURITY_STATUS_INPROGRESS = BleSecureConnectionStatus._(1, _omitEnumNames ? '' : 'BLE_CONNECTION_SECURITY_STATUS_INPROGRESS');
static const BleSecureConnectionStatus BLE_CONNECTION_SECURITY_STATUS_ACTIVE = BleSecureConnectionStatus._(2, _omitEnumNames ? '' : 'BLE_CONNECTION_SECURITY_STATUS_ACTIVE');
static const BleSecureConnectionStatus BLE_CONNECTION_SECURITY_STATUS_REJECTED = BleSecureConnectionStatus._(3, _omitEnumNames ? '' : 'BLE_CONNECTION_SECURITY_STATUS_REJECTED');
static const $core.List<BleSecureConnectionStatus> values = <BleSecureConnectionStatus> [
BLE_CONNECTION_SECURITY_STATUS_NONE,
BLE_CONNECTION_SECURITY_STATUS_INPROGRESS,
BLE_CONNECTION_SECURITY_STATUS_ACTIVE,
BLE_CONNECTION_SECURITY_STATUS_REJECTED,
];
static final $core.Map<$core.int, BleSecureConnectionStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static BleSecureConnectionStatus? valueOf($core.int value) => _byValue[value];
const BleSecureConnectionStatus._($core.int v, $core.String n) : super(v, n);
}
class BleSecureConnectionWindowStatus extends $pb.ProtobufEnum {
static const BleSecureConnectionWindowStatus BLE_SECURE_CONNECTION_WINDOW_STATUS_CLOSED = BleSecureConnectionWindowStatus._(0, _omitEnumNames ? '' : 'BLE_SECURE_CONNECTION_WINDOW_STATUS_CLOSED');
static const BleSecureConnectionWindowStatus BLE_SECURE_CONNECTION_WINDOW_STATUS_OPEN = BleSecureConnectionWindowStatus._(1, _omitEnumNames ? '' : 'BLE_SECURE_CONNECTION_WINDOW_STATUS_OPEN');
static const $core.List<BleSecureConnectionWindowStatus> values = <BleSecureConnectionWindowStatus> [
BLE_SECURE_CONNECTION_WINDOW_STATUS_CLOSED,
BLE_SECURE_CONNECTION_WINDOW_STATUS_OPEN,
];
static final $core.Map<$core.int, BleSecureConnectionWindowStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static BleSecureConnectionWindowStatus? valueOf($core.int value) => _byValue[value];
const BleSecureConnectionWindowStatus._($core.int v, $core.String n) : super(v, n);
}
class WifiRegionCode_RegionCodeType extends $pb.ProtobufEnum {
static const WifiRegionCode_RegionCodeType ALPHA_2 = WifiRegionCode_RegionCodeType._(0, _omitEnumNames ? '' : 'ALPHA_2');
static const WifiRegionCode_RegionCodeType ALPHA_3 = WifiRegionCode_RegionCodeType._(1, _omitEnumNames ? '' : 'ALPHA_3');
static const WifiRegionCode_RegionCodeType NUMERIC = WifiRegionCode_RegionCodeType._(2, _omitEnumNames ? '' : 'NUMERIC');
static const WifiRegionCode_RegionCodeType UNKNOWN = WifiRegionCode_RegionCodeType._(3, _omitEnumNames ? '' : 'UNKNOWN');
static const $core.List<WifiRegionCode_RegionCodeType> values = <WifiRegionCode_RegionCodeType> [
ALPHA_2,
ALPHA_3,
NUMERIC,
UNKNOWN,
];
static final $core.Map<$core.int, WifiRegionCode_RegionCodeType> _byValue = $pb.ProtobufEnum.initByValue(values);
static WifiRegionCode_RegionCodeType? valueOf($core.int value) => _byValue[value];
const WifiRegionCode_RegionCodeType._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +0,0 @@
//
// Generated code. Do not modify.
// source: zp.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
export 'zp.pb.dart';

View File

@@ -1,896 +0,0 @@
//
// Generated code. Do not modify.
// source: zp_vendor.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'zp_vendor.pbenum.dart';
export 'zp_vendor.pbenum.dart';
class ControllerSync extends $pb.GeneratedMessage {
factory ControllerSync({
ControllerSyncStatus? status,
$core.int? timeStamp,
}) {
final $result = create();
if (status != null) {
$result.status = status;
}
if (timeStamp != null) {
$result.timeStamp = timeStamp;
}
return $result;
}
ControllerSync._() : super();
factory ControllerSync.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ControllerSync.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ControllerSync', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..e<ControllerSyncStatus>(1, _omitFieldNames ? '' : 'status', $pb.PbFieldType.OE, defaultOrMaker: ControllerSyncStatus.NOT_CONNECTED, valueOf: ControllerSyncStatus.valueOf, enumValues: ControllerSyncStatus.values)
..a<$core.int>(2, _omitFieldNames ? '' : 'timeStamp', $pb.PbFieldType.O3, protoName: 'timeStamp')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ControllerSync clone() => ControllerSync()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ControllerSync copyWith(void Function(ControllerSync) updates) => super.copyWith((message) => updates(message as ControllerSync)) as ControllerSync;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ControllerSync create() => ControllerSync._();
ControllerSync createEmptyInstance() => create();
static $pb.PbList<ControllerSync> createRepeated() => $pb.PbList<ControllerSync>();
@$core.pragma('dart2js:noInline')
static ControllerSync getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ControllerSync>(create);
static ControllerSync? _defaultInstance;
/// optional in code; proto3 treats as present when non-zero
@$pb.TagNumber(1)
ControllerSyncStatus get status => $_getN(0);
@$pb.TagNumber(1)
set status(ControllerSyncStatus v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasStatus() => $_has(0);
@$pb.TagNumber(1)
void clearStatus() => clearField(1);
@$pb.TagNumber(2)
$core.int get timeStamp => $_getIZ(1);
@$pb.TagNumber(2)
set timeStamp($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasTimeStamp() => $_has(1);
@$pb.TagNumber(2)
void clearTimeStamp() => clearField(2);
}
class EnableTestMode extends $pb.GeneratedMessage {
factory EnableTestMode({
$core.bool? enable,
}) {
final $result = create();
if (enable != null) {
$result.enable = enable;
}
return $result;
}
EnableTestMode._() : super();
factory EnableTestMode.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory EnableTestMode.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'EnableTestMode', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..aOB(1, _omitFieldNames ? '' : 'enable')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
EnableTestMode clone() => EnableTestMode()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
EnableTestMode copyWith(void Function(EnableTestMode) updates) => super.copyWith((message) => updates(message as EnableTestMode)) as EnableTestMode;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static EnableTestMode create() => EnableTestMode._();
EnableTestMode createEmptyInstance() => create();
static $pb.PbList<EnableTestMode> createRepeated() => $pb.PbList<EnableTestMode>();
@$core.pragma('dart2js:noInline')
static EnableTestMode getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<EnableTestMode>(create);
static EnableTestMode? _defaultInstance;
@$pb.TagNumber(1)
$core.bool get enable => $_getBF(0);
@$pb.TagNumber(1)
set enable($core.bool v) { $_setBool(0, v); }
@$pb.TagNumber(1)
$core.bool hasEnable() => $_has(0);
@$pb.TagNumber(1)
void clearEnable() => clearField(1);
}
class PairDevices extends $pb.GeneratedMessage {
factory PairDevices({
$core.bool? pair,
PairDeviceType? type,
$core.List<$core.int>? deviceId,
}) {
final $result = create();
if (pair != null) {
$result.pair = pair;
}
if (type != null) {
$result.type = type;
}
if (deviceId != null) {
$result.deviceId = deviceId;
}
return $result;
}
PairDevices._() : super();
factory PairDevices.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory PairDevices.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PairDevices', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..aOB(1, _omitFieldNames ? '' : 'pair')
..e<PairDeviceType>(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, defaultOrMaker: PairDeviceType.BLE, valueOf: PairDeviceType.valueOf, enumValues: PairDeviceType.values)
..a<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'deviceId', $pb.PbFieldType.OY, protoName: 'deviceId')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
PairDevices clone() => PairDevices()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
PairDevices copyWith(void Function(PairDevices) updates) => super.copyWith((message) => updates(message as PairDevices)) as PairDevices;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static PairDevices create() => PairDevices._();
PairDevices createEmptyInstance() => create();
static $pb.PbList<PairDevices> createRepeated() => $pb.PbList<PairDevices>();
@$core.pragma('dart2js:noInline')
static PairDevices getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PairDevices>(create);
static PairDevices? _defaultInstance;
@$pb.TagNumber(1)
$core.bool get pair => $_getBF(0);
@$pb.TagNumber(1)
set pair($core.bool v) { $_setBool(0, v); }
@$pb.TagNumber(1)
$core.bool hasPair() => $_has(0);
@$pb.TagNumber(1)
void clearPair() => clearField(1);
@$pb.TagNumber(2)
PairDeviceType get type => $_getN(1);
@$pb.TagNumber(2)
set type(PairDeviceType v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasType() => $_has(1);
@$pb.TagNumber(2)
void clearType() => clearField(2);
@$pb.TagNumber(3)
$core.List<$core.int> get deviceId => $_getN(2);
@$pb.TagNumber(3)
set deviceId($core.List<$core.int> v) { $_setBytes(2, v); }
@$pb.TagNumber(3)
$core.bool hasDeviceId() => $_has(2);
@$pb.TagNumber(3)
void clearDeviceId() => clearField(3);
}
class DevicePairingDataPage_PairedDevice extends $pb.GeneratedMessage {
factory DevicePairingDataPage_PairedDevice({
$core.List<$core.int>? device,
}) {
final $result = create();
if (device != null) {
$result.device = device;
}
return $result;
}
DevicePairingDataPage_PairedDevice._() : super();
factory DevicePairingDataPage_PairedDevice.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DevicePairingDataPage_PairedDevice.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DevicePairingDataPage.PairedDevice', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'device', $pb.PbFieldType.OY)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
DevicePairingDataPage_PairedDevice clone() => DevicePairingDataPage_PairedDevice()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
DevicePairingDataPage_PairedDevice copyWith(void Function(DevicePairingDataPage_PairedDevice) updates) => super.copyWith((message) => updates(message as DevicePairingDataPage_PairedDevice)) as DevicePairingDataPage_PairedDevice;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static DevicePairingDataPage_PairedDevice create() => DevicePairingDataPage_PairedDevice._();
DevicePairingDataPage_PairedDevice createEmptyInstance() => create();
static $pb.PbList<DevicePairingDataPage_PairedDevice> createRepeated() => $pb.PbList<DevicePairingDataPage_PairedDevice>();
@$core.pragma('dart2js:noInline')
static DevicePairingDataPage_PairedDevice getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DevicePairingDataPage_PairedDevice>(create);
static DevicePairingDataPage_PairedDevice? _defaultInstance;
@$pb.TagNumber(1)
$core.List<$core.int> get device => $_getN(0);
@$pb.TagNumber(1)
set device($core.List<$core.int> v) { $_setBytes(0, v); }
@$pb.TagNumber(1)
$core.bool hasDevice() => $_has(0);
@$pb.TagNumber(1)
void clearDevice() => clearField(1);
}
class DevicePairingDataPage extends $pb.GeneratedMessage {
factory DevicePairingDataPage({
$core.int? devicesCount,
$core.int? pairingStatus,
$core.Iterable<DevicePairingDataPage_PairedDevice>? pairingDevList,
}) {
final $result = create();
if (devicesCount != null) {
$result.devicesCount = devicesCount;
}
if (pairingStatus != null) {
$result.pairingStatus = pairingStatus;
}
if (pairingDevList != null) {
$result.pairingDevList.addAll(pairingDevList);
}
return $result;
}
DevicePairingDataPage._() : super();
factory DevicePairingDataPage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DevicePairingDataPage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DevicePairingDataPage', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'devicesCount', $pb.PbFieldType.O3, protoName: 'devicesCount')
..a<$core.int>(2, _omitFieldNames ? '' : 'pairingStatus', $pb.PbFieldType.O3, protoName: 'pairingStatus')
..pc<DevicePairingDataPage_PairedDevice>(3, _omitFieldNames ? '' : 'pairingDevList', $pb.PbFieldType.PM, protoName: 'pairingDevList', subBuilder: DevicePairingDataPage_PairedDevice.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
DevicePairingDataPage clone() => DevicePairingDataPage()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
DevicePairingDataPage copyWith(void Function(DevicePairingDataPage) updates) => super.copyWith((message) => updates(message as DevicePairingDataPage)) as DevicePairingDataPage;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static DevicePairingDataPage create() => DevicePairingDataPage._();
DevicePairingDataPage createEmptyInstance() => create();
static $pb.PbList<DevicePairingDataPage> createRepeated() => $pb.PbList<DevicePairingDataPage>();
@$core.pragma('dart2js:noInline')
static DevicePairingDataPage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DevicePairingDataPage>(create);
static DevicePairingDataPage? _defaultInstance;
@$pb.TagNumber(1)
$core.int get devicesCount => $_getIZ(0);
@$pb.TagNumber(1)
set devicesCount($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasDevicesCount() => $_has(0);
@$pb.TagNumber(1)
void clearDevicesCount() => clearField(1);
@$pb.TagNumber(2)
$core.int get pairingStatus => $_getIZ(1);
@$pb.TagNumber(2)
set pairingStatus($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasPairingStatus() => $_has(1);
@$pb.TagNumber(2)
void clearPairingStatus() => clearField(2);
@$pb.TagNumber(3)
$core.List<DevicePairingDataPage_PairedDevice> get pairingDevList => $_getList(2);
}
enum SetDfuTest_TestCase {
failedEnterDfu,
failedStartAdvertising,
crcFailure,
notSet
}
class SetDfuTest extends $pb.GeneratedMessage {
factory SetDfuTest({
$core.bool? failedEnterDfu,
$core.bool? failedStartAdvertising,
$core.int? crcFailure,
}) {
final $result = create();
if (failedEnterDfu != null) {
$result.failedEnterDfu = failedEnterDfu;
}
if (failedStartAdvertising != null) {
$result.failedStartAdvertising = failedStartAdvertising;
}
if (crcFailure != null) {
$result.crcFailure = crcFailure;
}
return $result;
}
SetDfuTest._() : super();
factory SetDfuTest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetDfuTest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static const $core.Map<$core.int, SetDfuTest_TestCase> _SetDfuTest_TestCaseByTag = {
1 : SetDfuTest_TestCase.failedEnterDfu,
2 : SetDfuTest_TestCase.failedStartAdvertising,
3 : SetDfuTest_TestCase.crcFailure,
0 : SetDfuTest_TestCase.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetDfuTest', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..oo(0, [1, 2, 3])
..aOB(1, _omitFieldNames ? '' : 'failedEnterDfu', protoName: 'failedEnterDfu')
..aOB(2, _omitFieldNames ? '' : 'failedStartAdvertising', protoName: 'failedStartAdvertising')
..a<$core.int>(3, _omitFieldNames ? '' : 'crcFailure', $pb.PbFieldType.O3, protoName: 'crcFailure')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetDfuTest clone() => SetDfuTest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetDfuTest copyWith(void Function(SetDfuTest) updates) => super.copyWith((message) => updates(message as SetDfuTest)) as SetDfuTest;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetDfuTest create() => SetDfuTest._();
SetDfuTest createEmptyInstance() => create();
static $pb.PbList<SetDfuTest> createRepeated() => $pb.PbList<SetDfuTest>();
@$core.pragma('dart2js:noInline')
static SetDfuTest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetDfuTest>(create);
static SetDfuTest? _defaultInstance;
SetDfuTest_TestCase whichTestCase() => _SetDfuTest_TestCaseByTag[$_whichOneof(0)]!;
void clearTestCase() => clearField($_whichOneof(0));
@$pb.TagNumber(1)
$core.bool get failedEnterDfu => $_getBF(0);
@$pb.TagNumber(1)
set failedEnterDfu($core.bool v) { $_setBool(0, v); }
@$pb.TagNumber(1)
$core.bool hasFailedEnterDfu() => $_has(0);
@$pb.TagNumber(1)
void clearFailedEnterDfu() => clearField(1);
@$pb.TagNumber(2)
$core.bool get failedStartAdvertising => $_getBF(1);
@$pb.TagNumber(2)
set failedStartAdvertising($core.bool v) { $_setBool(1, v); }
@$pb.TagNumber(2)
$core.bool hasFailedStartAdvertising() => $_has(1);
@$pb.TagNumber(2)
void clearFailedStartAdvertising() => clearField(2);
@$pb.TagNumber(3)
$core.int get crcFailure => $_getIZ(2);
@$pb.TagNumber(3)
set crcFailure($core.int v) { $_setSignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasCrcFailure() => $_has(2);
@$pb.TagNumber(3)
void clearCrcFailure() => clearField(3);
}
class SetGearTestData extends $pb.GeneratedMessage {
factory SetGearTestData({
$core.int? frontGearIdx,
$core.int? rearGearIdx,
}) {
final $result = create();
if (frontGearIdx != null) {
$result.frontGearIdx = frontGearIdx;
}
if (rearGearIdx != null) {
$result.rearGearIdx = rearGearIdx;
}
return $result;
}
SetGearTestData._() : super();
factory SetGearTestData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetGearTestData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetGearTestData', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'frontGearIdx', $pb.PbFieldType.O3, protoName: 'frontGearIdx')
..a<$core.int>(2, _omitFieldNames ? '' : 'rearGearIdx', $pb.PbFieldType.O3, protoName: 'rearGearIdx')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetGearTestData clone() => SetGearTestData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetGearTestData copyWith(void Function(SetGearTestData) updates) => super.copyWith((message) => updates(message as SetGearTestData)) as SetGearTestData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetGearTestData create() => SetGearTestData._();
SetGearTestData createEmptyInstance() => create();
static $pb.PbList<SetGearTestData> createRepeated() => $pb.PbList<SetGearTestData>();
@$core.pragma('dart2js:noInline')
static SetGearTestData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetGearTestData>(create);
static SetGearTestData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get frontGearIdx => $_getIZ(0);
@$pb.TagNumber(1)
set frontGearIdx($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasFrontGearIdx() => $_has(0);
@$pb.TagNumber(1)
void clearFrontGearIdx() => clearField(1);
@$pb.TagNumber(2)
$core.int get rearGearIdx => $_getIZ(1);
@$pb.TagNumber(2)
set rearGearIdx($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasRearGearIdx() => $_has(1);
@$pb.TagNumber(2)
void clearRearGearIdx() => clearField(2);
}
class SetHrmTestData extends $pb.GeneratedMessage {
factory SetHrmTestData({
$core.bool? hrmPresent,
$core.int? heartRate,
}) {
final $result = create();
if (hrmPresent != null) {
$result.hrmPresent = hrmPresent;
}
if (heartRate != null) {
$result.heartRate = heartRate;
}
return $result;
}
SetHrmTestData._() : super();
factory SetHrmTestData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetHrmTestData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetHrmTestData', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..aOB(1, _omitFieldNames ? '' : 'hrmPresent', protoName: 'hrmPresent')
..a<$core.int>(2, _omitFieldNames ? '' : 'heartRate', $pb.PbFieldType.O3, protoName: 'heartRate')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetHrmTestData clone() => SetHrmTestData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetHrmTestData copyWith(void Function(SetHrmTestData) updates) => super.copyWith((message) => updates(message as SetHrmTestData)) as SetHrmTestData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetHrmTestData create() => SetHrmTestData._();
SetHrmTestData createEmptyInstance() => create();
static $pb.PbList<SetHrmTestData> createRepeated() => $pb.PbList<SetHrmTestData>();
@$core.pragma('dart2js:noInline')
static SetHrmTestData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetHrmTestData>(create);
static SetHrmTestData? _defaultInstance;
@$pb.TagNumber(1)
$core.bool get hrmPresent => $_getBF(0);
@$pb.TagNumber(1)
set hrmPresent($core.bool v) { $_setBool(0, v); }
@$pb.TagNumber(1)
$core.bool hasHrmPresent() => $_has(0);
@$pb.TagNumber(1)
void clearHrmPresent() => clearField(1);
@$pb.TagNumber(2)
$core.int get heartRate => $_getIZ(1);
@$pb.TagNumber(2)
set heartRate($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasHeartRate() => $_has(1);
@$pb.TagNumber(2)
void clearHeartRate() => clearField(2);
}
class SetInputDeviceTestData_ControllerAnalogEvent extends $pb.GeneratedMessage {
factory SetInputDeviceTestData_ControllerAnalogEvent({
$core.int? sensorId,
$core.int? value,
}) {
final $result = create();
if (sensorId != null) {
$result.sensorId = sensorId;
}
if (value != null) {
$result.value = value;
}
return $result;
}
SetInputDeviceTestData_ControllerAnalogEvent._() : super();
factory SetInputDeviceTestData_ControllerAnalogEvent.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetInputDeviceTestData_ControllerAnalogEvent.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetInputDeviceTestData.ControllerAnalogEvent', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'sensorId', $pb.PbFieldType.O3, protoName: 'sensorId')
..a<$core.int>(2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.O3)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetInputDeviceTestData_ControllerAnalogEvent clone() => SetInputDeviceTestData_ControllerAnalogEvent()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetInputDeviceTestData_ControllerAnalogEvent copyWith(void Function(SetInputDeviceTestData_ControllerAnalogEvent) updates) => super.copyWith((message) => updates(message as SetInputDeviceTestData_ControllerAnalogEvent)) as SetInputDeviceTestData_ControllerAnalogEvent;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetInputDeviceTestData_ControllerAnalogEvent create() => SetInputDeviceTestData_ControllerAnalogEvent._();
SetInputDeviceTestData_ControllerAnalogEvent createEmptyInstance() => create();
static $pb.PbList<SetInputDeviceTestData_ControllerAnalogEvent> createRepeated() => $pb.PbList<SetInputDeviceTestData_ControllerAnalogEvent>();
@$core.pragma('dart2js:noInline')
static SetInputDeviceTestData_ControllerAnalogEvent getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetInputDeviceTestData_ControllerAnalogEvent>(create);
static SetInputDeviceTestData_ControllerAnalogEvent? _defaultInstance;
@$pb.TagNumber(1)
$core.int get sensorId => $_getIZ(0);
@$pb.TagNumber(1)
set sensorId($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasSensorId() => $_has(0);
@$pb.TagNumber(1)
void clearSensorId() => clearField(1);
@$pb.TagNumber(2)
$core.int get value => $_getIZ(1);
@$pb.TagNumber(2)
set value($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasValue() => $_has(1);
@$pb.TagNumber(2)
void clearValue() => clearField(2);
}
class SetInputDeviceTestData extends $pb.GeneratedMessage {
factory SetInputDeviceTestData({
$core.int? duration,
$core.int? buttonEvent,
$core.Iterable<SetInputDeviceTestData_ControllerAnalogEvent>? analogEventList,
}) {
final $result = create();
if (duration != null) {
$result.duration = duration;
}
if (buttonEvent != null) {
$result.buttonEvent = buttonEvent;
}
if (analogEventList != null) {
$result.analogEventList.addAll(analogEventList);
}
return $result;
}
SetInputDeviceTestData._() : super();
factory SetInputDeviceTestData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetInputDeviceTestData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetInputDeviceTestData', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'duration', $pb.PbFieldType.O3)
..a<$core.int>(2, _omitFieldNames ? '' : 'buttonEvent', $pb.PbFieldType.O3, protoName: 'buttonEvent')
..pc<SetInputDeviceTestData_ControllerAnalogEvent>(3, _omitFieldNames ? '' : 'analogEventList', $pb.PbFieldType.PM, protoName: 'analogEventList', subBuilder: SetInputDeviceTestData_ControllerAnalogEvent.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetInputDeviceTestData clone() => SetInputDeviceTestData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetInputDeviceTestData copyWith(void Function(SetInputDeviceTestData) updates) => super.copyWith((message) => updates(message as SetInputDeviceTestData)) as SetInputDeviceTestData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetInputDeviceTestData create() => SetInputDeviceTestData._();
SetInputDeviceTestData createEmptyInstance() => create();
static $pb.PbList<SetInputDeviceTestData> createRepeated() => $pb.PbList<SetInputDeviceTestData>();
@$core.pragma('dart2js:noInline')
static SetInputDeviceTestData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetInputDeviceTestData>(create);
static SetInputDeviceTestData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get duration => $_getIZ(0);
@$pb.TagNumber(1)
set duration($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasDuration() => $_has(0);
@$pb.TagNumber(1)
void clearDuration() => clearField(1);
@$pb.TagNumber(2)
$core.int get buttonEvent => $_getIZ(1);
@$pb.TagNumber(2)
set buttonEvent($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasButtonEvent() => $_has(1);
@$pb.TagNumber(2)
void clearButtonEvent() => clearField(2);
@$pb.TagNumber(3)
$core.List<SetInputDeviceTestData_ControllerAnalogEvent> get analogEventList => $_getList(2);
}
class SetTrainerTestData extends $pb.GeneratedMessage {
factory SetTrainerTestData({
$core.int? dataMode,
$core.int? interfaces,
TestTrainerData? testTrainerData,
}) {
final $result = create();
if (dataMode != null) {
$result.dataMode = dataMode;
}
if (interfaces != null) {
$result.interfaces = interfaces;
}
if (testTrainerData != null) {
$result.testTrainerData = testTrainerData;
}
return $result;
}
SetTrainerTestData._() : super();
factory SetTrainerTestData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SetTrainerTestData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SetTrainerTestData', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'dataMode', $pb.PbFieldType.O3, protoName: 'dataMode')
..a<$core.int>(2, _omitFieldNames ? '' : 'interfaces', $pb.PbFieldType.O3)
..aOM<TestTrainerData>(3, _omitFieldNames ? '' : 'testTrainerData', protoName: 'testTrainerData', subBuilder: TestTrainerData.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SetTrainerTestData clone() => SetTrainerTestData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SetTrainerTestData copyWith(void Function(SetTrainerTestData) updates) => super.copyWith((message) => updates(message as SetTrainerTestData)) as SetTrainerTestData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SetTrainerTestData create() => SetTrainerTestData._();
SetTrainerTestData createEmptyInstance() => create();
static $pb.PbList<SetTrainerTestData> createRepeated() => $pb.PbList<SetTrainerTestData>();
@$core.pragma('dart2js:noInline')
static SetTrainerTestData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetTrainerTestData>(create);
static SetTrainerTestData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get dataMode => $_getIZ(0);
@$pb.TagNumber(1)
set dataMode($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasDataMode() => $_has(0);
@$pb.TagNumber(1)
void clearDataMode() => clearField(1);
@$pb.TagNumber(2)
$core.int get interfaces => $_getIZ(1);
@$pb.TagNumber(2)
set interfaces($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasInterfaces() => $_has(1);
@$pb.TagNumber(2)
void clearInterfaces() => clearField(2);
@$pb.TagNumber(3)
TestTrainerData get testTrainerData => $_getN(2);
@$pb.TagNumber(3)
set testTrainerData(TestTrainerData v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasTestTrainerData() => $_has(2);
@$pb.TagNumber(3)
void clearTestTrainerData() => clearField(3);
@$pb.TagNumber(3)
TestTrainerData ensureTestTrainerData() => $_ensure(2);
}
class TestTrainerData extends $pb.GeneratedMessage {
factory TestTrainerData({
$core.int? power,
$core.int? cadence,
$core.int? bikeSpeed,
$core.int? averagedPower,
$core.int? wheelSpeed,
$core.int? calculatedRealGearRatio,
}) {
final $result = create();
if (power != null) {
$result.power = power;
}
if (cadence != null) {
$result.cadence = cadence;
}
if (bikeSpeed != null) {
$result.bikeSpeed = bikeSpeed;
}
if (averagedPower != null) {
$result.averagedPower = averagedPower;
}
if (wheelSpeed != null) {
$result.wheelSpeed = wheelSpeed;
}
if (calculatedRealGearRatio != null) {
$result.calculatedRealGearRatio = calculatedRealGearRatio;
}
return $result;
}
TestTrainerData._() : super();
factory TestTrainerData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory TestTrainerData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'TestTrainerData', package: const $pb.PackageName(_omitMessageNames ? '' : 'com.zwift.protobuf'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'power', $pb.PbFieldType.O3)
..a<$core.int>(2, _omitFieldNames ? '' : 'cadence', $pb.PbFieldType.O3)
..a<$core.int>(3, _omitFieldNames ? '' : 'bikeSpeed', $pb.PbFieldType.O3, protoName: 'bikeSpeed')
..a<$core.int>(4, _omitFieldNames ? '' : 'averagedPower', $pb.PbFieldType.O3, protoName: 'averagedPower')
..a<$core.int>(5, _omitFieldNames ? '' : 'wheelSpeed', $pb.PbFieldType.O3, protoName: 'wheelSpeed')
..a<$core.int>(6, _omitFieldNames ? '' : 'calculatedRealGearRatio', $pb.PbFieldType.O3, protoName: 'calculatedRealGearRatio')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
TestTrainerData clone() => TestTrainerData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
TestTrainerData copyWith(void Function(TestTrainerData) updates) => super.copyWith((message) => updates(message as TestTrainerData)) as TestTrainerData;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static TestTrainerData create() => TestTrainerData._();
TestTrainerData createEmptyInstance() => create();
static $pb.PbList<TestTrainerData> createRepeated() => $pb.PbList<TestTrainerData>();
@$core.pragma('dart2js:noInline')
static TestTrainerData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TestTrainerData>(create);
static TestTrainerData? _defaultInstance;
@$pb.TagNumber(1)
$core.int get power => $_getIZ(0);
@$pb.TagNumber(1)
set power($core.int v) { $_setSignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasPower() => $_has(0);
@$pb.TagNumber(1)
void clearPower() => clearField(1);
@$pb.TagNumber(2)
$core.int get cadence => $_getIZ(1);
@$pb.TagNumber(2)
set cadence($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasCadence() => $_has(1);
@$pb.TagNumber(2)
void clearCadence() => clearField(2);
@$pb.TagNumber(3)
$core.int get bikeSpeed => $_getIZ(2);
@$pb.TagNumber(3)
set bikeSpeed($core.int v) { $_setSignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasBikeSpeed() => $_has(2);
@$pb.TagNumber(3)
void clearBikeSpeed() => clearField(3);
@$pb.TagNumber(4)
$core.int get averagedPower => $_getIZ(3);
@$pb.TagNumber(4)
set averagedPower($core.int v) { $_setSignedInt32(3, v); }
@$pb.TagNumber(4)
$core.bool hasAveragedPower() => $_has(3);
@$pb.TagNumber(4)
void clearAveragedPower() => clearField(4);
@$pb.TagNumber(5)
$core.int get wheelSpeed => $_getIZ(4);
@$pb.TagNumber(5)
set wheelSpeed($core.int v) { $_setSignedInt32(4, v); }
@$pb.TagNumber(5)
$core.bool hasWheelSpeed() => $_has(4);
@$pb.TagNumber(5)
void clearWheelSpeed() => clearField(5);
@$pb.TagNumber(6)
$core.int get calculatedRealGearRatio => $_getIZ(5);
@$pb.TagNumber(6)
set calculatedRealGearRatio($core.int v) { $_setSignedInt32(5, v); }
@$pb.TagNumber(6)
$core.bool hasCalculatedRealGearRatio() => $_has(5);
@$pb.TagNumber(6)
void clearCalculatedRealGearRatio() => clearField(6);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@@ -1,101 +0,0 @@
//
// Generated code. Do not modify.
// source: zp_vendor.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class VendorOpcode extends $pb.ProtobufEnum {
static const VendorOpcode UNDEFINED = VendorOpcode._(0, _omitEnumNames ? '' : 'UNDEFINED');
static const VendorOpcode CONTROLLER_SYNC = VendorOpcode._(1, _omitEnumNames ? '' : 'CONTROLLER_SYNC');
static const VendorOpcode PAIR_DEVICES = VendorOpcode._(2, _omitEnumNames ? '' : 'PAIR_DEVICES');
static const VendorOpcode ENABLE_TEST_MODE = VendorOpcode._(65280, _omitEnumNames ? '' : 'ENABLE_TEST_MODE');
static const VendorOpcode SET_DFU_TEST = VendorOpcode._(65281, _omitEnumNames ? '' : 'SET_DFU_TEST');
static const VendorOpcode SET_TRAINER_TEST_DATA = VendorOpcode._(65282, _omitEnumNames ? '' : 'SET_TRAINER_TEST_DATA');
static const VendorOpcode SET_INPUT_DEVICE_TEST_DATA = VendorOpcode._(65283, _omitEnumNames ? '' : 'SET_INPUT_DEVICE_TEST_DATA');
static const VendorOpcode SET_GEAR_TEST_DATA = VendorOpcode._(65284, _omitEnumNames ? '' : 'SET_GEAR_TEST_DATA');
static const VendorOpcode SET_HRM_TEST_DATA = VendorOpcode._(65285, _omitEnumNames ? '' : 'SET_HRM_TEST_DATA');
static const VendorOpcode SET_TEST_DATA = VendorOpcode._(65286, _omitEnumNames ? '' : 'SET_TEST_DATA');
static const $core.List<VendorOpcode> values = <VendorOpcode> [
UNDEFINED,
CONTROLLER_SYNC,
PAIR_DEVICES,
ENABLE_TEST_MODE,
SET_DFU_TEST,
SET_TRAINER_TEST_DATA,
SET_INPUT_DEVICE_TEST_DATA,
SET_GEAR_TEST_DATA,
SET_HRM_TEST_DATA,
SET_TEST_DATA,
];
static final $core.Map<$core.int, VendorOpcode> _byValue = $pb.ProtobufEnum.initByValue(values);
static VendorOpcode? valueOf($core.int value) => _byValue[value];
const VendorOpcode._($core.int v, $core.String n) : super(v, n);
}
class PairDeviceType extends $pb.ProtobufEnum {
static const PairDeviceType BLE = PairDeviceType._(0, _omitEnumNames ? '' : 'BLE');
static const PairDeviceType ANT = PairDeviceType._(1, _omitEnumNames ? '' : 'ANT');
static const $core.List<PairDeviceType> values = <PairDeviceType> [
BLE,
ANT,
];
static final $core.Map<$core.int, PairDeviceType> _byValue = $pb.ProtobufEnum.initByValue(values);
static PairDeviceType? valueOf($core.int value) => _byValue[value];
const PairDeviceType._($core.int v, $core.String n) : super(v, n);
}
/// Status used by ControllerSync
class ControllerSyncStatus extends $pb.ProtobufEnum {
static const ControllerSyncStatus NOT_CONNECTED = ControllerSyncStatus._(0, _omitEnumNames ? '' : 'NOT_CONNECTED');
static const ControllerSyncStatus CONNECTED = ControllerSyncStatus._(1, _omitEnumNames ? '' : 'CONNECTED');
static const $core.List<ControllerSyncStatus> values = <ControllerSyncStatus> [
NOT_CONNECTED,
CONNECTED,
];
static final $core.Map<$core.int, ControllerSyncStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static ControllerSyncStatus? valueOf($core.int value) => _byValue[value];
const ControllerSyncStatus._($core.int v, $core.String n) : super(v, n);
}
/// Looks like “data object / page” IDs used with pairing pages
class VendorDO extends $pb.ProtobufEnum {
static const VendorDO NO_CLUE = VendorDO._(0, _omitEnumNames ? '' : 'NO_CLUE');
static const VendorDO PAGE_DEVICE_PAIRING = VendorDO._(61440, _omitEnumNames ? '' : 'PAGE_DEVICE_PAIRING');
static const VendorDO DEVICE_COUNT = VendorDO._(61441, _omitEnumNames ? '' : 'DEVICE_COUNT');
static const VendorDO PAIRING_STATUS = VendorDO._(61442, _omitEnumNames ? '' : 'PAIRING_STATUS');
static const VendorDO PAIRED_DEVICE = VendorDO._(61443, _omitEnumNames ? '' : 'PAIRED_DEVICE');
static const $core.List<VendorDO> values = <VendorDO> [
NO_CLUE,
PAGE_DEVICE_PAIRING,
DEVICE_COUNT,
PAIRING_STATUS,
PAIRED_DEVICE,
];
static final $core.Map<$core.int, VendorDO> _byValue = $pb.ProtobufEnum.initByValue(values);
static VendorDO? valueOf($core.int value) => _byValue[value];
const VendorDO._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@@ -1,267 +0,0 @@
//
// Generated code. Do not modify.
// source: zp_vendor.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use vendorOpcodeDescriptor instead')
const VendorOpcode$json = {
'1': 'VendorOpcode',
'2': [
{'1': 'UNDEFINED', '2': 0},
{'1': 'CONTROLLER_SYNC', '2': 1},
{'1': 'PAIR_DEVICES', '2': 2},
{'1': 'ENABLE_TEST_MODE', '2': 65280},
{'1': 'SET_DFU_TEST', '2': 65281},
{'1': 'SET_TRAINER_TEST_DATA', '2': 65282},
{'1': 'SET_INPUT_DEVICE_TEST_DATA', '2': 65283},
{'1': 'SET_GEAR_TEST_DATA', '2': 65284},
{'1': 'SET_HRM_TEST_DATA', '2': 65285},
{'1': 'SET_TEST_DATA', '2': 65286},
],
};
/// Descriptor for `VendorOpcode`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List vendorOpcodeDescriptor = $convert.base64Decode(
'CgxWZW5kb3JPcGNvZGUSDQoJVU5ERUZJTkVEEAASEwoPQ09OVFJPTExFUl9TWU5DEAESEAoMUE'
'FJUl9ERVZJQ0VTEAISFgoQRU5BQkxFX1RFU1RfTU9ERRCA/gMSEgoMU0VUX0RGVV9URVNUEIH+'
'AxIbChVTRVRfVFJBSU5FUl9URVNUX0RBVEEQgv4DEiAKGlNFVF9JTlBVVF9ERVZJQ0VfVEVTVF'
'9EQVRBEIP+AxIYChJTRVRfR0VBUl9URVNUX0RBVEEQhP4DEhcKEVNFVF9IUk1fVEVTVF9EQVRB'
'EIX+AxITCg1TRVRfVEVTVF9EQVRBEIb+Aw==');
@$core.Deprecated('Use pairDeviceTypeDescriptor instead')
const PairDeviceType$json = {
'1': 'PairDeviceType',
'2': [
{'1': 'BLE', '2': 0},
{'1': 'ANT', '2': 1},
],
};
/// Descriptor for `PairDeviceType`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List pairDeviceTypeDescriptor = $convert.base64Decode(
'Cg5QYWlyRGV2aWNlVHlwZRIHCgNCTEUQABIHCgNBTlQQAQ==');
@$core.Deprecated('Use controllerSyncStatusDescriptor instead')
const ControllerSyncStatus$json = {
'1': 'ControllerSyncStatus',
'2': [
{'1': 'NOT_CONNECTED', '2': 0},
{'1': 'CONNECTED', '2': 1},
],
};
/// Descriptor for `ControllerSyncStatus`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List controllerSyncStatusDescriptor = $convert.base64Decode(
'ChRDb250cm9sbGVyU3luY1N0YXR1cxIRCg1OT1RfQ09OTkVDVEVEEAASDQoJQ09OTkVDVEVEEA'
'E=');
@$core.Deprecated('Use vendorDODescriptor instead')
const VendorDO$json = {
'1': 'VendorDO',
'2': [
{'1': 'NO_CLUE', '2': 0},
{'1': 'PAGE_DEVICE_PAIRING', '2': 61440},
{'1': 'DEVICE_COUNT', '2': 61441},
{'1': 'PAIRING_STATUS', '2': 61442},
{'1': 'PAIRED_DEVICE', '2': 61443},
],
};
/// Descriptor for `VendorDO`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List vendorDODescriptor = $convert.base64Decode(
'CghWZW5kb3JETxILCgdOT19DTFVFEAASGQoTUEFHRV9ERVZJQ0VfUEFJUklORxCA4AMSEgoMRE'
'VWSUNFX0NPVU5UEIHgAxIUCg5QQUlSSU5HX1NUQVRVUxCC4AMSEwoNUEFJUkVEX0RFVklDRRCD'
'4AM=');
@$core.Deprecated('Use controllerSyncDescriptor instead')
const ControllerSync$json = {
'1': 'ControllerSync',
'2': [
{'1': 'status', '3': 1, '4': 1, '5': 14, '6': '.com.zwift.protobuf.ControllerSyncStatus', '10': 'status'},
{'1': 'timeStamp', '3': 2, '4': 1, '5': 5, '10': 'timeStamp'},
],
};
/// Descriptor for `ControllerSync`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List controllerSyncDescriptor = $convert.base64Decode(
'Cg5Db250cm9sbGVyU3luYxJACgZzdGF0dXMYASABKA4yKC5jb20uendpZnQucHJvdG9idWYuQ2'
'9udHJvbGxlclN5bmNTdGF0dXNSBnN0YXR1cxIcCgl0aW1lU3RhbXAYAiABKAVSCXRpbWVTdGFt'
'cA==');
@$core.Deprecated('Use enableTestModeDescriptor instead')
const EnableTestMode$json = {
'1': 'EnableTestMode',
'2': [
{'1': 'enable', '3': 1, '4': 1, '5': 8, '10': 'enable'},
],
};
/// Descriptor for `EnableTestMode`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List enableTestModeDescriptor = $convert.base64Decode(
'Cg5FbmFibGVUZXN0TW9kZRIWCgZlbmFibGUYASABKAhSBmVuYWJsZQ==');
@$core.Deprecated('Use pairDevicesDescriptor instead')
const PairDevices$json = {
'1': 'PairDevices',
'2': [
{'1': 'pair', '3': 1, '4': 1, '5': 8, '10': 'pair'},
{'1': 'type', '3': 2, '4': 1, '5': 14, '6': '.com.zwift.protobuf.PairDeviceType', '10': 'type'},
{'1': 'deviceId', '3': 3, '4': 1, '5': 12, '10': 'deviceId'},
],
};
/// Descriptor for `PairDevices`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List pairDevicesDescriptor = $convert.base64Decode(
'CgtQYWlyRGV2aWNlcxISCgRwYWlyGAEgASgIUgRwYWlyEjYKBHR5cGUYAiABKA4yIi5jb20uen'
'dpZnQucHJvdG9idWYuUGFpckRldmljZVR5cGVSBHR5cGUSGgoIZGV2aWNlSWQYAyABKAxSCGRl'
'dmljZUlk');
@$core.Deprecated('Use devicePairingDataPageDescriptor instead')
const DevicePairingDataPage$json = {
'1': 'DevicePairingDataPage',
'2': [
{'1': 'devicesCount', '3': 1, '4': 1, '5': 5, '10': 'devicesCount'},
{'1': 'pairingStatus', '3': 2, '4': 1, '5': 5, '10': 'pairingStatus'},
{'1': 'pairingDevList', '3': 3, '4': 3, '5': 11, '6': '.com.zwift.protobuf.DevicePairingDataPage.PairedDevice', '10': 'pairingDevList'},
],
'3': [DevicePairingDataPage_PairedDevice$json],
};
@$core.Deprecated('Use devicePairingDataPageDescriptor instead')
const DevicePairingDataPage_PairedDevice$json = {
'1': 'PairedDevice',
'2': [
{'1': 'device', '3': 1, '4': 1, '5': 12, '10': 'device'},
],
};
/// Descriptor for `DevicePairingDataPage`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List devicePairingDataPageDescriptor = $convert.base64Decode(
'ChVEZXZpY2VQYWlyaW5nRGF0YVBhZ2USIgoMZGV2aWNlc0NvdW50GAEgASgFUgxkZXZpY2VzQ2'
'91bnQSJAoNcGFpcmluZ1N0YXR1cxgCIAEoBVINcGFpcmluZ1N0YXR1cxJeCg5wYWlyaW5nRGV2'
'TGlzdBgDIAMoCzI2LmNvbS56d2lmdC5wcm90b2J1Zi5EZXZpY2VQYWlyaW5nRGF0YVBhZ2UuUG'
'FpcmVkRGV2aWNlUg5wYWlyaW5nRGV2TGlzdBomCgxQYWlyZWREZXZpY2USFgoGZGV2aWNlGAEg'
'ASgMUgZkZXZpY2U=');
@$core.Deprecated('Use setDfuTestDescriptor instead')
const SetDfuTest$json = {
'1': 'SetDfuTest',
'2': [
{'1': 'failedEnterDfu', '3': 1, '4': 1, '5': 8, '9': 0, '10': 'failedEnterDfu'},
{'1': 'failedStartAdvertising', '3': 2, '4': 1, '5': 8, '9': 0, '10': 'failedStartAdvertising'},
{'1': 'crcFailure', '3': 3, '4': 1, '5': 5, '9': 0, '10': 'crcFailure'},
],
'8': [
{'1': 'test_case'},
],
};
/// Descriptor for `SetDfuTest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List setDfuTestDescriptor = $convert.base64Decode(
'CgpTZXREZnVUZXN0EigKDmZhaWxlZEVudGVyRGZ1GAEgASgISABSDmZhaWxlZEVudGVyRGZ1Ej'
'gKFmZhaWxlZFN0YXJ0QWR2ZXJ0aXNpbmcYAiABKAhIAFIWZmFpbGVkU3RhcnRBZHZlcnRpc2lu'
'ZxIgCgpjcmNGYWlsdXJlGAMgASgFSABSCmNyY0ZhaWx1cmVCCwoJdGVzdF9jYXNl');
@$core.Deprecated('Use setGearTestDataDescriptor instead')
const SetGearTestData$json = {
'1': 'SetGearTestData',
'2': [
{'1': 'frontGearIdx', '3': 1, '4': 1, '5': 5, '10': 'frontGearIdx'},
{'1': 'rearGearIdx', '3': 2, '4': 1, '5': 5, '10': 'rearGearIdx'},
],
};
/// Descriptor for `SetGearTestData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List setGearTestDataDescriptor = $convert.base64Decode(
'Cg9TZXRHZWFyVGVzdERhdGESIgoMZnJvbnRHZWFySWR4GAEgASgFUgxmcm9udEdlYXJJZHgSIA'
'oLcmVhckdlYXJJZHgYAiABKAVSC3JlYXJHZWFySWR4');
@$core.Deprecated('Use setHrmTestDataDescriptor instead')
const SetHrmTestData$json = {
'1': 'SetHrmTestData',
'2': [
{'1': 'hrmPresent', '3': 1, '4': 1, '5': 8, '10': 'hrmPresent'},
{'1': 'heartRate', '3': 2, '4': 1, '5': 5, '10': 'heartRate'},
],
};
/// Descriptor for `SetHrmTestData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List setHrmTestDataDescriptor = $convert.base64Decode(
'Cg5TZXRIcm1UZXN0RGF0YRIeCgpocm1QcmVzZW50GAEgASgIUgpocm1QcmVzZW50EhwKCWhlYX'
'J0UmF0ZRgCIAEoBVIJaGVhcnRSYXRl');
@$core.Deprecated('Use setInputDeviceTestDataDescriptor instead')
const SetInputDeviceTestData$json = {
'1': 'SetInputDeviceTestData',
'2': [
{'1': 'duration', '3': 1, '4': 1, '5': 5, '10': 'duration'},
{'1': 'buttonEvent', '3': 2, '4': 1, '5': 5, '10': 'buttonEvent'},
{'1': 'analogEventList', '3': 3, '4': 3, '5': 11, '6': '.com.zwift.protobuf.SetInputDeviceTestData.ControllerAnalogEvent', '10': 'analogEventList'},
],
'3': [SetInputDeviceTestData_ControllerAnalogEvent$json],
};
@$core.Deprecated('Use setInputDeviceTestDataDescriptor instead')
const SetInputDeviceTestData_ControllerAnalogEvent$json = {
'1': 'ControllerAnalogEvent',
'2': [
{'1': 'sensorId', '3': 1, '4': 1, '5': 5, '10': 'sensorId'},
{'1': 'value', '3': 2, '4': 1, '5': 5, '10': 'value'},
],
};
/// Descriptor for `SetInputDeviceTestData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List setInputDeviceTestDataDescriptor = $convert.base64Decode(
'ChZTZXRJbnB1dERldmljZVRlc3REYXRhEhoKCGR1cmF0aW9uGAEgASgFUghkdXJhdGlvbhIgCg'
'tidXR0b25FdmVudBgCIAEoBVILYnV0dG9uRXZlbnQSagoPYW5hbG9nRXZlbnRMaXN0GAMgAygL'
'MkAuY29tLnp3aWZ0LnByb3RvYnVmLlNldElucHV0RGV2aWNlVGVzdERhdGEuQ29udHJvbGxlck'
'FuYWxvZ0V2ZW50Ug9hbmFsb2dFdmVudExpc3QaSQoVQ29udHJvbGxlckFuYWxvZ0V2ZW50EhoK'
'CHNlbnNvcklkGAEgASgFUghzZW5zb3JJZBIUCgV2YWx1ZRgCIAEoBVIFdmFsdWU=');
@$core.Deprecated('Use setTrainerTestDataDescriptor instead')
const SetTrainerTestData$json = {
'1': 'SetTrainerTestData',
'2': [
{'1': 'dataMode', '3': 1, '4': 1, '5': 5, '10': 'dataMode'},
{'1': 'interfaces', '3': 2, '4': 1, '5': 5, '10': 'interfaces'},
{'1': 'testTrainerData', '3': 3, '4': 1, '5': 11, '6': '.com.zwift.protobuf.TestTrainerData', '10': 'testTrainerData'},
],
};
/// Descriptor for `SetTrainerTestData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List setTrainerTestDataDescriptor = $convert.base64Decode(
'ChJTZXRUcmFpbmVyVGVzdERhdGESGgoIZGF0YU1vZGUYASABKAVSCGRhdGFNb2RlEh4KCmludG'
'VyZmFjZXMYAiABKAVSCmludGVyZmFjZXMSTQoPdGVzdFRyYWluZXJEYXRhGAMgASgLMiMuY29t'
'Lnp3aWZ0LnByb3RvYnVmLlRlc3RUcmFpbmVyRGF0YVIPdGVzdFRyYWluZXJEYXRh');
@$core.Deprecated('Use testTrainerDataDescriptor instead')
const TestTrainerData$json = {
'1': 'TestTrainerData',
'2': [
{'1': 'power', '3': 1, '4': 1, '5': 5, '10': 'power'},
{'1': 'cadence', '3': 2, '4': 1, '5': 5, '10': 'cadence'},
{'1': 'bikeSpeed', '3': 3, '4': 1, '5': 5, '10': 'bikeSpeed'},
{'1': 'averagedPower', '3': 4, '4': 1, '5': 5, '10': 'averagedPower'},
{'1': 'wheelSpeed', '3': 5, '4': 1, '5': 5, '10': 'wheelSpeed'},
{'1': 'calculatedRealGearRatio', '3': 6, '4': 1, '5': 5, '10': 'calculatedRealGearRatio'},
],
};
/// Descriptor for `TestTrainerData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List testTrainerDataDescriptor = $convert.base64Decode(
'Cg9UZXN0VHJhaW5lckRhdGESFAoFcG93ZXIYASABKAVSBXBvd2VyEhgKB2NhZGVuY2UYAiABKA'
'VSB2NhZGVuY2USHAoJYmlrZVNwZWVkGAMgASgFUgliaWtlU3BlZWQSJAoNYXZlcmFnZWRQb3dl'
'chgEIAEoBVINYXZlcmFnZWRQb3dlchIeCgp3aGVlbFNwZWVkGAUgASgFUgp3aGVlbFNwZWVkEj'
'gKF2NhbGN1bGF0ZWRSZWFsR2VhclJhdGlvGAYgASgFUhdjYWxjdWxhdGVkUmVhbEdlYXJSYXRp'
'bw==');

View File

@@ -1,14 +0,0 @@
//
// Generated code. Do not modify.
// source: zp_vendor.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
export 'zp_vendor.pb.dart';

View File

@@ -1,965 +0,0 @@
//
// Generated code. Do not modify.
// source: zwift.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'zwift.pbenum.dart';
export 'zwift.pbenum.dart';
/// The command code prepending this message is 0x07
class PlayKeyPadStatus extends $pb.GeneratedMessage {
factory PlayKeyPadStatus({
PlayButtonStatus? rightPad,
PlayButtonStatus? buttonYUp,
PlayButtonStatus? buttonZLeft,
PlayButtonStatus? buttonARight,
PlayButtonStatus? buttonBDown,
PlayButtonStatus? buttonShift,
PlayButtonStatus? buttonOn,
$core.int? analogLR,
$core.int? analogUD,
}) {
final $result = create();
if (rightPad != null) {
$result.rightPad = rightPad;
}
if (buttonYUp != null) {
$result.buttonYUp = buttonYUp;
}
if (buttonZLeft != null) {
$result.buttonZLeft = buttonZLeft;
}
if (buttonARight != null) {
$result.buttonARight = buttonARight;
}
if (buttonBDown != null) {
$result.buttonBDown = buttonBDown;
}
if (buttonShift != null) {
$result.buttonShift = buttonShift;
}
if (buttonOn != null) {
$result.buttonOn = buttonOn;
}
if (analogLR != null) {
$result.analogLR = analogLR;
}
if (analogUD != null) {
$result.analogUD = analogUD;
}
return $result;
}
PlayKeyPadStatus._() : super();
factory PlayKeyPadStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory PlayKeyPadStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PlayKeyPadStatus', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..e<PlayButtonStatus>(1, _omitFieldNames ? '' : 'RightPad', $pb.PbFieldType.OE, protoName: 'RightPad', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(2, _omitFieldNames ? '' : 'ButtonYUp', $pb.PbFieldType.OE, protoName: 'Button_Y_Up', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(3, _omitFieldNames ? '' : 'ButtonZLeft', $pb.PbFieldType.OE, protoName: 'Button_Z_Left', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(4, _omitFieldNames ? '' : 'ButtonARight', $pb.PbFieldType.OE, protoName: 'Button_A_Right', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(5, _omitFieldNames ? '' : 'ButtonBDown', $pb.PbFieldType.OE, protoName: 'Button_B_Down', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(6, _omitFieldNames ? '' : 'ButtonShift', $pb.PbFieldType.OE, protoName: 'Button_Shift', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(7, _omitFieldNames ? '' : 'ButtonOn', $pb.PbFieldType.OE, protoName: 'Button_On', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..a<$core.int>(8, _omitFieldNames ? '' : 'AnalogLR', $pb.PbFieldType.OS3, protoName: 'Analog_LR')
..a<$core.int>(9, _omitFieldNames ? '' : 'AnalogUD', $pb.PbFieldType.OS3, protoName: 'Analog_UD')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
PlayKeyPadStatus clone() => PlayKeyPadStatus()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
PlayKeyPadStatus copyWith(void Function(PlayKeyPadStatus) updates) => super.copyWith((message) => updates(message as PlayKeyPadStatus)) as PlayKeyPadStatus;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static PlayKeyPadStatus create() => PlayKeyPadStatus._();
PlayKeyPadStatus createEmptyInstance() => create();
static $pb.PbList<PlayKeyPadStatus> createRepeated() => $pb.PbList<PlayKeyPadStatus>();
@$core.pragma('dart2js:noInline')
static PlayKeyPadStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PlayKeyPadStatus>(create);
static PlayKeyPadStatus? _defaultInstance;
@$pb.TagNumber(1)
PlayButtonStatus get rightPad => $_getN(0);
@$pb.TagNumber(1)
set rightPad(PlayButtonStatus v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasRightPad() => $_has(0);
@$pb.TagNumber(1)
void clearRightPad() => clearField(1);
@$pb.TagNumber(2)
PlayButtonStatus get buttonYUp => $_getN(1);
@$pb.TagNumber(2)
set buttonYUp(PlayButtonStatus v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasButtonYUp() => $_has(1);
@$pb.TagNumber(2)
void clearButtonYUp() => clearField(2);
@$pb.TagNumber(3)
PlayButtonStatus get buttonZLeft => $_getN(2);
@$pb.TagNumber(3)
set buttonZLeft(PlayButtonStatus v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasButtonZLeft() => $_has(2);
@$pb.TagNumber(3)
void clearButtonZLeft() => clearField(3);
@$pb.TagNumber(4)
PlayButtonStatus get buttonARight => $_getN(3);
@$pb.TagNumber(4)
set buttonARight(PlayButtonStatus v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasButtonARight() => $_has(3);
@$pb.TagNumber(4)
void clearButtonARight() => clearField(4);
@$pb.TagNumber(5)
PlayButtonStatus get buttonBDown => $_getN(4);
@$pb.TagNumber(5)
set buttonBDown(PlayButtonStatus v) { setField(5, v); }
@$pb.TagNumber(5)
$core.bool hasButtonBDown() => $_has(4);
@$pb.TagNumber(5)
void clearButtonBDown() => clearField(5);
@$pb.TagNumber(6)
PlayButtonStatus get buttonShift => $_getN(5);
@$pb.TagNumber(6)
set buttonShift(PlayButtonStatus v) { setField(6, v); }
@$pb.TagNumber(6)
$core.bool hasButtonShift() => $_has(5);
@$pb.TagNumber(6)
void clearButtonShift() => clearField(6);
@$pb.TagNumber(7)
PlayButtonStatus get buttonOn => $_getN(6);
@$pb.TagNumber(7)
set buttonOn(PlayButtonStatus v) { setField(7, v); }
@$pb.TagNumber(7)
$core.bool hasButtonOn() => $_has(6);
@$pb.TagNumber(7)
void clearButtonOn() => clearField(7);
@$pb.TagNumber(8)
$core.int get analogLR => $_getIZ(7);
@$pb.TagNumber(8)
set analogLR($core.int v) { $_setSignedInt32(7, v); }
@$pb.TagNumber(8)
$core.bool hasAnalogLR() => $_has(7);
@$pb.TagNumber(8)
void clearAnalogLR() => clearField(8);
@$pb.TagNumber(9)
$core.int get analogUD => $_getIZ(8);
@$pb.TagNumber(9)
set analogUD($core.int v) { $_setSignedInt32(8, v); }
@$pb.TagNumber(9)
$core.bool hasAnalogUD() => $_has(8);
@$pb.TagNumber(9)
void clearAnalogUD() => clearField(9);
}
class PlayCommandParameters extends $pb.GeneratedMessage {
factory PlayCommandParameters({
$core.int? param1,
$core.int? param2,
$core.int? hapticPattern,
}) {
final $result = create();
if (param1 != null) {
$result.param1 = param1;
}
if (param2 != null) {
$result.param2 = param2;
}
if (hapticPattern != null) {
$result.hapticPattern = hapticPattern;
}
return $result;
}
PlayCommandParameters._() : super();
factory PlayCommandParameters.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory PlayCommandParameters.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PlayCommandParameters', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'param1', $pb.PbFieldType.OU3)
..a<$core.int>(2, _omitFieldNames ? '' : 'param2', $pb.PbFieldType.OU3)
..a<$core.int>(3, _omitFieldNames ? '' : 'HapticPattern', $pb.PbFieldType.OU3, protoName: 'HapticPattern')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
PlayCommandParameters clone() => PlayCommandParameters()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
PlayCommandParameters copyWith(void Function(PlayCommandParameters) updates) => super.copyWith((message) => updates(message as PlayCommandParameters)) as PlayCommandParameters;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static PlayCommandParameters create() => PlayCommandParameters._();
PlayCommandParameters createEmptyInstance() => create();
static $pb.PbList<PlayCommandParameters> createRepeated() => $pb.PbList<PlayCommandParameters>();
@$core.pragma('dart2js:noInline')
static PlayCommandParameters getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PlayCommandParameters>(create);
static PlayCommandParameters? _defaultInstance;
@$pb.TagNumber(1)
$core.int get param1 => $_getIZ(0);
@$pb.TagNumber(1)
set param1($core.int v) { $_setUnsignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasParam1() => $_has(0);
@$pb.TagNumber(1)
void clearParam1() => clearField(1);
@$pb.TagNumber(2)
$core.int get param2 => $_getIZ(1);
@$pb.TagNumber(2)
set param2($core.int v) { $_setUnsignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasParam2() => $_has(1);
@$pb.TagNumber(2)
void clearParam2() => clearField(2);
@$pb.TagNumber(3)
$core.int get hapticPattern => $_getIZ(2);
@$pb.TagNumber(3)
set hapticPattern($core.int v) { $_setUnsignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasHapticPattern() => $_has(2);
@$pb.TagNumber(3)
void clearHapticPattern() => clearField(3);
}
class PlayCommandContents extends $pb.GeneratedMessage {
factory PlayCommandContents({
PlayCommandParameters? commandParameters,
}) {
final $result = create();
if (commandParameters != null) {
$result.commandParameters = commandParameters;
}
return $result;
}
PlayCommandContents._() : super();
factory PlayCommandContents.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory PlayCommandContents.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PlayCommandContents', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..aOM<PlayCommandParameters>(1, _omitFieldNames ? '' : 'CommandParameters', protoName: 'CommandParameters', subBuilder: PlayCommandParameters.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
PlayCommandContents clone() => PlayCommandContents()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
PlayCommandContents copyWith(void Function(PlayCommandContents) updates) => super.copyWith((message) => updates(message as PlayCommandContents)) as PlayCommandContents;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static PlayCommandContents create() => PlayCommandContents._();
PlayCommandContents createEmptyInstance() => create();
static $pb.PbList<PlayCommandContents> createRepeated() => $pb.PbList<PlayCommandContents>();
@$core.pragma('dart2js:noInline')
static PlayCommandContents getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PlayCommandContents>(create);
static PlayCommandContents? _defaultInstance;
@$pb.TagNumber(1)
PlayCommandParameters get commandParameters => $_getN(0);
@$pb.TagNumber(1)
set commandParameters(PlayCommandParameters v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasCommandParameters() => $_has(0);
@$pb.TagNumber(1)
void clearCommandParameters() => clearField(1);
@$pb.TagNumber(1)
PlayCommandParameters ensureCommandParameters() => $_ensure(0);
}
/// The command code prepending this message is 0x12
/// This is sent to the control point to configure and make the controller vibrate
class PlayCommand extends $pb.GeneratedMessage {
factory PlayCommand({
PlayCommandContents? commandContents,
}) {
final $result = create();
if (commandContents != null) {
$result.commandContents = commandContents;
}
return $result;
}
PlayCommand._() : super();
factory PlayCommand.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory PlayCommand.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'PlayCommand', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..aOM<PlayCommandContents>(2, _omitFieldNames ? '' : 'CommandContents', protoName: 'CommandContents', subBuilder: PlayCommandContents.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
PlayCommand clone() => PlayCommand()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
PlayCommand copyWith(void Function(PlayCommand) updates) => super.copyWith((message) => updates(message as PlayCommand)) as PlayCommand;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static PlayCommand create() => PlayCommand._();
PlayCommand createEmptyInstance() => create();
static $pb.PbList<PlayCommand> createRepeated() => $pb.PbList<PlayCommand>();
@$core.pragma('dart2js:noInline')
static PlayCommand getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<PlayCommand>(create);
static PlayCommand? _defaultInstance;
@$pb.TagNumber(2)
PlayCommandContents get commandContents => $_getN(0);
@$pb.TagNumber(2)
set commandContents(PlayCommandContents v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasCommandContents() => $_has(0);
@$pb.TagNumber(2)
void clearCommandContents() => clearField(2);
@$pb.TagNumber(2)
PlayCommandContents ensureCommandContents() => $_ensure(0);
}
/// The command code prepending this message is 0x19
/// This is sent periodically when there are no button presses
class Idle extends $pb.GeneratedMessage {
factory Idle({
$core.int? unknown2,
}) {
final $result = create();
if (unknown2 != null) {
$result.unknown2 = unknown2;
}
return $result;
}
Idle._() : super();
factory Idle.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory Idle.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Idle', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..a<$core.int>(2, _omitFieldNames ? '' : 'Unknown2', $pb.PbFieldType.OU3, protoName: 'Unknown2')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
Idle clone() => Idle()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
Idle copyWith(void Function(Idle) updates) => super.copyWith((message) => updates(message as Idle)) as Idle;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static Idle create() => Idle._();
Idle createEmptyInstance() => create();
static $pb.PbList<Idle> createRepeated() => $pb.PbList<Idle>();
@$core.pragma('dart2js:noInline')
static Idle getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Idle>(create);
static Idle? _defaultInstance;
@$pb.TagNumber(2)
$core.int get unknown2 => $_getIZ(0);
@$pb.TagNumber(2)
set unknown2($core.int v) { $_setUnsignedInt32(0, v); }
@$pb.TagNumber(2)
$core.bool hasUnknown2() => $_has(0);
@$pb.TagNumber(2)
void clearUnknown2() => clearField(2);
}
class RideAnalogKeyPress extends $pb.GeneratedMessage {
factory RideAnalogKeyPress({
RideAnalogLocation? location,
$core.int? analogValue,
}) {
final $result = create();
if (location != null) {
$result.location = location;
}
if (analogValue != null) {
$result.analogValue = analogValue;
}
return $result;
}
RideAnalogKeyPress._() : super();
factory RideAnalogKeyPress.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RideAnalogKeyPress.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'RideAnalogKeyPress', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..e<RideAnalogLocation>(1, _omitFieldNames ? '' : 'Location', $pb.PbFieldType.OE, protoName: 'Location', defaultOrMaker: RideAnalogLocation.LEFT, valueOf: RideAnalogLocation.valueOf, enumValues: RideAnalogLocation.values)
..a<$core.int>(2, _omitFieldNames ? '' : 'AnalogValue', $pb.PbFieldType.OS3, protoName: 'AnalogValue')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RideAnalogKeyPress clone() => RideAnalogKeyPress()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RideAnalogKeyPress copyWith(void Function(RideAnalogKeyPress) updates) => super.copyWith((message) => updates(message as RideAnalogKeyPress)) as RideAnalogKeyPress;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RideAnalogKeyPress create() => RideAnalogKeyPress._();
RideAnalogKeyPress createEmptyInstance() => create();
static $pb.PbList<RideAnalogKeyPress> createRepeated() => $pb.PbList<RideAnalogKeyPress>();
@$core.pragma('dart2js:noInline')
static RideAnalogKeyPress getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RideAnalogKeyPress>(create);
static RideAnalogKeyPress? _defaultInstance;
@$pb.TagNumber(1)
RideAnalogLocation get location => $_getN(0);
@$pb.TagNumber(1)
set location(RideAnalogLocation v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasLocation() => $_has(0);
@$pb.TagNumber(1)
void clearLocation() => clearField(1);
@$pb.TagNumber(2)
$core.int get analogValue => $_getIZ(1);
@$pb.TagNumber(2)
set analogValue($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasAnalogValue() => $_has(1);
@$pb.TagNumber(2)
void clearAnalogValue() => clearField(2);
}
/// The command code prepending this message is 0x23
/// All analog paddles (L0-L3) appear as repeated RideAnalogKeyPress in field 3
class RideKeyPadStatus extends $pb.GeneratedMessage {
factory RideKeyPadStatus({
$core.int? buttonMap,
$core.Iterable<RideAnalogKeyPress>? analogPaddles,
}) {
final $result = create();
if (buttonMap != null) {
$result.buttonMap = buttonMap;
}
if (analogPaddles != null) {
$result.analogPaddles.addAll(analogPaddles);
}
return $result;
}
RideKeyPadStatus._() : super();
factory RideKeyPadStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RideKeyPadStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'RideKeyPadStatus', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'ButtonMap', $pb.PbFieldType.OU3, protoName: 'ButtonMap')
..pc<RideAnalogKeyPress>(3, _omitFieldNames ? '' : 'AnalogPaddles', $pb.PbFieldType.PM, protoName: 'AnalogPaddles', subBuilder: RideAnalogKeyPress.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RideKeyPadStatus clone() => RideKeyPadStatus()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RideKeyPadStatus copyWith(void Function(RideKeyPadStatus) updates) => super.copyWith((message) => updates(message as RideKeyPadStatus)) as RideKeyPadStatus;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RideKeyPadStatus create() => RideKeyPadStatus._();
RideKeyPadStatus createEmptyInstance() => create();
static $pb.PbList<RideKeyPadStatus> createRepeated() => $pb.PbList<RideKeyPadStatus>();
@$core.pragma('dart2js:noInline')
static RideKeyPadStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RideKeyPadStatus>(create);
static RideKeyPadStatus? _defaultInstance;
@$pb.TagNumber(1)
$core.int get buttonMap => $_getIZ(0);
@$pb.TagNumber(1)
set buttonMap($core.int v) { $_setUnsignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasButtonMap() => $_has(0);
@$pb.TagNumber(1)
void clearButtonMap() => clearField(1);
@$pb.TagNumber(3)
$core.List<RideAnalogKeyPress> get analogPaddles => $_getList(1);
}
/// ------------------ Zwift Click messages
/// The command code prepending this message is 0x37
class ClickKeyPadStatus extends $pb.GeneratedMessage {
factory ClickKeyPadStatus({
PlayButtonStatus? buttonPlus,
PlayButtonStatus? buttonMinus,
}) {
final $result = create();
if (buttonPlus != null) {
$result.buttonPlus = buttonPlus;
}
if (buttonMinus != null) {
$result.buttonMinus = buttonMinus;
}
return $result;
}
ClickKeyPadStatus._() : super();
factory ClickKeyPadStatus.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ClickKeyPadStatus.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ClickKeyPadStatus', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..e<PlayButtonStatus>(1, _omitFieldNames ? '' : 'ButtonPlus', $pb.PbFieldType.OE, protoName: 'Button_Plus', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..e<PlayButtonStatus>(2, _omitFieldNames ? '' : 'ButtonMinus', $pb.PbFieldType.OE, protoName: 'Button_Minus', defaultOrMaker: PlayButtonStatus.ON, valueOf: PlayButtonStatus.valueOf, enumValues: PlayButtonStatus.values)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ClickKeyPadStatus clone() => ClickKeyPadStatus()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ClickKeyPadStatus copyWith(void Function(ClickKeyPadStatus) updates) => super.copyWith((message) => updates(message as ClickKeyPadStatus)) as ClickKeyPadStatus;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ClickKeyPadStatus create() => ClickKeyPadStatus._();
ClickKeyPadStatus createEmptyInstance() => create();
static $pb.PbList<ClickKeyPadStatus> createRepeated() => $pb.PbList<ClickKeyPadStatus>();
@$core.pragma('dart2js:noInline')
static ClickKeyPadStatus getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ClickKeyPadStatus>(create);
static ClickKeyPadStatus? _defaultInstance;
@$pb.TagNumber(1)
PlayButtonStatus get buttonPlus => $_getN(0);
@$pb.TagNumber(1)
set buttonPlus(PlayButtonStatus v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasButtonPlus() => $_has(0);
@$pb.TagNumber(1)
void clearButtonPlus() => clearField(1);
@$pb.TagNumber(2)
PlayButtonStatus get buttonMinus => $_getN(1);
@$pb.TagNumber(2)
set buttonMinus(PlayButtonStatus v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasButtonMinus() => $_has(1);
@$pb.TagNumber(2)
void clearButtonMinus() => clearField(2);
}
/// ------------------ Device Information requested after connection
/// The command code prepending this message is 0x3c
class DeviceInformationContent extends $pb.GeneratedMessage {
factory DeviceInformationContent({
$core.int? unknown1,
$core.Iterable<$core.int>? softwareVersion,
$core.String? deviceName,
$core.int? unknown4,
$core.int? unknown5,
$core.String? serialNumber,
$core.String? hardwareVersion,
$core.Iterable<$core.int>? replyData,
$core.int? unknown9,
$core.int? unknown10,
$core.int? unknown13,
}) {
final $result = create();
if (unknown1 != null) {
$result.unknown1 = unknown1;
}
if (softwareVersion != null) {
$result.softwareVersion.addAll(softwareVersion);
}
if (deviceName != null) {
$result.deviceName = deviceName;
}
if (unknown4 != null) {
$result.unknown4 = unknown4;
}
if (unknown5 != null) {
$result.unknown5 = unknown5;
}
if (serialNumber != null) {
$result.serialNumber = serialNumber;
}
if (hardwareVersion != null) {
$result.hardwareVersion = hardwareVersion;
}
if (replyData != null) {
$result.replyData.addAll(replyData);
}
if (unknown9 != null) {
$result.unknown9 = unknown9;
}
if (unknown10 != null) {
$result.unknown10 = unknown10;
}
if (unknown13 != null) {
$result.unknown13 = unknown13;
}
return $result;
}
DeviceInformationContent._() : super();
factory DeviceInformationContent.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DeviceInformationContent.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DeviceInformationContent', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'Unknown1', $pb.PbFieldType.OU3, protoName: 'Unknown1')
..p<$core.int>(2, _omitFieldNames ? '' : 'SoftwareVersion', $pb.PbFieldType.PU3, protoName: 'SoftwareVersion')
..aOS(3, _omitFieldNames ? '' : 'DeviceName', protoName: 'DeviceName')
..a<$core.int>(4, _omitFieldNames ? '' : 'Unknown4', $pb.PbFieldType.OU3, protoName: 'Unknown4')
..a<$core.int>(5, _omitFieldNames ? '' : 'Unknown5', $pb.PbFieldType.OU3, protoName: 'Unknown5')
..aOS(6, _omitFieldNames ? '' : 'SerialNumber', protoName: 'SerialNumber')
..aOS(7, _omitFieldNames ? '' : 'HardwareVersion', protoName: 'HardwareVersion')
..p<$core.int>(8, _omitFieldNames ? '' : 'ReplyData', $pb.PbFieldType.PU3, protoName: 'ReplyData')
..a<$core.int>(9, _omitFieldNames ? '' : 'Unknown9', $pb.PbFieldType.OU3, protoName: 'Unknown9')
..a<$core.int>(10, _omitFieldNames ? '' : 'Unknown10', $pb.PbFieldType.OU3, protoName: 'Unknown10')
..a<$core.int>(13, _omitFieldNames ? '' : 'Unknown13', $pb.PbFieldType.OU3, protoName: 'Unknown13')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
DeviceInformationContent clone() => DeviceInformationContent()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
DeviceInformationContent copyWith(void Function(DeviceInformationContent) updates) => super.copyWith((message) => updates(message as DeviceInformationContent)) as DeviceInformationContent;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static DeviceInformationContent create() => DeviceInformationContent._();
DeviceInformationContent createEmptyInstance() => create();
static $pb.PbList<DeviceInformationContent> createRepeated() => $pb.PbList<DeviceInformationContent>();
@$core.pragma('dart2js:noInline')
static DeviceInformationContent getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DeviceInformationContent>(create);
static DeviceInformationContent? _defaultInstance;
@$pb.TagNumber(1)
$core.int get unknown1 => $_getIZ(0);
@$pb.TagNumber(1)
set unknown1($core.int v) { $_setUnsignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasUnknown1() => $_has(0);
@$pb.TagNumber(1)
void clearUnknown1() => clearField(1);
@$pb.TagNumber(2)
$core.List<$core.int> get softwareVersion => $_getList(1);
@$pb.TagNumber(3)
$core.String get deviceName => $_getSZ(2);
@$pb.TagNumber(3)
set deviceName($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasDeviceName() => $_has(2);
@$pb.TagNumber(3)
void clearDeviceName() => clearField(3);
@$pb.TagNumber(4)
$core.int get unknown4 => $_getIZ(3);
@$pb.TagNumber(4)
set unknown4($core.int v) { $_setUnsignedInt32(3, v); }
@$pb.TagNumber(4)
$core.bool hasUnknown4() => $_has(3);
@$pb.TagNumber(4)
void clearUnknown4() => clearField(4);
@$pb.TagNumber(5)
$core.int get unknown5 => $_getIZ(4);
@$pb.TagNumber(5)
set unknown5($core.int v) { $_setUnsignedInt32(4, v); }
@$pb.TagNumber(5)
$core.bool hasUnknown5() => $_has(4);
@$pb.TagNumber(5)
void clearUnknown5() => clearField(5);
@$pb.TagNumber(6)
$core.String get serialNumber => $_getSZ(5);
@$pb.TagNumber(6)
set serialNumber($core.String v) { $_setString(5, v); }
@$pb.TagNumber(6)
$core.bool hasSerialNumber() => $_has(5);
@$pb.TagNumber(6)
void clearSerialNumber() => clearField(6);
@$pb.TagNumber(7)
$core.String get hardwareVersion => $_getSZ(6);
@$pb.TagNumber(7)
set hardwareVersion($core.String v) { $_setString(6, v); }
@$pb.TagNumber(7)
$core.bool hasHardwareVersion() => $_has(6);
@$pb.TagNumber(7)
void clearHardwareVersion() => clearField(7);
@$pb.TagNumber(8)
$core.List<$core.int> get replyData => $_getList(7);
@$pb.TagNumber(9)
$core.int get unknown9 => $_getIZ(8);
@$pb.TagNumber(9)
set unknown9($core.int v) { $_setUnsignedInt32(8, v); }
@$pb.TagNumber(9)
$core.bool hasUnknown9() => $_has(8);
@$pb.TagNumber(9)
void clearUnknown9() => clearField(9);
@$pb.TagNumber(10)
$core.int get unknown10 => $_getIZ(9);
@$pb.TagNumber(10)
set unknown10($core.int v) { $_setUnsignedInt32(9, v); }
@$pb.TagNumber(10)
$core.bool hasUnknown10() => $_has(9);
@$pb.TagNumber(10)
void clearUnknown10() => clearField(10);
@$pb.TagNumber(13)
$core.int get unknown13 => $_getIZ(10);
@$pb.TagNumber(13)
set unknown13($core.int v) { $_setUnsignedInt32(10, v); }
@$pb.TagNumber(13)
$core.bool hasUnknown13() => $_has(10);
@$pb.TagNumber(13)
void clearUnknown13() => clearField(13);
}
class SubContent extends $pb.GeneratedMessage {
factory SubContent({
DeviceInformationContent? content,
$core.int? unknown2,
$core.int? unknown4,
$core.int? unknown5,
$core.int? unknown6,
}) {
final $result = create();
if (content != null) {
$result.content = content;
}
if (unknown2 != null) {
$result.unknown2 = unknown2;
}
if (unknown4 != null) {
$result.unknown4 = unknown4;
}
if (unknown5 != null) {
$result.unknown5 = unknown5;
}
if (unknown6 != null) {
$result.unknown6 = unknown6;
}
return $result;
}
SubContent._() : super();
factory SubContent.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory SubContent.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SubContent', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..aOM<DeviceInformationContent>(1, _omitFieldNames ? '' : 'Content', protoName: 'Content', subBuilder: DeviceInformationContent.create)
..a<$core.int>(2, _omitFieldNames ? '' : 'Unknown2', $pb.PbFieldType.OU3, protoName: 'Unknown2')
..a<$core.int>(4, _omitFieldNames ? '' : 'Unknown4', $pb.PbFieldType.OU3, protoName: 'Unknown4')
..a<$core.int>(5, _omitFieldNames ? '' : 'Unknown5', $pb.PbFieldType.OU3, protoName: 'Unknown5')
..a<$core.int>(6, _omitFieldNames ? '' : 'Unknown6', $pb.PbFieldType.OU3, protoName: 'Unknown6')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
SubContent clone() => SubContent()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
SubContent copyWith(void Function(SubContent) updates) => super.copyWith((message) => updates(message as SubContent)) as SubContent;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static SubContent create() => SubContent._();
SubContent createEmptyInstance() => create();
static $pb.PbList<SubContent> createRepeated() => $pb.PbList<SubContent>();
@$core.pragma('dart2js:noInline')
static SubContent getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SubContent>(create);
static SubContent? _defaultInstance;
@$pb.TagNumber(1)
DeviceInformationContent get content => $_getN(0);
@$pb.TagNumber(1)
set content(DeviceInformationContent v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasContent() => $_has(0);
@$pb.TagNumber(1)
void clearContent() => clearField(1);
@$pb.TagNumber(1)
DeviceInformationContent ensureContent() => $_ensure(0);
@$pb.TagNumber(2)
$core.int get unknown2 => $_getIZ(1);
@$pb.TagNumber(2)
set unknown2($core.int v) { $_setUnsignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasUnknown2() => $_has(1);
@$pb.TagNumber(2)
void clearUnknown2() => clearField(2);
@$pb.TagNumber(4)
$core.int get unknown4 => $_getIZ(2);
@$pb.TagNumber(4)
set unknown4($core.int v) { $_setUnsignedInt32(2, v); }
@$pb.TagNumber(4)
$core.bool hasUnknown4() => $_has(2);
@$pb.TagNumber(4)
void clearUnknown4() => clearField(4);
@$pb.TagNumber(5)
$core.int get unknown5 => $_getIZ(3);
@$pb.TagNumber(5)
set unknown5($core.int v) { $_setUnsignedInt32(3, v); }
@$pb.TagNumber(5)
$core.bool hasUnknown5() => $_has(3);
@$pb.TagNumber(5)
void clearUnknown5() => clearField(5);
@$pb.TagNumber(6)
$core.int get unknown6 => $_getIZ(4);
@$pb.TagNumber(6)
set unknown6($core.int v) { $_setUnsignedInt32(4, v); }
@$pb.TagNumber(6)
$core.bool hasUnknown6() => $_has(4);
@$pb.TagNumber(6)
void clearUnknown6() => clearField(6);
}
class DeviceInformation extends $pb.GeneratedMessage {
factory DeviceInformation({
$core.int? informationId,
SubContent? subContent,
}) {
final $result = create();
if (informationId != null) {
$result.informationId = informationId;
}
if (subContent != null) {
$result.subContent = subContent;
}
return $result;
}
DeviceInformation._() : super();
factory DeviceInformation.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DeviceInformation.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DeviceInformation', package: const $pb.PackageName(_omitMessageNames ? '' : 'de.jonasbark'), createEmptyInstance: create)
..a<$core.int>(1, _omitFieldNames ? '' : 'InformationId', $pb.PbFieldType.OU3, protoName: 'InformationId')
..aOM<SubContent>(2, _omitFieldNames ? '' : 'SubContent', protoName: 'SubContent', subBuilder: SubContent.create)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
DeviceInformation clone() => DeviceInformation()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
DeviceInformation copyWith(void Function(DeviceInformation) updates) => super.copyWith((message) => updates(message as DeviceInformation)) as DeviceInformation;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static DeviceInformation create() => DeviceInformation._();
DeviceInformation createEmptyInstance() => create();
static $pb.PbList<DeviceInformation> createRepeated() => $pb.PbList<DeviceInformation>();
@$core.pragma('dart2js:noInline')
static DeviceInformation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DeviceInformation>(create);
static DeviceInformation? _defaultInstance;
@$pb.TagNumber(1)
$core.int get informationId => $_getIZ(0);
@$pb.TagNumber(1)
set informationId($core.int v) { $_setUnsignedInt32(0, v); }
@$pb.TagNumber(1)
$core.bool hasInformationId() => $_has(0);
@$pb.TagNumber(1)
void clearInformationId() => clearField(1);
@$pb.TagNumber(2)
SubContent get subContent => $_getN(1);
@$pb.TagNumber(2)
set subContent(SubContent v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasSubContent() => $_has(1);
@$pb.TagNumber(2)
void clearSubContent() => clearField(2);
@$pb.TagNumber(2)
SubContent ensureSubContent() => $_ensure(1);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@@ -1,95 +0,0 @@
//
// Generated code. Do not modify.
// source: zwift.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class PlayButtonStatus extends $pb.ProtobufEnum {
static const PlayButtonStatus ON = PlayButtonStatus._(0, _omitEnumNames ? '' : 'ON');
static const PlayButtonStatus OFF = PlayButtonStatus._(1, _omitEnumNames ? '' : 'OFF');
static const $core.List<PlayButtonStatus> values = <PlayButtonStatus> [
ON,
OFF,
];
static final $core.Map<$core.int, PlayButtonStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
static PlayButtonStatus? valueOf($core.int value) => _byValue[value];
const PlayButtonStatus._($core.int v, $core.String n) : super(v, n);
}
/// ----------------- Zwift Ride messages
class RideButtonMask extends $pb.ProtobufEnum {
static const RideButtonMask LEFT_BTN = RideButtonMask._(1, _omitEnumNames ? '' : 'LEFT_BTN');
static const RideButtonMask UP_BTN = RideButtonMask._(2, _omitEnumNames ? '' : 'UP_BTN');
static const RideButtonMask RIGHT_BTN = RideButtonMask._(4, _omitEnumNames ? '' : 'RIGHT_BTN');
static const RideButtonMask DOWN_BTN = RideButtonMask._(8, _omitEnumNames ? '' : 'DOWN_BTN');
static const RideButtonMask A_BTN = RideButtonMask._(16, _omitEnumNames ? '' : 'A_BTN');
static const RideButtonMask B_BTN = RideButtonMask._(32, _omitEnumNames ? '' : 'B_BTN');
static const RideButtonMask Y_BTN = RideButtonMask._(64, _omitEnumNames ? '' : 'Y_BTN');
static const RideButtonMask Z_BTN = RideButtonMask._(256, _omitEnumNames ? '' : 'Z_BTN');
static const RideButtonMask SHFT_UP_L_BTN = RideButtonMask._(512, _omitEnumNames ? '' : 'SHFT_UP_L_BTN');
static const RideButtonMask SHFT_DN_L_BTN = RideButtonMask._(1024, _omitEnumNames ? '' : 'SHFT_DN_L_BTN');
static const RideButtonMask POWERUP_L_BTN = RideButtonMask._(2048, _omitEnumNames ? '' : 'POWERUP_L_BTN');
static const RideButtonMask ONOFF_L_BTN = RideButtonMask._(4096, _omitEnumNames ? '' : 'ONOFF_L_BTN');
static const RideButtonMask SHFT_UP_R_BTN = RideButtonMask._(8192, _omitEnumNames ? '' : 'SHFT_UP_R_BTN');
static const RideButtonMask SHFT_DN_R_BTN = RideButtonMask._(16384, _omitEnumNames ? '' : 'SHFT_DN_R_BTN');
static const RideButtonMask POWERUP_R_BTN = RideButtonMask._(65536, _omitEnumNames ? '' : 'POWERUP_R_BTN');
static const RideButtonMask ONOFF_R_BTN = RideButtonMask._(131072, _omitEnumNames ? '' : 'ONOFF_R_BTN');
static const $core.List<RideButtonMask> values = <RideButtonMask> [
LEFT_BTN,
UP_BTN,
RIGHT_BTN,
DOWN_BTN,
A_BTN,
B_BTN,
Y_BTN,
Z_BTN,
SHFT_UP_L_BTN,
SHFT_DN_L_BTN,
POWERUP_L_BTN,
ONOFF_L_BTN,
SHFT_UP_R_BTN,
SHFT_DN_R_BTN,
POWERUP_R_BTN,
ONOFF_R_BTN,
];
static final $core.Map<$core.int, RideButtonMask> _byValue = $pb.ProtobufEnum.initByValue(values);
static RideButtonMask? valueOf($core.int value) => _byValue[value];
const RideButtonMask._($core.int v, $core.String n) : super(v, n);
}
class RideAnalogLocation extends $pb.ProtobufEnum {
static const RideAnalogLocation LEFT = RideAnalogLocation._(0, _omitEnumNames ? '' : 'LEFT');
static const RideAnalogLocation RIGHT = RideAnalogLocation._(1, _omitEnumNames ? '' : 'RIGHT');
static const RideAnalogLocation UP = RideAnalogLocation._(2, _omitEnumNames ? '' : 'UP');
static const RideAnalogLocation DOWN = RideAnalogLocation._(3, _omitEnumNames ? '' : 'DOWN');
static const $core.List<RideAnalogLocation> values = <RideAnalogLocation> [
LEFT,
RIGHT,
UP,
DOWN,
];
static final $core.Map<$core.int, RideAnalogLocation> _byValue = $pb.ProtobufEnum.initByValue(values);
static RideAnalogLocation? valueOf($core.int value) => _byValue[value];
const RideAnalogLocation._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@@ -1,264 +0,0 @@
//
// Generated code. Do not modify.
// source: zwift.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use playButtonStatusDescriptor instead')
const PlayButtonStatus$json = {
'1': 'PlayButtonStatus',
'2': [
{'1': 'ON', '2': 0},
{'1': 'OFF', '2': 1},
],
};
/// Descriptor for `PlayButtonStatus`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List playButtonStatusDescriptor = $convert.base64Decode(
'ChBQbGF5QnV0dG9uU3RhdHVzEgYKAk9OEAASBwoDT0ZGEAE=');
@$core.Deprecated('Use rideButtonMaskDescriptor instead')
const RideButtonMask$json = {
'1': 'RideButtonMask',
'2': [
{'1': 'LEFT_BTN', '2': 1},
{'1': 'UP_BTN', '2': 2},
{'1': 'RIGHT_BTN', '2': 4},
{'1': 'DOWN_BTN', '2': 8},
{'1': 'A_BTN', '2': 16},
{'1': 'B_BTN', '2': 32},
{'1': 'Y_BTN', '2': 64},
{'1': 'Z_BTN', '2': 256},
{'1': 'SHFT_UP_L_BTN', '2': 512},
{'1': 'SHFT_DN_L_BTN', '2': 1024},
{'1': 'POWERUP_L_BTN', '2': 2048},
{'1': 'ONOFF_L_BTN', '2': 4096},
{'1': 'SHFT_UP_R_BTN', '2': 8192},
{'1': 'SHFT_DN_R_BTN', '2': 16384},
{'1': 'POWERUP_R_BTN', '2': 65536},
{'1': 'ONOFF_R_BTN', '2': 131072},
],
};
/// Descriptor for `RideButtonMask`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List rideButtonMaskDescriptor = $convert.base64Decode(
'Cg5SaWRlQnV0dG9uTWFzaxIMCghMRUZUX0JUThABEgoKBlVQX0JUThACEg0KCVJJR0hUX0JUTh'
'AEEgwKCERPV05fQlROEAgSCQoFQV9CVE4QEBIJCgVCX0JUThAgEgkKBVlfQlROEEASCgoFWl9C'
'VE4QgAISEgoNU0hGVF9VUF9MX0JUThCABBISCg1TSEZUX0ROX0xfQlROEIAIEhIKDVBPV0VSVV'
'BfTF9CVE4QgBASEAoLT05PRkZfTF9CVE4QgCASEgoNU0hGVF9VUF9SX0JUThCAQBITCg1TSEZU'
'X0ROX1JfQlROEICAARITCg1QT1dFUlVQX1JfQlROEICABBIRCgtPTk9GRl9SX0JUThCAgAg=');
@$core.Deprecated('Use rideAnalogLocationDescriptor instead')
const RideAnalogLocation$json = {
'1': 'RideAnalogLocation',
'2': [
{'1': 'LEFT', '2': 0},
{'1': 'RIGHT', '2': 1},
{'1': 'UP', '2': 2},
{'1': 'DOWN', '2': 3},
],
};
/// Descriptor for `RideAnalogLocation`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List rideAnalogLocationDescriptor = $convert.base64Decode(
'ChJSaWRlQW5hbG9nTG9jYXRpb24SCAoETEVGVBAAEgkKBVJJR0hUEAESBgoCVVAQAhIICgRET1'
'dOEAM=');
@$core.Deprecated('Use playKeyPadStatusDescriptor instead')
const PlayKeyPadStatus$json = {
'1': 'PlayKeyPadStatus',
'2': [
{'1': 'RightPad', '3': 1, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'RightPad'},
{'1': 'Button_Y_Up', '3': 2, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonYUp'},
{'1': 'Button_Z_Left', '3': 3, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonZLeft'},
{'1': 'Button_A_Right', '3': 4, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonARight'},
{'1': 'Button_B_Down', '3': 5, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonBDown'},
{'1': 'Button_Shift', '3': 6, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonShift'},
{'1': 'Button_On', '3': 7, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonOn'},
{'1': 'Analog_LR', '3': 8, '4': 1, '5': 17, '10': 'AnalogLR'},
{'1': 'Analog_UD', '3': 9, '4': 1, '5': 17, '10': 'AnalogUD'},
],
};
/// Descriptor for `PlayKeyPadStatus`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List playKeyPadStatusDescriptor = $convert.base64Decode(
'ChBQbGF5S2V5UGFkU3RhdHVzEjoKCFJpZ2h0UGFkGAEgASgOMh4uZGUuam9uYXNiYXJrLlBsYX'
'lCdXR0b25TdGF0dXNSCFJpZ2h0UGFkEj4KC0J1dHRvbl9ZX1VwGAIgASgOMh4uZGUuam9uYXNi'
'YXJrLlBsYXlCdXR0b25TdGF0dXNSCUJ1dHRvbllVcBJCCg1CdXR0b25fWl9MZWZ0GAMgASgOMh'
'4uZGUuam9uYXNiYXJrLlBsYXlCdXR0b25TdGF0dXNSC0J1dHRvblpMZWZ0EkQKDkJ1dHRvbl9B'
'X1JpZ2h0GAQgASgOMh4uZGUuam9uYXNiYXJrLlBsYXlCdXR0b25TdGF0dXNSDEJ1dHRvbkFSaW'
'dodBJCCg1CdXR0b25fQl9Eb3duGAUgASgOMh4uZGUuam9uYXNiYXJrLlBsYXlCdXR0b25TdGF0'
'dXNSC0J1dHRvbkJEb3duEkEKDEJ1dHRvbl9TaGlmdBgGIAEoDjIeLmRlLmpvbmFzYmFyay5QbG'
'F5QnV0dG9uU3RhdHVzUgtCdXR0b25TaGlmdBI7CglCdXR0b25fT24YByABKA4yHi5kZS5qb25h'
'c2JhcmsuUGxheUJ1dHRvblN0YXR1c1IIQnV0dG9uT24SGwoJQW5hbG9nX0xSGAggASgRUghBbm'
'Fsb2dMUhIbCglBbmFsb2dfVUQYCSABKBFSCEFuYWxvZ1VE');
@$core.Deprecated('Use playCommandParametersDescriptor instead')
const PlayCommandParameters$json = {
'1': 'PlayCommandParameters',
'2': [
{'1': 'param1', '3': 1, '4': 1, '5': 13, '10': 'param1'},
{'1': 'param2', '3': 2, '4': 1, '5': 13, '10': 'param2'},
{'1': 'HapticPattern', '3': 3, '4': 1, '5': 13, '10': 'HapticPattern'},
],
};
/// Descriptor for `PlayCommandParameters`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List playCommandParametersDescriptor = $convert.base64Decode(
'ChVQbGF5Q29tbWFuZFBhcmFtZXRlcnMSFgoGcGFyYW0xGAEgASgNUgZwYXJhbTESFgoGcGFyYW'
'0yGAIgASgNUgZwYXJhbTISJAoNSGFwdGljUGF0dGVybhgDIAEoDVINSGFwdGljUGF0dGVybg==');
@$core.Deprecated('Use playCommandContentsDescriptor instead')
const PlayCommandContents$json = {
'1': 'PlayCommandContents',
'2': [
{'1': 'CommandParameters', '3': 1, '4': 1, '5': 11, '6': '.de.jonasbark.PlayCommandParameters', '10': 'CommandParameters'},
],
};
/// Descriptor for `PlayCommandContents`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List playCommandContentsDescriptor = $convert.base64Decode(
'ChNQbGF5Q29tbWFuZENvbnRlbnRzElEKEUNvbW1hbmRQYXJhbWV0ZXJzGAEgASgLMiMuZGUuam'
'9uYXNiYXJrLlBsYXlDb21tYW5kUGFyYW1ldGVyc1IRQ29tbWFuZFBhcmFtZXRlcnM=');
@$core.Deprecated('Use playCommandDescriptor instead')
const PlayCommand$json = {
'1': 'PlayCommand',
'2': [
{'1': 'CommandContents', '3': 2, '4': 1, '5': 11, '6': '.de.jonasbark.PlayCommandContents', '10': 'CommandContents'},
],
};
/// Descriptor for `PlayCommand`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List playCommandDescriptor = $convert.base64Decode(
'CgtQbGF5Q29tbWFuZBJLCg9Db21tYW5kQ29udGVudHMYAiABKAsyIS5kZS5qb25hc2JhcmsuUG'
'xheUNvbW1hbmRDb250ZW50c1IPQ29tbWFuZENvbnRlbnRz');
@$core.Deprecated('Use idleDescriptor instead')
const Idle$json = {
'1': 'Idle',
'2': [
{'1': 'Unknown2', '3': 2, '4': 1, '5': 13, '10': 'Unknown2'},
],
};
/// Descriptor for `Idle`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List idleDescriptor = $convert.base64Decode(
'CgRJZGxlEhoKCFVua25vd24yGAIgASgNUghVbmtub3duMg==');
@$core.Deprecated('Use rideAnalogKeyPressDescriptor instead')
const RideAnalogKeyPress$json = {
'1': 'RideAnalogKeyPress',
'2': [
{'1': 'Location', '3': 1, '4': 1, '5': 14, '6': '.de.jonasbark.RideAnalogLocation', '10': 'Location'},
{'1': 'AnalogValue', '3': 2, '4': 1, '5': 17, '10': 'AnalogValue'},
],
};
/// Descriptor for `RideAnalogKeyPress`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List rideAnalogKeyPressDescriptor = $convert.base64Decode(
'ChJSaWRlQW5hbG9nS2V5UHJlc3MSPAoITG9jYXRpb24YASABKA4yIC5kZS5qb25hc2JhcmsuUm'
'lkZUFuYWxvZ0xvY2F0aW9uUghMb2NhdGlvbhIgCgtBbmFsb2dWYWx1ZRgCIAEoEVILQW5hbG9n'
'VmFsdWU=');
@$core.Deprecated('Use rideKeyPadStatusDescriptor instead')
const RideKeyPadStatus$json = {
'1': 'RideKeyPadStatus',
'2': [
{'1': 'ButtonMap', '3': 1, '4': 1, '5': 13, '10': 'ButtonMap'},
{'1': 'AnalogPaddles', '3': 3, '4': 3, '5': 11, '6': '.de.jonasbark.RideAnalogKeyPress', '10': 'AnalogPaddles'},
],
};
/// Descriptor for `RideKeyPadStatus`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List rideKeyPadStatusDescriptor = $convert.base64Decode(
'ChBSaWRlS2V5UGFkU3RhdHVzEhwKCUJ1dHRvbk1hcBgBIAEoDVIJQnV0dG9uTWFwEkYKDUFuYW'
'xvZ1BhZGRsZXMYAyADKAsyIC5kZS5qb25hc2JhcmsuUmlkZUFuYWxvZ0tleVByZXNzUg1BbmFs'
'b2dQYWRkbGVz');
@$core.Deprecated('Use clickKeyPadStatusDescriptor instead')
const ClickKeyPadStatus$json = {
'1': 'ClickKeyPadStatus',
'2': [
{'1': 'Button_Plus', '3': 1, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonPlus'},
{'1': 'Button_Minus', '3': 2, '4': 1, '5': 14, '6': '.de.jonasbark.PlayButtonStatus', '10': 'ButtonMinus'},
],
};
/// Descriptor for `ClickKeyPadStatus`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List clickKeyPadStatusDescriptor = $convert.base64Decode(
'ChFDbGlja0tleVBhZFN0YXR1cxI/CgtCdXR0b25fUGx1cxgBIAEoDjIeLmRlLmpvbmFzYmFyay'
'5QbGF5QnV0dG9uU3RhdHVzUgpCdXR0b25QbHVzEkEKDEJ1dHRvbl9NaW51cxgCIAEoDjIeLmRl'
'LmpvbmFzYmFyay5QbGF5QnV0dG9uU3RhdHVzUgtCdXR0b25NaW51cw==');
@$core.Deprecated('Use deviceInformationContentDescriptor instead')
const DeviceInformationContent$json = {
'1': 'DeviceInformationContent',
'2': [
{'1': 'Unknown1', '3': 1, '4': 1, '5': 13, '10': 'Unknown1'},
{'1': 'SoftwareVersion', '3': 2, '4': 3, '5': 13, '10': 'SoftwareVersion'},
{'1': 'DeviceName', '3': 3, '4': 1, '5': 9, '10': 'DeviceName'},
{'1': 'Unknown4', '3': 4, '4': 1, '5': 13, '10': 'Unknown4'},
{'1': 'Unknown5', '3': 5, '4': 1, '5': 13, '10': 'Unknown5'},
{'1': 'SerialNumber', '3': 6, '4': 1, '5': 9, '10': 'SerialNumber'},
{'1': 'HardwareVersion', '3': 7, '4': 1, '5': 9, '10': 'HardwareVersion'},
{'1': 'ReplyData', '3': 8, '4': 3, '5': 13, '10': 'ReplyData'},
{'1': 'Unknown9', '3': 9, '4': 1, '5': 13, '10': 'Unknown9'},
{'1': 'Unknown10', '3': 10, '4': 1, '5': 13, '10': 'Unknown10'},
{'1': 'Unknown13', '3': 13, '4': 1, '5': 13, '10': 'Unknown13'},
],
};
/// Descriptor for `DeviceInformationContent`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List deviceInformationContentDescriptor = $convert.base64Decode(
'ChhEZXZpY2VJbmZvcm1hdGlvbkNvbnRlbnQSGgoIVW5rbm93bjEYASABKA1SCFVua25vd24xEi'
'gKD1NvZnR3YXJlVmVyc2lvbhgCIAMoDVIPU29mdHdhcmVWZXJzaW9uEh4KCkRldmljZU5hbWUY'
'AyABKAlSCkRldmljZU5hbWUSGgoIVW5rbm93bjQYBCABKA1SCFVua25vd240EhoKCFVua25vd2'
'41GAUgASgNUghVbmtub3duNRIiCgxTZXJpYWxOdW1iZXIYBiABKAlSDFNlcmlhbE51bWJlchIo'
'Cg9IYXJkd2FyZVZlcnNpb24YByABKAlSD0hhcmR3YXJlVmVyc2lvbhIcCglSZXBseURhdGEYCC'
'ADKA1SCVJlcGx5RGF0YRIaCghVbmtub3duORgJIAEoDVIIVW5rbm93bjkSHAoJVW5rbm93bjEw'
'GAogASgNUglVbmtub3duMTASHAoJVW5rbm93bjEzGA0gASgNUglVbmtub3duMTM=');
@$core.Deprecated('Use subContentDescriptor instead')
const SubContent$json = {
'1': 'SubContent',
'2': [
{'1': 'Content', '3': 1, '4': 1, '5': 11, '6': '.de.jonasbark.DeviceInformationContent', '10': 'Content'},
{'1': 'Unknown2', '3': 2, '4': 1, '5': 13, '10': 'Unknown2'},
{'1': 'Unknown4', '3': 4, '4': 1, '5': 13, '10': 'Unknown4'},
{'1': 'Unknown5', '3': 5, '4': 1, '5': 13, '10': 'Unknown5'},
{'1': 'Unknown6', '3': 6, '4': 1, '5': 13, '10': 'Unknown6'},
],
};
/// Descriptor for `SubContent`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List subContentDescriptor = $convert.base64Decode(
'CgpTdWJDb250ZW50EkAKB0NvbnRlbnQYASABKAsyJi5kZS5qb25hc2JhcmsuRGV2aWNlSW5mb3'
'JtYXRpb25Db250ZW50UgdDb250ZW50EhoKCFVua25vd24yGAIgASgNUghVbmtub3duMhIaCghV'
'bmtub3duNBgEIAEoDVIIVW5rbm93bjQSGgoIVW5rbm93bjUYBSABKA1SCFVua25vd241EhoKCF'
'Vua25vd242GAYgASgNUghVbmtub3duNg==');
@$core.Deprecated('Use deviceInformationDescriptor instead')
const DeviceInformation$json = {
'1': 'DeviceInformation',
'2': [
{'1': 'InformationId', '3': 1, '4': 1, '5': 13, '10': 'InformationId'},
{'1': 'SubContent', '3': 2, '4': 1, '5': 11, '6': '.de.jonasbark.SubContent', '10': 'SubContent'},
],
};
/// Descriptor for `DeviceInformation`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List deviceInformationDescriptor = $convert.base64Decode(
'ChFEZXZpY2VJbmZvcm1hdGlvbhIkCg1JbmZvcm1hdGlvbklkGAEgASgNUg1JbmZvcm1hdGlvbk'
'lkEjgKClN1YkNvbnRlbnQYAiABKAsyGC5kZS5qb25hc2JhcmsuU3ViQ29udGVudFIKU3ViQ29u'
'dGVudA==');

View File

@@ -1,14 +0,0 @@
//
// Generated code. Do not modify.
// source: zwift.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
export 'zwift.pb.dart';

View File

@@ -1,7 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zwift.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_device.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
import 'constants.dart';

View File

@@ -1,14 +1,18 @@
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pbenum.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_ride.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/pages/markdown.dart';
import 'package:bike_control/pages/unlock.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/widgets/ui/warning.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:prop/emulators/ftms_emulator.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:universal_ble/universal_ble.dart';
final FtmsEmulator emulator = FtmsEmulator();
class ZwiftClickV2 extends ZwiftRide {
ZwiftClickV2(super.scanResult)
@@ -26,9 +30,9 @@ class ZwiftClickV2 extends ZwiftRide {
ZwiftButtons.shiftUpLeft,
ZwiftButtons.shiftUpRight,
],
);
bool _noLongerSendsEvents = false;
) {
emulator.setScanResult(scanResult);
}
@override
List<int> get startCommand => ZwiftConstants.RIDE_ON + ZwiftConstants.RESPONSE_START_CLICK_V2;
@@ -40,22 +44,34 @@ class ZwiftClickV2 extends ZwiftRide {
bool get canVibrate => false;
@override
Future<void> setupHandshake() async {
super.setupHandshake();
await sendCommandBuffer(Uint8List.fromList([0xFF, 0x04, 0x00]));
String toString() {
return "$name V2";
}
bool get isUnlocked {
final lastUnlock = propPrefs.getZwiftClickV2LastUnlock(scanResult.deviceId);
if (lastUnlock == null) {
return false;
}
return lastUnlock > DateTime.now().subtract(const Duration(days: 1));
}
@override
Future<void> processData(Uint8List bytes) {
if (bytes.startsWith(ZwiftConstants.RESPONSE_STOPPED_CLICK_V2_VARIANT_1) ||
bytes.startsWith(ZwiftConstants.RESPONSE_STOPPED_CLICK_V2_VARIANT_2)) {
_noLongerSendsEvents = true;
Future<void> handleServices(List<BleService> services) async {
emulator.handleServices(services);
await super.handleServices(services);
}
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (!emulator.processCharacteristic(characteristic, bytes)) {
await super.processCharacteristic(characteristic, bytes);
}
return super.processData(bytes);
}
@override
Widget showInformation(BuildContext context) {
final lastUnlockDate = propPrefs.getZwiftClickV2LastUnlock(scanResult.deviceId);
return StatefulBuilder(
builder: (context, setState) {
return Column(
@@ -65,49 +81,42 @@ class ZwiftClickV2 extends ZwiftRide {
children: [
super.showInformation(context),
if (isConnected && _noLongerSendsEvents)
if (core.settings.getShowZwiftClickV2ReconnectWarning())
if (isConnected && !core.settings.getShowOnboarding())
if (isUnlocked && lastUnlockDate != null)
Warning(
important: false,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
AppLocalizations.of(context).clickV2Instructions,
).xSmall,
),
IconButton.link(
icon: Icon(Icons.close),
onPressed: () {
core.settings.setShowZwiftClickV2ReconnectWarning(false);
setState(() {});
},
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
GhostButton(
onPressed: () {
sendCommand(Opcode.RESET, null);
},
child: Text('Reset now'),
Container(
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(24),
),
padding: const EdgeInsets.all(4),
child: Icon(Icons.lock_open_rounded, color: Colors.white),
),
OutlineButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
),
);
},
leading: const Icon(Icons.open_in_new),
child: Text(context.i18n.troubleshootingGuide),
Flexible(
child: Text(
AppLocalizations.of(context).unlock_unlockedUntilAroundDate(
DateFormat('EEEE, HH:MM').format(lastUnlockDate.add(const Duration(days: 1))),
),
).xSmall,
),
Tooltip(
tooltip: (c) => Text('Unlock again'),
child: IconButton.ghost(
icon: Icon(Icons.lock_reset_rounded),
onPressed: () {
openDrawer(
context: context,
position: OverlayPosition.bottom,
builder: (_) => UnlockPage(device: this),
);
},
),
),
],
),
@@ -117,22 +126,53 @@ class ZwiftClickV2 extends ZwiftRide {
Warning(
important: false,
children: [
Text(
AppLocalizations.of(context).clickV2EventInfo,
).xSmall,
LinkButton(
child: Text(context.i18n.troubleshootingGuide),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
Row(
spacing: 8,
children: [
Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(24),
),
);
},
padding: const EdgeInsets.all(4),
child: Icon(Icons.lock_rounded, color: Colors.white),
),
Flexible(child: Text(AppLocalizations.of(context).unlock_deviceIsCurrentlyLocked).xSmall),
Button(
onPressed: () {
openDrawer(
context: context,
position: OverlayPosition.bottom,
builder: (_) => UnlockPage(device: this),
);
},
leading: const Icon(Icons.lock_open_rounded),
style: ButtonStyle.primary(size: ButtonSize.small),
child: Text(AppLocalizations.of(context).unlock_unlockNow),
),
],
),
],
),
/*else
Warning(
important: false,
children: [
Text(
AppLocalizations.of(context).clickV2EventInfo,
).xSmall,
LinkButton(
child: Text(context.i18n.troubleshootingGuide),
onPressed: () {
openDrawer(
context: context,
position: OverlayPosition.bottom,
builder: (_) => MarkdownPage(assetPath: 'TROUBLESHOOTING.md'),
);
},
),
],
),*/
],
);
},

View File

@@ -1,14 +1,16 @@
import 'dart:async';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:bike_control/bluetooth/devices/bluetooth_device.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pbenum.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/single_line_exception.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:universal_ble/universal_ble.dart';
abstract class ZwiftDevice extends BluetoothDevice {
@@ -87,10 +89,10 @@ abstract class ZwiftDevice extends BluetoothDevice {
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (kDebugMode) {
if (kDebugMode && false) {
actionStreamInternal.add(
LogNotification(
"${DateTime.now().toString().split(" ").last} Received data on $characteristic: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}",
"Received data on $characteristic: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}",
),
);
}
@@ -152,10 +154,10 @@ abstract class ZwiftDevice extends BluetoothDevice {
}
@override
Future<void> handleButtonsClicked(List<ControllerButton>? buttonsClicked) async {
Future<void> handleButtonsClicked(List<ControllerButton>? buttonsClicked, {bool longPress = false}) async {
// the same messages are sent multiple times, so ignore
if (_lastButtonsClicked == null || _lastButtonsClicked?.contentEquals(buttonsClicked ?? []) == false) {
super.handleButtonsClicked(buttonsClicked);
super.handleButtonsClicked(buttonsClicked, longPress: longPress);
}
_lastButtonsClicked = buttonsClicked;
}
@@ -191,4 +193,24 @@ abstract class ZwiftDevice extends BluetoothDevice {
withoutResponse: true,
);
}
@override
Widget showInformation(BuildContext context) {
return Column(
spacing: 16,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
super.showInformation(context),
if (canVibrate)
Checkbox(
trailing: Expanded(child: Text(context.i18n.enableVibrationFeedback)),
state: core.settings.getVibrationEnabled() ? CheckboxState.checked : CheckboxState.unchecked,
onChanged: (value) async {
await core.settings.setVibrationEnabled(value == CheckboxState.checked);
},
),
],
);
}
}

View File

@@ -3,9 +3,6 @@ import 'dart:io';
import 'package:bike_control/bluetooth/ble.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/ftms_mdns_emulator.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zwift.pbserver.dart' hide RideButtonMask;
import 'package:bike_control/bluetooth/devices/zwift/zwift_ride.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
@@ -18,10 +15,13 @@ import 'package:bike_control/widgets/title.dart';
import 'package:bluetooth_low_energy/bluetooth_low_energy.dart';
import 'package:flutter/foundation.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:prop/prop.dart' hide RideButtonMask;
class ZwiftEmulator extends TrainerConnection {
bool get isLoading => _isLoading;
static const String connectionTitle = 'Zwift BLE Emulator';
late final _peripheralManager = PeripheralManager();
bool _isLoading = false;
bool _isServiceAdded = false;
@@ -32,7 +32,7 @@ class ZwiftEmulator extends TrainerConnection {
ZwiftEmulator()
: super(
title: 'Zwift BLE Emulator',
title: connectionTitle,
supportedActions: [
InGameAction.shiftUp,
InGameAction.shiftDown,
@@ -161,7 +161,7 @@ class ZwiftEmulator extends TrainerConnection {
);
final request = eventArgs.request;
final response = handleWriteRequest(eventArgs.characteristic.uuid.toString(), request.value);
final response = SharedLogic.handleWriteRequest(eventArgs.characteristic.uuid.toString(), request.value);
if (response != null) {
await _peripheralManager.notifyCharacteristic(
_central!,
@@ -306,7 +306,7 @@ class ZwiftEmulator extends TrainerConnection {
Future<void> _sendKeepAlive() async {
await Future.delayed(const Duration(seconds: 5));
if (isConnected.value) {
if (isConnected.value && _central != null) {
final zero = Uint8List.fromList([Opcode.CONTROLLER_NOTIFICATION.value, 0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F]);
_peripheralManager.notifyCharacteristic(_central!, _syncTxCharacteristic!, value: zero);
_sendKeepAlive();
@@ -360,103 +360,14 @@ class ZwiftEmulator extends TrainerConnection {
return Success('Sent action: ${keyPair.inGameAction!.name}');
}
Uint8List? handleWriteRequest(String characteristic, Uint8List value) {
print(
'Write request for characteristic: $characteristic',
);
switch (characteristic.toUpperCase()) {
case ZwiftConstants.ZWIFT_SYNC_RX_CHARACTERISTIC_UUID:
print(
'Handling write request for SYNC RX characteristic, value: ${value.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}\n${String.fromCharCodes(value)}',
);
Opcode? opcode = Opcode.valueOf(value[0]);
Uint8List message = value.sublist(1);
switch (opcode) {
case Opcode.RIDE_ON:
print('Sending handshake');
return ZwiftConstants.RIDE_ON;
case Opcode.GET:
final response = Get.fromBuffer(message);
final dataObjectType = DO.valueOf(response.dataObjectId);
print('Received GET for data object: $dataObjectType');
switch (dataObjectType) {
case DO.PAGE_DEV_INFO:
/*final devInfo = DevInfoPage(
deviceName: 'Zwift Click'.codeUnits,
deviceUid: '0B-58D15ABB4363'.codeUnits,
manufacturerId: 0x01,
serialNumber: '58D15ABB4363'.codeUnits,
protocolVersion: 515,
systemFwVersion: [0, 0, 1, 1],
productId: 11,
systemHwRevision: 'B.0'.codeUnits,
deviceCapabilities: [DevInfoPage_DeviceCapabilities(deviceType: 2, capabilities: 1)],
);
final serverInfoResponse = Uint8List.fromList([
Opcode.GET_RESPONSE.value,
...GetResponse(
dataObjectId: DO.PAGE_DEV_INFO.value,
dataObjectData: devInfo.writeToBuffer(),
).writeToBuffer(),
]);*/
// 3C080012460A440883041204000001011A0B5A7769667420436C69636B320F30422D3538443135414242343336333A03422E304204080210014801500B5A0C353844313541424234333633
final expected = Uint8List.fromList(
hexToBytes(
'3C080012460A440883041204000001011A0B5A7769667420436C69636B320F30422D3538443135414242343336333A03422E304204080210014801500B5A0C353844313541424234333633',
),
);
return expected;
case DO.PAGE_CLIENT_SERVER_CONFIGURATION:
final response = Uint8List.fromList([
Opcode.GET_RESPONSE.value,
...GetResponse(
dataObjectId: DO.PAGE_CLIENT_SERVER_CONFIGURATION.value,
dataObjectData: ClientServerCfgPage(
notifications: 0,
).writeToBuffer(),
).writeToBuffer(),
]);
return response;
case DO.PAGE_CONTROLLER_INPUT_CONFIG:
final response = Uint8List.fromList([
Opcode.GET_RESPONSE.value,
...GetResponse(
dataObjectId: DO.PAGE_CONTROLLER_INPUT_CONFIG.value,
dataObjectData: ControllerInputConfigPage(
supportedDigitalInputs: 4607,
supportedAnalogInputs: 0,
analogDeadZone: [],
analogInputRange: [],
).writeToBuffer(),
).writeToBuffer(),
]);
return response;
case DO.BATTERY_STATE:
final response = Uint8List.fromList([
Opcode.GET_RESPONSE.value,
...GetResponse(
dataObjectId: DO.BATTERY_STATE.value,
dataObjectData: BatteryStatus(
chgState: ChargingState.CHARGING_IDLE,
percLevel: 100,
timeToEmpty: 0,
timeToFull: 0,
).writeToBuffer(),
).writeToBuffer(),
]);
return response;
default:
print('Unhandled data object type for GET: $dataObjectType');
}
break;
}
break;
default:
print('Unhandled write request for characteristic: $characteristic $value');
}
return null;
void cleanup() {
_peripheralManager.stopAdvertising();
_peripheralManager.removeAllServices();
_isServiceAdded = false;
_isSubscribedToEvents = false;
_central = null;
isConnected.value = false;
isStarted.value = false;
_isLoading = false;
}
}

View File

@@ -1,30 +1,34 @@
import 'package:flutter/foundation.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zwift.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_device.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/widgets/keymap_explanation.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
class ZwiftPlay extends ZwiftDevice {
ZwiftPlay(super.scanResult)
final ZwiftDeviceType deviceType;
ZwiftPlay(super.scanResult, {required this.deviceType})
: super(
availableButtons: [
ZwiftButtons.y,
ZwiftButtons.z,
ZwiftButtons.a,
ZwiftButtons.b,
ZwiftButtons.onOffRight,
ZwiftButtons.sideButtonRight,
ZwiftButtons.paddleRight,
ZwiftButtons.navigationUp,
ZwiftButtons.navigationLeft,
ZwiftButtons.navigationRight,
ZwiftButtons.navigationDown,
ZwiftButtons.onOffLeft,
ZwiftButtons.sideButtonLeft,
ZwiftButtons.paddleLeft,
if (deviceType == ZwiftDeviceType.playLeft) ...[
ZwiftButtons.navigationUp,
ZwiftButtons.navigationLeft,
ZwiftButtons.navigationRight,
ZwiftButtons.navigationDown,
ZwiftButtons.onOffLeft,
ZwiftButtons.sideButtonLeft,
ZwiftButtons.paddleLeft,
],
if (deviceType == ZwiftDeviceType.playRight) ...[
ZwiftButtons.y,
ZwiftButtons.z,
ZwiftButtons.a,
ZwiftButtons.b,
ZwiftButtons.onOffRight,
ZwiftButtons.sideButtonRight,
ZwiftButtons.paddleRight,
],
],
);
@@ -34,6 +38,9 @@ class ZwiftPlay extends ZwiftDevice {
@override
bool get canVibrate => true;
@override
String get name => '${super.name} (${deviceType.name.splitByUpperCase().split(' ').last})';
@override
List<ControllerButton> processClickNotification(Uint8List message) {
final status = PlayKeyPadStatus.fromBuffer(message);
@@ -62,23 +69,4 @@ class ZwiftPlay extends ZwiftDevice {
@override
String get latestFirmwareVersion => '1.3.1';
@override
Widget showInformation(BuildContext context) {
return Column(
spacing: 16,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
super.showInformation(context),
Checkbox(
trailing: Expanded(child: Text(context.i18n.enableVibrationFeedback)),
state: core.settings.getVibrationEnabled() ? CheckboxState.checked : CheckboxState.unchecked,
onChanged: (value) async {
await core.settings.setVibrationEnabled(value == CheckboxState.checked);
},
),
],
);
}
}

View File

@@ -1,14 +1,12 @@
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:bike_control/bluetooth/devices/zwift/constants.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp_vendor.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zwift.pb.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_device.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
import 'package:protobuf/protobuf.dart' as $pb;
import 'package:universal_ble/universal_ble.dart';
class ZwiftRide extends ZwiftDevice {
@@ -56,7 +54,7 @@ class ZwiftRide extends ZwiftDevice {
if (kDebugMode) {
print(
'${DateTime.now().toString().split(" ").last} Received $opcode: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')} => ${String.fromCharCodes(bytes)} ',
'${DateTime.now().toString().split(" ").last} Received $opcode: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}',
);
}

View File

@@ -1,9 +1,9 @@
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/widgets/keymap_explanation.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:prop/prop.dart';
class BaseNotification {}
@@ -12,7 +12,7 @@ class LogNotification extends BaseNotification {
LogNotification(this.message) {
if (kDebugMode) {
print('LogNotification: $message');
//print('LogNotification: $message');
}
}
@@ -68,8 +68,10 @@ class ActionNotification extends BaseNotification {
class AlertNotification extends LogNotification {
final LogLevel level;
final String alertMessage;
final VoidCallback? onTap;
final String? buttonTitle;
AlertNotification(this.level, this.alertMessage) : super(alertMessage);
AlertNotification(this.level, this.alertMessage, {this.onTap, this.buttonTitle}) : super(alertMessage);
@override
String toString() {

View File

@@ -1,10 +1,6 @@
import 'dart:io';
import 'package:bluetooth_low_energy/bluetooth_low_energy.dart';
import 'package:flutter/foundation.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:bike_control/bluetooth/devices/trainer_connection.dart';
import 'package:bike_control/bluetooth/devices/zwift/protocol/zp.pb.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
@@ -12,6 +8,10 @@ import 'package:bike_control/utils/actions/remote.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/requirements/multi.dart';
import 'package:bluetooth_low_energy/bluetooth_low_energy.dart';
import 'package:flutter/foundation.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:prop/prop.dart';
import '../utils/keymap/keymap.dart';
@@ -26,9 +26,11 @@ class RemotePairing extends TrainerConnection {
Central? _central;
GATTCharacteristic? _inputReport;
static const String connectionTitle = 'Remote Control';
RemotePairing()
: super(
title: 'Remote Control',
title: connectionTitle,
supportedActions: InGameAction.values,
);
@@ -255,7 +257,7 @@ class RemotePairing extends TrainerConnection {
: ''}',
serviceUUIDs: [UUID.fromString(Platform.isIOS ? '1812' : '00001812-0000-1000-8000-00805F9B34FB')],
);
print('Starting advertising with Zwift service...');
print('Starting advertising with Remote service...');
await _peripheralManager.startAdvertising(advertisement);
_isLoading = false;

Some files were not shown because too many files have changed in this diff Show More