Compare commits

..

89 Commits

Author SHA1 Message Date
Jonas Bark
02c038daaa additional fixes 2026-02-16 18:32:31 +01:00
Jonas Bark
05352d7118 additional fixes 2026-02-16 18:22:16 +01:00
Jonas Bark
5c7e8b923b fix shimano di2 implementation 2026-02-16 17:58:10 +01:00
Jonas Bark
ceeca9dd02 training peaks BLE workaround 2026-02-16 12:10:05 +01:00
Jonas Bark
ab379cf74b shorebird cleanup 2026-02-16 11:02:59 +01:00
Jonas Bark
ad7bd646f3 cleanup 2026-02-16 11:00:20 +01:00
Jonas Bark
7ed1ba4397 fix import 2026-02-15 21:49:28 +01:00
Jonas Bark
a9cb929b01 cleanup ui 2026-02-15 21:48:04 +01:00
Jonas Bark
8d056b526e Di2: resolve issue #233 2026-02-15 21:44:02 +01:00
Jonas Bark
7a77acaf94 local connection tile always show as suggested 2026-02-15 13:40:33 +01:00
Jonas Bark
216dc97517 zwift click: send 0xff command again 2026-02-15 12:20:17 +01:00
Jonas Bark
746a680449 cleanup 2026-02-15 10:11:43 +01:00
Jonas Bark
b1385e70cc actions 2026-02-14 10:34:17 +01:00
Jonas Bark
aec24bba61 enable audio button capture on iOS 2026-02-14 10:11:25 +01:00
Jonas Bark
226824c14a actions 2026-02-14 10:06:53 +01:00
Jonas Bark
8c4816ffd0 actions 2026-02-14 10:06:29 +01:00
Jonas Bark
07423fc0f6 fix unit test 2026-02-14 09:54:32 +01:00
Jonas Bark
812a4efe13 Merge remote-tracking branch 'origin/copilot/fix-vs200-double-shifting'
# Conflicts:
#	test/thinkrider_vs200_test.dart
2026-02-14 09:51:29 +01:00
Jonas Bark
8dadc07e07 fix unit tests 2026-02-14 09:50:36 +01:00
copilot-swe-agent[bot]
15dc34b2ea Add clarifying comments for two-call pattern in handleButtonsClickedWithoutLongPressSupport
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-14 07:51:10 +00:00
copilot-swe-agent[bot]
d8a528017d Add comprehensive tests for VS200 single-click behavior
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-14 07:50:25 +00:00
copilot-swe-agent[bot]
d2a41fc2fa Fix VS200 double shifting by handling non-long-press buttons correctly
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-14 07:49:25 +00:00
copilot-swe-agent[bot]
7b2f16772d Initial plan 2026-02-14 07:42:09 +00:00
Jonas Bark
edf19e3ffa fix MyWhoosh Link issue 2026-02-12 18:23:14 +01:00
Jonas Bark
ec4e4fc375 fix public compilation 2026-02-11 09:00:00 +01:00
Jonas Bark
59141c81af support Zwift Ride with old firmware 2026-02-11 08:56:10 +01:00
Jonas Bark
732bb4a150 version++ 2026-02-10 15:15:18 +01:00
Jonas Bark
84d9d1e312 accessories should not be displayed in keymap customize tab 2026-02-10 15:15:01 +01:00
Jonas Bark
3b6f9f6f29 version++ 2026-02-10 09:44:40 +01:00
Jonas Bark
21f7636cee patch it 2026-02-10 09:13:44 +01:00
Jonas Bark
3eda3b590a update submodule 2026-02-10 09:12:38 +01:00
Jonas Bark
f844681f4c kickr headwind adjustments #11 2026-02-10 09:11:39 +01:00
Jonas Bark
5c22851d66 Merge branch 'test' 2026-02-10 08:56:49 +01:00
jonasbark
fb2068a08a Merge pull request #296 from OpenBikeControl/copilot/fix-button-press-headwind-issue
Add delay between mode change and speed commands for Wahoo KICKR Headwind
2026-02-10 08:55:43 +01:00
copilot-swe-agent[bot]
f7a0b8dca8 Fix headwind first button press issue by adding delay between mode and speed commands
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-10 07:44:37 +00:00
copilot-swe-agent[bot]
76c59537c1 Initial plan 2026-02-10 07:42:07 +00:00
Jonas Bark
81f14f16fd openbikecontrol via dircon 2026-02-08 11:28:48 +01:00
Jonas Bark
c4a8d1ef9c remove BLE services when disconnecting 2026-02-08 10:02:12 +01:00
Jonas Bark
a1cfe43ef9 cleanup toast handling 2026-02-08 10:01:54 +01:00
Jonas Bark
14f5486ab6 fix potential crash 2026-02-07 09:56:35 +01:00
jonasbark
a7e2b5bc26 Update Windows Store version from 4.6.2 to 4.7.2 2026-02-06 19:26:03 +01:00
Jonas Bark
8bea3b36cc fix patch yaml 2026-02-06 14:23:45 +01:00
Jonas Bark
2802ead254 missing methods in shared public 2026-02-06 13:20:50 +01:00
Jonas Bark
5c2ae38951 fix module 2026-02-06 13:17:23 +01:00
Jonas Bark
0dc6ea7fd4 fix module 2026-02-06 13:16:10 +01:00
Jonas Bark
288fbed819 logic fixes 2026-02-06 13:02:21 +01:00
Jonas Bark
497528c75b iOS: keep app alive in background 2026-02-06 12:51:47 +01:00
Jonas Bark
d8ceea9c63 purchasing the app on Android is now finally possible 2026-02-06 10:27:21 +01:00
Jonas Bark
bed3dac98e update submodule 2026-02-05 17:33:39 +01:00
Jonas Bark
9eaa9c53f9 add new remote keyboard connection method 2026-02-05 17:22:21 +01:00
Jonas Bark
ccd1d46128 reenable shorebird, fix button editor for remote setting 2026-02-05 14:45:21 +01:00
Jonas Bark
79edebc8f9 cleanup 2026-02-05 14:30:15 +01:00
Jonas Bark
dbf148c41f fix messages 2026-02-05 14:28:15 +01:00
Jonas Bark
fe898cefda fix #246 2026-02-05 14:23:50 +01:00
Jonas Bark
f662d0a36a Merge branch 'main' of github.com:OpenBikeControl/bikecontrol 2026-02-04 15:28:17 +01:00
jonasbark
5c8a5934f2 Merge pull request #290 from OpenBikeControl/copilot/save-enable-media-key-setting
Persist media key detection setting across app restarts
2026-02-04 15:27:49 +01:00
copilot-swe-agent[bot]
c7e845086a Simplify assignment per code review feedback
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:08:10 +00:00
copilot-swe-agent[bot]
67a4144ab0 Implement media key detection persistence
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:07:07 +00:00
copilot-swe-agent[bot]
bfeb72a775 Initial plan 2026-02-04 14:03:54 +00:00
Jonas Bark
799234c323 set long press by default for steering actions 2026-02-04 12:44:27 +01:00
jonasbark
ab49da1cea Merge pull request #286 from OpenBikeControl/copilot/update-window-title-to-bikecontrol
Fix Windows window title to display "BikeControl"
2026-02-03 10:47:52 +01:00
copilot-swe-agent[bot]
0f41c85590 Fix Windows window title to display "BikeControl"
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-03 09:39:52 +00:00
copilot-swe-agent[bot]
175ff75637 Update window title from bike_control to BikeControl
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-03 09:38:20 +00:00
copilot-swe-agent[bot]
6b60046fd5 Initial plan 2026-02-03 09:37:00 +00:00
Jonas Bark
8ecac5d619 bug fixes around keymap 2026-02-03 09:40:57 +01:00
Jonas Bark
1a463f74be reset trial period on Android 2026-02-03 08:41:12 +01:00
Jonas Bark
6fd319ffb2 reset trial period on Android 2026-02-03 08:40:31 +01:00
Jonas Bark
551ed28310 reenable web builds 2026-02-02 10:34:05 +01:00
Jonas Bark
6606586cef introduce prop_public package with stubs, fixes issue #281 2026-02-02 10:29:40 +01:00
Jonas Bark
5157f74714 Merge branch 'main' of github.com:OpenBikeControl/bikecontrol 2026-02-02 09:39:08 +01:00
Jonas Bark
8b30b9bc29 optional: use magnetometer mode in phone steering 2026-02-02 09:17:41 +01:00
jonasbark
9a74a14804 Revise MyWhoosh Link connection instructions
Updated instructions for using the MyWhoosh 'Link' connection method, including clarification on app usage and connection steps.
2026-02-01 20:02:17 +01:00
Jonas Bark
4d16eab3a7 fix shorebird, button editor being opened without copying keymap 2026-02-01 19:47:31 +01:00
Jonas Bark
76bcf2af68 fix shorebird? 2026-02-01 17:53:25 +01:00
Jonas Bark
269fb23c94 fix shorebird? 2026-02-01 17:52:31 +01:00
Jonas Bark
459597aca8 fix 2026-02-01 17:19:21 +01:00
Jonas Bark
2c153f6c22 fix 2026-02-01 17:18:49 +01:00
Jonas Bark
b66285bc83 version++ 2026-02-01 16:56:59 +01:00
Jonas Bark
e1bc66a1b6 update translations 2026-02-01 16:54:31 +01:00
Jonas Bark
fd4e5f5ce8 cleanup, proxy work 2026-02-01 16:33:03 +01:00
Jonas Bark
40a0eae187 move predefined actions for keymap 2026-02-01 10:50:35 +01:00
Jonas Bark
d26cf5eb7b cleanup streams on exit 2026-02-01 10:08:31 +01:00
Jonas Bark
2404f0fdf5 show a message in configuration when no buttons available for a device 2026-02-01 10:00:43 +01:00
Jonas Bark
50199ef077 update license notice 2026-01-31 13:59:45 +01:00
Jonas Bark
11095cf052 move repository, adjust references, license 2026-01-31 13:53:54 +01:00
Jonas Bark
69afc698dc less messages when calibrating 2026-01-30 18:06:13 +01:00
Jonas Bark
babe564f3a fix action assignment 2026-01-30 17:46:58 +01:00
jonasbark
c10666be80 Update Windows Store version to 4.6.2 2026-01-30 12:29:19 +01:00
jonasbark
67ad3fb8c5 Change YouTube video link in README.md
Updated YouTube video link in README.
2026-01-30 10:41:51 +01:00
111 changed files with 10236 additions and 1370 deletions

View File

@@ -31,8 +31,7 @@ on:
env:
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }}
FLUTTER_VERSION_MAC: 3.41.0-0.0.pre
FLUTTER_VERSION: 3.38.7
FLUTTER_VERSION: 3.41.0
jobs:
build:
@@ -52,6 +51,14 @@ jobs:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
run: |
if [ -f pubspec_overrides_ci.yaml ]; then
mv pubspec_overrides_ci.yaml pubspec_overrides.yaml
else
echo "No pubspec_overrides_ci.yaml found, skipping rename."
fi
- name: Install certificates
if: inputs.build_mac || inputs.build_ios
env:
@@ -105,8 +112,8 @@ jobs:
- name: Set Up Flutter maCOS
uses: subosito/flutter-action@v2
with:
channel: 'beta'
flutter-version: ${{ env.FLUTTER_VERSION_MAC }}
channel: 'stable'
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Generate translation files
run: |
@@ -126,12 +133,6 @@ jobs:
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
run: |
@@ -244,6 +245,15 @@ jobs:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
shell: pwsh
run: |
if (Test-Path pubspec_overrides_ci.yaml) {
Rename-Item -Path pubspec_overrides_ci.yaml -NewName pubspec_overrides.yaml
} else {
Write-Output "No pubspec_overrides_ci.yaml found, skipping rename."
}
- name: Extract version from pubspec.yaml (Windows)
shell: pwsh
run: |

View File

@@ -25,6 +25,14 @@ jobs:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
run: |
if [ -f pubspec_overrides_ci.yaml ]; then
mv pubspec_overrides_ci.yaml pubspec_overrides.yaml
else
echo "No pubspec_overrides_ci.yaml found, skipping rename."
fi
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
@@ -89,7 +97,7 @@ jobs:
echo "${{ secrets.KEYSTORE_PROPERTIES }}" > android/keystore.properties;
- name: 🚀 Shorebird Patch macOS
if: false # patch doesn't work: https://github.com/jonasbark/swiftcontrol/issues/143
if: false # patch doesn't work: https://github.com/OpenBikeControl/bikecontrol/issues/143
uses: shorebirdtech/shorebird-patch@v1
with:
platform: macos
@@ -101,7 +109,7 @@ jobs:
with:
platform: android
release-version: latest
args: '--allow-asset-diffs --allow-native-diffs -- --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }}'
args: '--allow-asset-diffs --allow-native-diffs -- --obfuscate --split-debug-info=symbols --dart-define=REVENUECAT_API_KEY_ANDROID=${{ secrets.REVENUECAT_API_KEY_ANDROID }}'
- name: 🚀 Shorebird Patch iOS
uses: shorebirdtech/shorebird-patch@v1
@@ -110,50 +118,6 @@ jobs:
release-version: latest
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
if: false
run: flutter build macos --release;
- name: Sign macOS build
if: false
env:
DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY: ${{ secrets.DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY }}
run: |
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r');
echo "VERSION=$version" >> $GITHUB_ENV;
cd build/macos/Build/Products/Release/;
/usr/bin/codesign --deep --force -s "$DEVELOPER_ID_APPLICATION_SIGNING_IDENTITY" --entitlements ../../../../../macos/Runner/Release.entitlements --options runtime BikeControl.app -v;
zip -r BikeControl.macos.zip BikeControl.app/;
#9 Upload Artifacts
- name: Upload Artifacts
if: false
uses: actions/upload-artifact@v4
with:
overwrite: true
name: Releases
path: |
build/macos/Build/Products/Release/BikeControl.macos.zip
- name: Generate release body
if: false
run: |
chmod +x scripts/generate_release_body.sh
./scripts/generate_release_body.sh > /tmp/release_body.md
# add artifact to release
- name: Create Release
if: false
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "build/macos/Build/Products/Release/BikeControl.macos.zip"
bodyFile: /tmp/release_body.md
prerelease: true
tag: v${{ env.VERSION }}
token: ${{ secrets.TOKEN }}
windows:
name: Patch Windows
runs-on: windows-latest
@@ -166,6 +130,15 @@ jobs:
submodules: recursive
token: ${{ secrets.PAT_TOKEN }}
- name: rename pubspec_overrides_ci.yaml to pubspec_overrides.yaml
shell: pwsh
run: |
if (Test-Path pubspec_overrides_ci.yaml) {
Rename-Item -Path pubspec_overrides_ci.yaml -NewName pubspec_overrides.yaml
} else {
Write-Output "No pubspec_overrides_ci.yaml found, skipping rename."
}
- name: 🐦 Setup Shorebird
uses: shorebirdtech/setup-shorebird@v1
with:
@@ -187,4 +160,4 @@ jobs:
with:
platform: windows
release-version: latest
args: '--allow-asset-diffs --allow-native-diffs'
args: '--allow-asset-diffs --allow-native-diffs -- --obfuscate --split-debug-info=symbols'

View File

@@ -4,7 +4,6 @@ on:
push:
branches:
- web
- wahoo_kickr_bike_shift
- main
paths:
- '.github/workflows/web.yml'
@@ -17,7 +16,6 @@ jobs:
build:
name: Build Web
runs-on: macos-latest
if: false
permissions:
id-token: write
@@ -28,9 +26,6 @@ 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
@@ -49,7 +44,7 @@ jobs:
run: flutter pub get
- name: Build Web
run: flutter build web --release --base-href "/swiftcontrol/"
run: flutter build web --release --base-href "/bikecontrol/"
- name: Upload static files as artifact
id: deployment

1
.gitignore vendored
View File

@@ -53,3 +53,4 @@ lib/gen/
service-account.json
.env
lib/generated
pubspec_overrides.yaml

View File

@@ -1,3 +1,24 @@
### 4.8.0 (15-02-2026)
**Features**:
- Bluetooth media buttons are now supported on iOS
- Shimano Di2: long press and double clicks are now supported:
- perform steering using long presses
- gear changes are now reflected properly without losing any button presses
### 4.7.0 (04-02-2026)
**Features**:
- new connection method: act as Bluetooth Keyboard:
Your device can now act as Bluetooth keyboard, allowing you to send keyboard shortcuts (e.g. for virtual shifting) directly to your connected device. Especially useful for tablets / iPads.
- added new keyboard shortcuts for Rouvy (Kudos, Pause workout)
**Fixes**:
- you can now finally buy the full version on Android :)
- save "Enable Media Key detection" setting across app restarts
- UI adjustments and fixes in the controller configuration screen
- iOS: Remote pairing now works again
### 4.6.0 (28-01-2026)
**Features**:

View File

@@ -1,11 +1,12 @@
## Instructions for using the MyWhoosh "Link" connection method
*
1) launch MyWhoosh on the device of your choice
2) make sure the "MyWhoosh Link" app is not active at the same time as BikeControl
3) open BikeControl, follow the on-screen instructions
1) Launch MyWhoosh on the device of your choice
2) Only needed once: open the "MyWhoosh Link" app on the same device where you want to use BikeControl. Make sure the Link app is able to connect to MyWhoosh. If it does, close MyWhoosh Link.
3) Make sure the "MyWhoosh Link" app is not active at the same time as BikeControl
4) Open BikeControl, enable the Link connection method, and follow the on-screen instructions
Here's a video with a few explanations. Note it uses an older version, but the idea is the same.
Here's a video with a few explanations. Note that 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)

771
LICENSE
View File

@@ -1,674 +1,97 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
License notice:
Versions of this project released prior to repository tag gpl3 were licensed
under GPL-3.0. Those versions remain available under their original
license. Versions released after that point are licensed under the
Non-Commercial License.
NON-COMMERCIAL SOFTWARE LICENSE AGREEMENT
Version 1.0
Copyright (c) 2026 OpenBikeControl UG (haftungsbeschränkt).
All rights reserved.
1. Definitions
“Software” means the source code, object code, binaries, and associated documentation made available by the Licensor under this License.
“Commercial Use” means any use of the Software, directly or indirectly, that is intended for or results in:
• monetary compensation,
• sale, licensing, or subscription fees,
• advertising or sponsorship revenue,
• inclusion in a product or service that is sold or monetized,
• distribution through paid applications or application marketplaces.
“Licensor” means the copyright holder.
2. Grant of License
Subject to the terms of this License, the Licensor grants you a non-exclusive, non-transferable, revocable license to:
• use the Software for personal, educational, or internal evaluation purposes only;
• modify the Software for non-commercial purposes;
• redistribute the Software only in source form, free of charge, and only under this same License.
3. Restrictions
You may not, without prior written permission from the Licensor:
• use the Software for any Commercial Use;
• distribute the Software as part of a paid or monetized product or service;
• distribute the Software via application marketplaces (including but not limited to Apple App Store or Google Play) where the application itself or related services are monetized;
• sublicense, sell, rent, or lease the Software.
4. Attribution
All copies and derivative works must retain:
• this License text;
• all existing copyright notices.
5. No Patent License
This License does not grant any patent rights.
6. Termination
Any violation of this License automatically terminates your rights under this License.
Upon termination, you must cease all use and distribution of the Software.
7. Disclaimer of Warranty
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
8. Limitation of Liability
IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY DAMAGES ARISING FROM THE USE OF THE SOFTWARE.
9. Governing Law
This License shall be governed by the laws of [YOUR COUNTRY], excluding conflict-of-law rules.
10. Commercial Licensing
Commercial use is available under separate commercial license terms.
Contact: jonas@openbikecontrol.org
End of License

View File

@@ -11,7 +11,7 @@ With BikeControl you can **control your favorite trainer app** using your Zwift
- control music on your device
- more? If you can do it via keyboard, mouse, or touch, you can do it with BikeControl
[![Youtube Video](https://github.com/user-attachments/assets/1bd49f4c-e920-4ad1-ba68-99c7bc9bd1ab)](https://www.youtube.com/watch?v=rK6Zthcl2UU)
[![Youtube Video](https://github.com/user-attachments/assets/14a45ca1-e31b-4fbd-8d03-95aa60470405)](https://youtu.be/0r3LO5lFlyc)
## Download
@@ -75,7 +75,7 @@ Support for other devices can be added; check the issues tab here on GitHub.
## Supported Platforms
Follow the "Get Started" button over at [bikecontrol.app](https://bikecontrol.app) to understand on which platform you want to run BikeControl.
You can even try it out in your [Browser](https://jonasbark.github.io/swiftcontrol/), if it supports Bluetooth connections. No controlling possible, though.
You can even try it out in your [Browser](https://openbikecontrol.github.io/bikecontrol/), if it supports Bluetooth connections. No controlling possible, though.
## Help
Check the troubleshooting guide [here](TROUBLESHOOTING.md).

View File

@@ -22,7 +22,7 @@ If you don't do that BikeControl will need to reconnect every minute.
4. Keep it connected for ~1030 seconds
5. Close Zwift completely, then connect in BikeControl
Details/updates: https://github.com/jonasbark/swiftcontrol/issues/68
Details/updates: https://github.com/OpenBikeControl/bikecontrol/issues/68
## Android: Connection works, buttons work but nothing happens in MyWhoosh and similar
*
@@ -30,7 +30,7 @@ Details/updates: https://github.com/jonasbark/swiftcontrol/issues/68
- disable battery optimization for BikeControl
- enable auto start of BikeControl
- grant accessibility permission for BikeControl
- see [https://github.com/jonasbark/swiftcontrol/issues/38](https://github.com/OpenBikeControl/bikecontrol/issues/38) for more details
- see [https://github.com/OpenBikeControl/bikecontrol/issues/38](https://github.com/OpenBikeControl/bikecontrol/issues/38) for more details
## My Clicks do not get recognized in MyWhoosh, but I am connected / use local control

View File

@@ -1 +1 @@
4.4.1
4.7.2

View File

@@ -73,7 +73,7 @@ class AccessibilityService : AccessibilityService(), Listener {
override fun onKeyEvent(event: KeyEvent): Boolean {
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))) {
if (!Observable.ignoreHidDevices && isBleRemote(event) && (rootInActiveWindow?.packageName == "de.jonasbark.swiftcontrol" || Observable.handledKeys.contains(keyString))) {
// Handle keys that have a keymap defined
Log.d(
"AccessibilityService",

BIN
assets/silence.mp3 Normal file

Binary file not shown.

View File

@@ -1,4 +1,6 @@
PODS:
- audio_session (0.0.1):
- Flutter
- bluetooth_low_energy_darwin (0.0.1):
- Flutter
- FlutterMacOS
@@ -25,6 +27,9 @@ PODS:
- Flutter
- ios_receipt (0.0.1):
- Flutter
- just_audio (0.0.1):
- Flutter
- FlutterMacOS
- media_key_detector_ios (0.0.1):
- Flutter
- nsd_ios (0.0.1):
@@ -63,6 +68,7 @@ PODS:
- Flutter
DEPENDENCIES:
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- bluetooth_low_energy_darwin (from `.symlinks/plugins/bluetooth_low_energy_darwin/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
@@ -75,6 +81,7 @@ DEPENDENCIES:
- 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`)
- just_audio (from `.symlinks/plugins/just_audio/darwin`)
- 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`)
@@ -96,6 +103,8 @@ SPEC REPOS:
- RevenueCatUI
EXTERNAL SOURCES:
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
bluetooth_low_energy_darwin:
:path: ".symlinks/plugins/bluetooth_low_energy_darwin/darwin"
device_info_plus:
@@ -120,6 +129,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/integration_test/ios"
ios_receipt:
:path: ".symlinks/plugins/ios_receipt/ios"
just_audio:
:path: ".symlinks/plugins/just_audio/darwin"
media_key_detector_ios:
:path: ".symlinks/plugins/media_key_detector_ios/ios"
nsd_ios:
@@ -146,6 +157,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wakelock_plus/ios"
SPEC CHECKSUMS:
audio_session: 19e9480dbdd4e5f6c4543826b2e8b0e4ab6145fe
bluetooth_low_energy_darwin: 50bc79258e60586e4c4bed5948bd31d925f37fac
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
@@ -158,6 +170,7 @@ SPEC CHECKSUMS:
in_app_review: 436034b18594851a7328d7f1c2ed5ec235b79cfc
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
ios_receipt: c2d5b4c36953c377a024992393976214ce6951e6
just_audio: a42c63806f16995daf5b219ae1d679deb76e6a79
media_key_detector_ios: 7ff9aefdfea00bb7b71e184132381b7d0e7e1269
nsd_ios: 8c37babdc6538e3350dbed3a52674d2edde98173
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4

View File

@@ -280,10 +280,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
@@ -372,10 +376,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";

View File

@@ -30,21 +30,22 @@
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>BikeControl uses Bluetooth to connect to accessories.</string>
<key>NSBonjourServices</key>
<array>
<string>_wahoo-fitness-tnp._tcp</string>
<string>_openbikecontrol._tcp</string>
</array>
<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>
<string>_openbikecontrol._tcp</string>
</array>
<string>Access your accelerometer and gyroscope for steering support via your phone.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-peripheral</string>
<string>bluetooth-central</string>
<string>audio</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

View File

@@ -64,8 +64,10 @@ class Connection {
lastLogEntries = lastLogEntries.takeLast(kIsWeb ? 1000 : 60).toList();
});
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows)) {
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isIOS)) {
core.mediaKeyHandler.initialize();
// Load saved media key detection state
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value = core.settings.getMediaKeyDetectionEnabled();
}
UniversalBle.onAvailabilityChange = (available) {
@@ -94,26 +96,36 @@ class Connection {
if (_lastScanResult.none((e) => e.deviceId == result.deviceId && e.services.contentEquals(result.services))) {
_lastScanResult.add(result);
if (false) {
debugPrint('Scan result: ${result.name} - ${result.deviceId}');
if (kDebugMode) {
debugPrint('Scan result: ${result.name} - ${result.deviceId} - Services: ${result.services}');
}
final scanResult = BluetoothDevice.fromScanResult(result);
try {
final scanResult = BluetoothDevice.fromScanResult(result);
if (scanResult != null) {
_actionStreams.add(
LogNotification('Found new device: ${kIsWeb ? scanResult.toString() : scanResult.runtimeType}'),
);
addDevices([scanResult]);
} else {
final manufacturerData = result.manufacturerDataList;
final data = manufacturerData
.firstOrNullWhere((e) => e.companyId == ZwiftConstants.ZWIFT_MANUFACTURER_ID)
?.payload;
if (data != null && kDebugMode) {
if (scanResult != null) {
_actionStreams.add(
LogNotification('Found unknown device ${result.name} with identifier: ${data.firstOrNull}'),
LogNotification('Found new device: ${kIsWeb ? scanResult.toString() : scanResult.runtimeType}'),
);
addDevices([scanResult]);
} else {
final manufacturerData = result.manufacturerDataList;
final data = manufacturerData
.firstOrNullWhere((e) => e.companyId == ZwiftConstants.ZWIFT_MANUFACTURER_ID)
?.payload;
if (data != null && kDebugMode) {
_actionStreams.add(
LogNotification('Found unknown device ${result.name} with identifier: ${data.firstOrNull}'),
);
}
}
} catch (e, backtrace) {
_actionStreams.add(
LogNotification("Error processing scan result for device ${result.deviceId}: $e\n$backtrace"),
);
if (kDebugMode) {
print(e);
print("backtrace: $backtrace");
}
}
}

View File

@@ -49,6 +49,8 @@ abstract class BaseDevice {
String get name => _name ?? runtimeType.toString();
String get buttonExplanation => isConnected ? 'Connecting...' : 'Click a button on this device to configure them.';
@override
bool operator ==(Object other) =>
identical(this, other) ||
@@ -67,18 +69,24 @@ abstract class BaseDevice {
Future<void> connect();
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
// For long press actions: perform down, wait, then release
await handleButtonsClicked(clickedButtons, longPress: true);
_longPressTimer?.cancel();
await Future.delayed(const Duration(milliseconds: 800));
await handleButtonsClicked([], longPress: true);
} else {
await handleButtonsClicked([], longPress: true);
// For non-long-press actions: perform a single click
// First call performs the click action (isKeyDown: true, isKeyUp: true)
await handleButtonsClicked(clickedButtons);
// Second call cleans up state (clears timer, logs release, clears _previouslyPressedButtons)
// but doesn't perform a release action since longPress: false
await handleButtonsClicked([]);
}
} else {
await handleButtonsClicked(clickedButtons);
await handleButtonsClicked([]);
}
}

View File

@@ -3,6 +3,7 @@ import 'dart:async';
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/proxy/proxy_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';
@@ -14,7 +15,6 @@ import 'package:bike_control/bluetooth/devices/zwift/zwift_clickv2.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_device.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_play.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_ride.dart';
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';
@@ -47,8 +47,8 @@ abstract class BluetoothDevice extends BaseDevice {
scanResult.name,
uniqueId: scanResult.deviceId,
availableButtons: allowMultiple
? availableButtons.map((b) => b.copyWith(sourceDeviceId: scanResult.deviceId)).toList()
: availableButtons,
? availableButtons.toList().map((b) => b.copyWith(sourceDeviceId: scanResult.deviceId)).toList()
: availableButtons.toList(),
isBeta: isBeta,
buttonPrefix: buttonPrefix,
) {
@@ -61,6 +61,7 @@ abstract class BluetoothDevice extends BaseDevice {
static List<String> servicesToScan = [
ZwiftConstants.ZWIFT_CUSTOM_SERVICE_UUID,
ZwiftConstants.ZWIFT_CUSTOM_SERVICE_SHORT_UUID,
ZwiftConstants.ZWIFT_RIDE_CUSTOM_SERVICE_UUID,
SquareConstants.SERVICE_UUID,
WahooKickrBikeShiftConstants.SERVICE_UUID,
@@ -123,6 +124,7 @@ abstract class BluetoothDevice extends BaseDevice {
_ when scanResult.services.contains(ShimanoDi2Constants.SERVICE_UUID_ALTERNATIVE.toLowerCase()) => ShimanoDi2(
scanResult,
),
_ when scanResult.services.containsAny(ProxyDevice.proxyServiceUUIDs) && kDebugMode => ProxyDevice(scanResult),
_ when scanResult.services.contains(SramAxsConstants.SERVICE_UUID.toLowerCase()) => SramAxs(
scanResult,
),
@@ -139,6 +141,7 @@ abstract class BluetoothDevice extends BaseDevice {
return device;
} else if (scanResult.services.containsAny([
ZwiftConstants.ZWIFT_CUSTOM_SERVICE_UUID.toLowerCase(),
ZwiftConstants.ZWIFT_CUSTOM_SERVICE_SHORT_UUID.toLowerCase(),
ZwiftConstants.ZWIFT_RIDE_CUSTOM_SERVICE_UUID.toLowerCase(),
])) {
// otherwise use the manufacturer data to identify the device
@@ -167,13 +170,10 @@ abstract class BluetoothDevice extends BaseDevice {
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),
);
}
buildToast(
title: 'You may need to update your Zwift Ride firmware.',
duration: Duration(seconds: 6),
);
}
return device;
}

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:math';
import 'package:bike_control/bluetooth/devices/base_device.dart';
import 'package:bike_control/bluetooth/devices/gyroscope/steering_estimator.dart';
@@ -10,7 +11,6 @@ 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';
@@ -28,6 +28,7 @@ class GyroscopeSteering extends BaseDevice {
StreamSubscription<GyroscopeEvent>? _gyroscopeSubscription;
StreamSubscription<AccelerometerEvent>? _accelerometerSubscription;
StreamSubscription<MagnetometerEvent>? _magnetometerSubscription;
// Calibration state
final SteeringEstimator _estimator = SteeringEstimator();
@@ -45,7 +46,17 @@ class GyroscopeSteering extends BaseDevice {
// Debounce timer for PWM-like keypress behavior
Timer? _keypressTimer;
bool _isProcessingKeypresses = false;
// Magnetometer mode
bool _useMagnetometer = false;
double? _magnetometerCalibrationHeading;
double _currentMagnetometerAngle = 0.0;
final List<double> _magnetometerCalibrationSamples = [];
// Magnetometer filtering state
double? _filteredMagX;
double? _filteredMagY;
static const double _magnetometerFilterAlpha = 0.15; // Lower = more smoothing
// Configuration (can be made customizable later)
static const double STEERING_THRESHOLD = 5.0; // degrees
@@ -55,14 +66,27 @@ class GyroscopeSteering extends BaseDevice {
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;
}
/// Start listening to the appropriate sensors based on the current mode
Future<void> _startSensorStreams() async {
// Cancel all existing subscriptions first
await _gyroscopeSubscription?.cancel();
await _accelerometerSubscription?.cancel();
await _magnetometerSubscription?.cancel();
_gyroscopeSubscription = null;
_accelerometerSubscription = null;
_magnetometerSubscription = null;
try {
// Start listening to sensors
if (_useMagnetometer) {
// Magnetometer mode: only listen to magnetometer
_magnetometerSubscription = magnetometerEventStream().listen(
_handleMagnetometerEvent,
onError: (error) {
actionStreamInternal.add(LogNotification('Magnetometer error: $error'));
},
);
actionStreamInternal.add(LogNotification('Started magnetometer stream'));
} else {
// Gyroscope mode: listen to gyroscope and accelerometer
_gyroscopeSubscription = gyroscopeEventStream().listen(
_handleGyroscopeEvent,
onError: (error) {
@@ -76,6 +100,19 @@ class GyroscopeSteering extends BaseDevice {
actionStreamInternal.add(LogNotification('Accelerometer error: $error'));
},
);
actionStreamInternal.add(LogNotification('Started gyroscope and accelerometer streams'));
}
}
@override
Future<void> connect() async {
if (isConnected) {
return;
}
try {
// Start listening to sensors based on current mode
await _startSensorStreams();
isConnected = true;
actionStreamInternal.add(LogNotification('Gyroscope Steering: Connected - Calibrating...'));
@@ -120,9 +157,9 @@ class GyroscopeSteering extends BaseDevice {
if (_estimator.stillTimeSec >= 0.6) {
_estimator.calibrate(seedBiasZRadPerSec: _estimator.biasZRadPerSec);
_isCalibrated = true;
actionStreamInternal.add(
/*actionStreamInternal.add(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Calibration complete.'),
);
);*/
}
return;
}
@@ -135,6 +172,83 @@ class GyroscopeSteering extends BaseDevice {
_estimator.updateAccel(x: event.x, y: event.y, z: event.z);
}
void _handleMagnetometerEvent(MagnetometerEvent event) {
// Magnetometer mode: calculate heading from X and Y components
// This is more stable than using a single axis
// Apply low-pass filter to reduce noise
if (_filteredMagX == null || _filteredMagY == null) {
// Initialize on first reading
_filteredMagX = event.x;
_filteredMagY = event.y;
} else {
// Exponential moving average (low-pass filter)
_filteredMagX = _magnetometerFilterAlpha * event.x + (1 - _magnetometerFilterAlpha) * _filteredMagX!;
_filteredMagY = _magnetometerFilterAlpha * event.y + (1 - _magnetometerFilterAlpha) * _filteredMagY!;
}
// Calculate heading from filtered X and Y components
// atan2(y, x) gives the angle in radians, convert to degrees
double heading = atan2(_filteredMagY!, _filteredMagX!) * (180 / pi);
// Normalize heading to 0-360 range
if (heading < 0) heading += 360;
if (kDebugMode) {
print(
'Magnetometer - X: ${event.x.toStringAsFixed(2)}, Y: ${event.y.toStringAsFixed(2)}, '
'Filtered X: ${_filteredMagX!.toStringAsFixed(2)}, Filtered Y: ${_filteredMagY!.toStringAsFixed(2)}, '
'Heading: ${heading.toStringAsFixed(2)}°',
);
}
// During calibration, collect heading samples
if (!_isCalibrated) {
_magnetometerCalibrationSamples.add(heading);
// After 30 samples (~1 second at typical rates), calculate calibration heading
if (_magnetometerCalibrationSamples.length >= 30) {
// For heading, we need to handle the circular nature (0° and 360° are the same)
// Use circular mean calculation
double sumSin = 0, sumCos = 0;
for (var h in _magnetometerCalibrationSamples) {
final radians = h * (pi / 180);
sumSin += sin(radians);
sumCos += cos(radians);
}
final avgSin = sumSin / _magnetometerCalibrationSamples.length;
final avgCos = sumCos / _magnetometerCalibrationSamples.length;
_magnetometerCalibrationHeading = atan2(avgSin, avgCos) * (180 / pi);
if (_magnetometerCalibrationHeading! < 0)
_magnetometerCalibrationHeading = _magnetometerCalibrationHeading! + 360;
_magnetometerCalibrationSamples.clear();
_isCalibrated = true;
actionStreamInternal.add(
LogNotification(
'Magnetometer calibration complete. Reference heading: ${_magnetometerCalibrationHeading!.toStringAsFixed(2)}°',
),
);
}
return;
}
// Calculate steering angle relative to calibrated heading
// This is the angular difference, accounting for wrap-around
double angleDeg = heading - _magnetometerCalibrationHeading!;
// Normalize to -180 to +180 range
if (angleDeg > 180) {
angleDeg -= 360;
} else if (angleDeg < -180) {
angleDeg += 360;
}
_currentMagnetometerAngle = angleDeg;
_processSteeringAngle(angleDeg);
}
void _processSteeringAngle(double steeringAngleDeg) {
final roundedAngle = steeringAngleDeg.round();
@@ -180,13 +294,20 @@ class GyroscopeSteering extends BaseDevice {
Future<void> disconnect() async {
await _gyroscopeSubscription?.cancel();
await _accelerometerSubscription?.cancel();
await _magnetometerSubscription?.cancel();
_gyroscopeSubscription = null;
_accelerometerSubscription = null;
_magnetometerSubscription = null;
_keypressTimer?.cancel();
isConnected = false;
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
_magnetometerCalibrationHeading = null;
_magnetometerCalibrationSamples.clear();
_currentMagnetometerAngle = 0.0;
_filteredMagX = null;
_filteredMagY = null;
actionStreamInternal.add(LogNotification('Gyroscope Steering: Disconnected'));
}
@@ -208,6 +329,38 @@ class GyroscopeSteering extends BaseDevice {
if (isBeta) BetaPill(),
],
),
// Magnetometer mode toggle
Checkbox(
trailing: Expanded(child: Text('Use Magnetometer Mode')),
state: _useMagnetometer ? CheckboxState.checked : CheckboxState.unchecked,
onChanged: (value) async {
setState(() {
_useMagnetometer = value == CheckboxState.checked;
// Reset calibration when switching modes
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
_lastGyroUpdate = null;
_lastRoundedAngle = null;
_lastSteeringButton = null;
_magnetometerCalibrationHeading = null;
_magnetometerCalibrationSamples.clear();
_currentMagnetometerAngle = 0.0;
_filteredMagX = null;
_filteredMagY = null;
});
// Restart sensor streams if device is connected
if (isConnected) {
await _startSensorStreams();
actionStreamInternal.add(
LogNotification(
'Switched to ${_useMagnetometer ? "magnetometer" : "gyroscope + accelerometer"} mode',
),
);
}
},
),
Wrap(
spacing: 12,
runSpacing: 12,
@@ -220,14 +373,22 @@ class GyroscopeSteering extends BaseDevice {
DeviceInfo(
title: 'Steering Angle',
icon: RadixIcons.angle,
value: _isCalibrated ? '${_estimator.angleDeg.toStringAsFixed(2)}°' : 'Calibrating...',
value: _isCalibrated
? '${(_useMagnetometer ? _currentMagnetometerAngle : _estimator.angleDeg).toStringAsFixed(2)}°'
: 'Calibrating...',
),
if (kDebugMode)
if (kDebugMode && !_useMagnetometer)
DeviceInfo(
title: 'Gyro Bias',
icon: BootstrapIcons.speedometer,
value: '${_estimator.biasZRadPerSec.toStringAsFixed(4)} rad/s',
),
if (kDebugMode && _useMagnetometer && _magnetometerCalibrationHeading != null)
DeviceInfo(
title: 'Mag Heading',
icon: BootstrapIcons.compass,
value: '${_magnetometerCalibrationHeading!.toStringAsFixed(2)}°',
),
],
),
Row(
@@ -241,14 +402,19 @@ class GyroscopeSteering extends BaseDevice {
: () {
// Reset calibration
_isCalibrated = false;
_hasAccelData = false;
_estimator.reset();
_lastGyroUpdate = null;
if (_useMagnetometer) {
_magnetometerCalibrationHeading = null;
_magnetometerCalibrationSamples.clear();
_currentMagnetometerAngle = 0.0;
_filteredMagX = null;
_filteredMagY = null;
} else {
_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...'),
@@ -292,7 +458,9 @@ class GyroscopeSteering extends BaseDevice {
),
if (!_isCalibrated)
Text(
'Calibrating the sensors now. Attach your phone/tablet on your handlebar and keep it still for a second.',
_useMagnetometer
? 'Calibrating the magnetometer now. Attach your phone/tablet on your handlebar and keep it still for a second.'
: 'Calibrating the sensors now. Attach your phone/tablet on your handlebar and keep it still for a second.',
).xSmall,
],
),

View File

@@ -32,6 +32,7 @@ class HidDevice extends BaseDevice {
(core.actionHandler as AndroidActions).ignoreHidDevices();
} else if (core.mediaKeyHandler.isMediaKeyDetectionEnabled.value) {
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value = false;
core.settings.setMediaKeyDetectionEnabled(false);
}
},
),

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';
import 'package:bike_control/bluetooth/devices/trainer_connection.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,6 +10,7 @@ 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';
import 'package:prop/prop.dart';
class WhooshLink extends TrainerConnection {
Socket? _socket;
@@ -66,16 +66,17 @@ class WhooshLink extends TrainerConnection {
// Accept connection
_server!.listen(
(Socket socket) {
(Socket socket) async {
if (kDebugMode) {
print('Client connected: ${socket.remoteAddress.address}:${socket.remotePort}');
}
SharedLogic.keepAlive();
_socket = socket;
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, AppLocalizations.current.myWhooshLinkConnected),
);
isConnected.value = true;
if (kDebugMode) {
print('Client connected: ${socket.remoteAddress.address}:${socket.remotePort}');
}
// Listen for data from the client
socket.listen(
(List<int> data) {
@@ -89,6 +90,8 @@ class WhooshLink extends TrainerConnection {
},
onDone: () {
print('Client disconnected: $socket');
SharedLogic.stopKeepAlive();
isConnected.value = false;
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_WARNING, 'MyWhoosh Link disconnected'),

View File

@@ -104,18 +104,26 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
'Notify state changed for characteristic: ${char.characteristic.uuid}: ${char.state}',
);
});
Uint8List? firstAppInfoMessage;
_peripheralManager.characteristicWriteRequested.forEach((eventArgs) async {
final characteristic = eventArgs.characteristic;
final request = eventArgs.request;
final value = request.value;
print(
'Write request for characteristic: ${characteristic.uuid}',
);
if (kDebugMode) {
print('Write request for characteristic: ${characteristic.uuid}: ${bytesToReadableHex(value)}');
}
switch (eventArgs.characteristic.uuid.toString().toLowerCase()) {
case OpenBikeControlConstants.APPINFO_CHARACTERISTIC_UUID:
try {
final appInfo = OpenBikeProtocolParser.parseAppInfo(value);
// use this fallback if first message is incomplete (e.g. TrainingPeaks on macOS)
AppInfo appInfo = OpenBikeProtocolParser.parseAppInfo(
Uint8List.fromList([...?firstAppInfoMessage, ...value]),
);
firstAppInfoMessage = null;
isConnected.value = true;
connectedApp.value = appInfo;
supportedActions = appInfo.supportedButtons.mapNotNull((b) => b.action).toList();
@@ -125,6 +133,10 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
core.connection.signalNotification(LogNotification('Parsed App Info: $appInfo'));
} catch (e) {
core.connection.signalNotification(LogNotification('Error parsing App Info ${bytesToHex(value)}: $e'));
if (firstAppInfoMessage == null) {
firstAppInfoMessage = value;
return;
}
}
break;
default:
@@ -228,6 +240,8 @@ class OpenBikeControlBluetoothEmulator extends TrainerConnection {
if (kDebugMode) {
print('Stopping OpenBikeControl BLE server...');
}
await _peripheralManager.removeAllServices();
_isServiceAdded = false;
await _peripheralManager.stopAdvertising();
isStarted.value = false;
isConnected.value = false;

View File

@@ -0,0 +1,39 @@
import 'package:bike_control/bluetooth/devices/openbikecontrol/openbikecontrol_device.dart';
import 'package:prop/emulators/dircon/dircon.dart';
import 'package:universal_ble/universal_ble.dart';
abstract class OnMessage {
void onMessage(List<int> message);
}
class ObcDircon extends DirCon {
final OnMessage onMessageCallback;
ObcDircon({required super.socket, required this.onMessageCallback});
@override
List<BleCharacteristic> getCharacteristics(String serviceUUID) {
if (serviceUUID.toLowerCase() == OpenBikeControlConstants.SERVICE_UUID) {
return [
BleCharacteristic(
OpenBikeControlConstants.BUTTON_STATE_CHARACTERISTIC_UUID,
[CharacteristicProperty.notify],
),
BleCharacteristic(
OpenBikeControlConstants.APPINFO_CHARACTERISTIC_UUID,
[CharacteristicProperty.writeWithoutResponse, CharacteristicProperty.write],
),
];
}
return [];
}
@override
void processWriteCallback(String characteristicUUID, List<int> characteristicData) {
if (characteristicUUID.toLowerCase() == OpenBikeControlConstants.APPINFO_CHARACTERISTIC_UUID) {
onMessageCallback.onMessage(characteristicData);
}
}
@override
List<String> get serviceUUIDs => [OpenBikeControlConstants.SERVICE_UUID];
}

View File

@@ -1,11 +1,13 @@
import 'dart:io';
import 'package:bike_control/bluetooth/devices/openbikecontrol/obc_dircon.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/messages/notification.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/apps/supported_app.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
import 'package:dartx/dartx.dart';
@@ -13,7 +15,7 @@ import 'package:flutter/foundation.dart';
import 'package:nsd/nsd.dart';
import 'package:prop/prop.dart';
class OpenBikeControlMdnsEmulator extends TrainerConnection {
class OpenBikeControlMdnsEmulator extends TrainerConnection implements OnMessage {
ServerSocket? _server;
Registration? _mdnsRegistration;
@@ -22,6 +24,7 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
final ValueNotifier<AppInfo?> connectedApp = ValueNotifier(null);
Socket? _socket;
ObcDircon? _dirCon;
OpenBikeControlMdnsEmulator()
: super(
@@ -29,6 +32,9 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
supportedActions: InGameAction.values,
);
bool get _useDirCon =>
core.settings.getTrainerApp()?.supportsOpenBikeProtocol.contains(OpenBikeProtocolSupport.dircon) ?? false;
Future<void> startServer() async {
print('Starting mDNS server...');
isStarted.value = true;
@@ -64,18 +70,23 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
_mdnsRegistration = await register(
Service(
name: 'BikeControl',
type: '_openbikecontrol._tcp',
type: _useDirCon ? '_wahoo-fitness-tnp._tcp' : '_openbikecontrol._tcp',
port: 36867,
//hostName: 'KICKR BIKE SHIFT B84D.local',
addresses: [localIP],
txt: {
'version': Uint8List.fromList([0x01]),
'id': Uint8List.fromList('1337'.codeUnits),
'name': Uint8List.fromList('BikeControl'.codeUnits),
'service-uuids': Uint8List.fromList(OpenBikeControlConstants.SERVICE_UUID.codeUnits),
'manufacturer': Uint8List.fromList('OpenBikeControl'.codeUnits),
'model': Uint8List.fromList('BikeControl app'.codeUnits),
},
txt: _useDirCon
? {
'ble-service-uuids': Uint8List.fromList(OpenBikeControlConstants.SERVICE_UUID.codeUnits),
'mac-address': Uint8List.fromList('00:11:22:33:44:55'.codeUnits),
'serial-number': Uint8List.fromList('1234567890'.codeUnits),
}
: {
'version': Uint8List.fromList([0x01]),
'id': Uint8List.fromList('1337'.codeUnits),
'name': Uint8List.fromList('BikeControl'.codeUnits),
'service-uuids': Uint8List.fromList(OpenBikeControlConstants.SERVICE_UUID.codeUnits),
'manufacturer': Uint8List.fromList('OpenBikeControl'.codeUnits),
'model': Uint8List.fromList('BikeControl app'.codeUnits),
},
),
);
print('Service: ${_mdnsRegistration!.id} at ${localIP.address}:$_mdnsRegistration');
@@ -104,7 +115,7 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
Future<void> _createTcpServer() async {
try {
_server = await ServerSocket.bind(
InternetAddress.anyIPv6,
InternetAddress.anyIPv4,
36867,
shared: true,
v6Only: false,
@@ -119,40 +130,33 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
// Accept connection
_server!.listen(
(Socket socket) {
(Socket socket) async {
SharedLogic.keepAlive();
_socket = socket;
if (kDebugMode) {
print('Client connected: ${socket.remoteAddress.address}:${socket.remotePort}');
}
if (_useDirCon) {
_dirCon = ObcDircon(socket: socket, onMessageCallback: this);
}
// Listen for data from the client
socket.listen(
(List<int> data) {
if (kDebugMode) {
print('Received message: ${bytesToHex(data)}');
}
final messageType = data[0];
switch (messageType) {
case OpenBikeProtocolParser.MSG_TYPE_APP_INFO:
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}'),
);
} catch (e) {
core.connection.signalNotification(LogNotification('Failed to parse app info: $e'));
}
break;
default:
print('Unknown message type: $messageType');
if (_dirCon != null) {
_dirCon!.handleIncomingData(data);
return;
}
onMessage(data);
},
onDone: () {
_dirCon = null;
SharedLogic.stopKeepAlive();
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, 'Disconnected from app: ${connectedApp.value?.appId}'),
);
@@ -205,6 +209,40 @@ class OpenBikeControlMdnsEmulator extends TrainerConnection {
void _write(Socket socket, List<int> responseData) {
debugPrint('Sending response: ${bytesToHex(responseData)}');
socket.add(responseData);
if (_dirCon != null) {
_dirCon!.sendCharacteristicNotification(OpenBikeControlConstants.BUTTON_STATE_CHARACTERISTIC_UUID, responseData);
return;
} else {
socket.add(responseData);
}
}
@override
void onMessage(List<int> message) {
if (kDebugMode) {
print('Received message from OBC: ${bytesToHex(message)}');
}
final messageType = message[0];
switch (messageType) {
case OpenBikeProtocolParser.MSG_TYPE_APP_INFO:
try {
final appInfo = OpenBikeProtocolParser.parseAppInfo(Uint8List.fromList(message));
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}'),
);
} catch (e) {
core.connection.signalNotification(LogNotification('Failed to parse app info: $e'));
}
break;
case OpenBikeProtocolParser.MSG_TYPE_HAPTIC_FEEDBACK:
// noop
break;
default:
print('Unknown message type: $messageType');
}
}
}

View File

@@ -0,0 +1,66 @@
import 'dart:typed_data';
import 'package:bike_control/bluetooth/devices/bluetooth_device.dart';
import 'package:prop/emulators/ftms_emulator.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:universal_ble/universal_ble.dart';
class ProxyDevice extends BluetoothDevice {
static final List<String> proxyServiceUUIDs = [
'0000180d-0000-1000-8000-00805f9b34fb', // Heart Rate
'00001818-0000-1000-8000-00805f9b34fb', // Cycling Power
'00001826-0000-1000-8000-00805f9b34fb', // Fitness Machine
];
final FtmsEmulator emulator = FtmsEmulator();
ProxyDevice(super.scanResult)
: super(
availableButtons: const [],
isBeta: true,
);
late final List<BleService> services;
@override
Future<void> handleServices(List<BleService> services) async {
emulator.setScanResult(scanResult);
emulator.handleServices(services);
emulator.startServer();
}
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
emulator.processCharacteristic(characteristic, bytes);
}
@override
Widget showInformation(BuildContext context) {
return Column(
spacing: 16,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
super.showInformation(context),
if (!isConnected)
Button.primary(
style: ButtonStyle.primary(size: ButtonSize.small),
onPressed: () {
super.connect();
},
child: Text('Proxy'),
),
],
);
}
@override
Future<void> connect() async {}
@override
Future<void> disconnect() {
emulator.stop();
return super.disconnect();
}
}

View File

@@ -1,10 +1,10 @@
import 'dart:typed_data';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/keymap/apps/custom_app.dart';
import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:prop/prop.dart';
import 'package:universal_ble/universal_ble.dart';
import '../bluetooth_device.dart';
@@ -26,11 +26,15 @@ class ShimanoDi2 extends BluetoothDevice {
await UniversalBle.subscribeIndications(device.deviceId, service.uuid, characteristic.uuid);
}
final _lastButtons = <int, int>{};
final _lastButtons = <int, ({int value, _Di2State type})>{};
bool _isInitialized = false;
@override
String get buttonExplanation => 'Click a D-Fly button to configure them.';
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
Logger.info('Received data from $characteristic: ${bytesToReadableHex(bytes)}');
if (characteristic.toLowerCase() == ShimanoDi2Constants.D_FLY_CHANNEL_UUID) {
final channels = bytes.sublist(1);
@@ -38,7 +42,7 @@ class ShimanoDi2 extends BluetoothDevice {
if (!_isInitialized) {
channels.forEachIndexed((int value, int index) {
final readableIndex = index + 1;
_lastButtons[index] = value;
_lastButtons[index] = (value: value, type: _Di2State.released);
getOrAddButton(
'D-Fly Channel $readableIndex',
@@ -49,28 +53,89 @@ class ShimanoDi2 extends BluetoothDevice {
return Future.value();
}
final clickedButtons = <ControllerButton>[];
var actualChange = false;
channels.forEachIndexed((int value, int index) {
final didChange = _lastButtons[index] != value;
_lastButtons[index] = value;
final didChange = _lastButtons[index]?.value != value;
final readableIndex = index + 1;
final button = getOrAddButton(
'D-Fly Channel $readableIndex',
() => ControllerButton('D-Fly Channel $readableIndex', sourceDeviceId: device.deviceId),
);
if (didChange) {
clickedButtons.add(button);
if ((value & 0x10) != 0) {
if (_lastButtons[index]?.type == _Di2State.longPress || _lastButtons[index]?.type == _Di2State.keep) {
// short press is triggered after long press, until it's released later on
_lastButtons[index] = (value: value, type: _Di2State.keep);
Logger.info('Button $readableIndex still long pressed');
} else {
_lastButtons[index] = (value: value, type: _Di2State.shortPress);
actualChange = true;
Logger.info('Button $readableIndex short pressed');
}
} else if ((value & 0x20) != 0) {
_lastButtons[index] = (value: value, type: _Di2State.longPress);
actualChange = true;
Logger.info('Button $readableIndex long pressed');
} else if ((value & 0x40) != 0) {
_lastButtons[index] = (value: value, type: _Di2State.doublePress);
actualChange = true;
Logger.info('Button $readableIndex double pressed');
} else {
_lastButtons[index] = (value: value, type: _Di2State.released);
actualChange = true;
Logger.info('Button $readableIndex released');
}
}
});
if (clickedButtons.isNotEmpty) {
await handleButtonsClickedWithoutLongPressSupport(clickedButtons);
if (actualChange) {
final Map<_Di2State, List<ControllerButton>> mapped = _lastButtons.entries.groupBy((e) => e.value.type).map((
key,
value,
) {
final buttons = value
.map((entry) => availableButtons.firstWhere((button) => button.name == 'D-Fly Channel ${entry.key + 1}'))
.toList();
return MapEntry(key, buttons);
});
final shortPress = [...?mapped[_Di2State.shortPress], ...?mapped[_Di2State.doublePress]];
if (shortPress.isNotEmpty) {
Logger.debug('Short Press Buttons to trigger: ${shortPress.map((b) => b.name).join(', ')}');
handleButtonsClicked(shortPress);
handleButtonsClicked([]);
_resetButtonsForState([_Di2State.shortPress]);
}
final longPress = mapped[_Di2State.longPress] ?? [];
if (longPress.isNotEmpty) {
Logger.debug('Long Press Buttons to trigger: ${longPress.map((b) => b.name).join(', ')}');
handleButtonsClicked(longPress);
}
final released = mapped[_Di2State.released] ?? [];
final keepPress = mapped[_Di2State.longPress] ?? [];
if (released.isNotEmpty && keepPress.isEmpty) {
Logger.debug('Releasing all Buttons');
handleButtonsClicked([]);
}
final doublePress = mapped[_Di2State.doublePress] ?? [];
if (doublePress.isNotEmpty) {
Logger.debug('Buttons to still trigger: ${doublePress.map((b) => b.name).join(', ')}');
handleButtonsClicked(doublePress);
handleButtonsClicked([]);
_resetButtonsForState([_Di2State.doublePress]);
}
}
}
return Future.value();
}
void _resetButtonsForState(List<_Di2State> list) {
_lastButtons.forEach((key, value) {
if (list.contains(value.type)) {
_lastButtons[key] = (value: value.value, type: _Di2State.released);
}
});
}
@override
@@ -79,13 +144,9 @@ class ShimanoDi2 extends BluetoothDevice {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
super.showInformation(context),
Text(
'Make sure to set your Di2 buttons to D-Fly channels in the Shimano E-TUBE app.',
style: TextStyle(fontSize: 12, color: Colors.grey),
),
if (core.actionHandler.supportedApp is! CustomApp)
if (!core.settings.getShowOnboarding())
Text(
'Use a custom keymap to support ${scanResult.name}',
'Make sure to set your Di2 buttons to D-Fly channels in the Shimano E-TUBE app.',
style: TextStyle(fontSize: 12, color: Colors.grey),
),
],
@@ -99,3 +160,11 @@ class ShimanoDi2Constants {
static const String D_FLY_CHANNEL_UUID = "00002ac2-5348-494d-414e-4f5f424c4500";
}
enum _Di2State {
shortPress,
longPress,
keep,
doublePress,
released,
}

View File

@@ -1,7 +1,9 @@
import 'dart:async';
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:shadcn_flutter/shadcn_flutter.dart';
@@ -25,10 +27,15 @@ class SramAxs extends BluetoothDevice {
@override
Future<void> handleServices(List<BleService> services) async {
final service = services.firstWhere(
final service = services.firstOrNullWhere(
(e) => e.uuid.toLowerCase() == SramAxsConstants.SERVICE_UUID_RELEVANT.toLowerCase(),
orElse: () => throw Exception('Service not found: ${SramAxsConstants.SERVICE_UUID_RELEVANT}'),
);
if (service == null) {
actionStreamInternal.add(LogNotification('SramAxs: Relevant service not found: ${SramAxsConstants.SERVICE_UUID_RELEVANT}'));
return;
}
final characteristic = service.characteristics.firstWhere(
(e) => e.uuid.toLowerCase() == SramAxsConstants.TRIGGER_UUID.toLowerCase(),
orElse: () => throw Exception('Characteristic not found: ${SramAxsConstants.TRIGGER_UUID}'),

View File

@@ -1,10 +1,8 @@
import 'dart:typed_data';
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';
@@ -38,7 +36,6 @@ class WahooKickrHeadwind extends BluetoothDevice {
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) {
// Analyze the received bytes to determine current state
actionStreamInternal.add(LogNotification('Received ${bytesToHex(bytes)} from Headwind $characteristic'));
if (bytes.length >= 4 && bytes[0] == 0xFD && bytes[1] == 0x01) {
final mode = bytes[3];
final speed = bytes[2];
@@ -83,6 +80,9 @@ class WahooKickrHeadwind extends BluetoothDevice {
withoutResponse: true,
);
_currentMode = HeadwindMode.manual;
// Small delay to ensure mode change is processed before speed command
await Future.delayed(const Duration(milliseconds: 100));
}
// Command format: [0x02, speed_value]

View File

@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
class ZwiftConstants {
static const ZWIFT_CUSTOM_SERVICE_UUID = "00000001-19CA-4651-86E5-FA29DCDD09D1";
static const ZWIFT_CUSTOM_SERVICE_SHORT_UUID = "0001";
static const ZWIFT_RIDE_CUSTOM_SERVICE_UUID = "0000fc82-0000-1000-8000-00805f9b34fb";
static const ZWIFT_RIDE_CUSTOM_SERVICE_UUID_SHORT = "fc82";
static const ZWIFT_ASYNC_CHARACTERISTIC_UUID = "00000002-19CA-4651-86E5-FA29DCDD09D1";

View File

@@ -12,7 +12,7 @@ import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:universal_ble/universal_ble.dart';
final FtmsEmulator emulator = FtmsEmulator();
final FtmsEmulator ftmsEmulator = FtmsEmulator();
class ZwiftClickV2 extends ZwiftRide {
ZwiftClickV2(super.scanResult)
@@ -31,7 +31,7 @@ class ZwiftClickV2 extends ZwiftRide {
ZwiftButtons.shiftUpRight,
],
) {
emulator.setScanResult(scanResult);
ftmsEmulator.setScanResult(scanResult);
}
@override
@@ -60,18 +60,19 @@ class ZwiftClickV2 extends ZwiftRide {
Future<void> setupHandshake() async {
if (isUnlocked) {
super.setupHandshake();
await sendCommandBuffer(Uint8List.fromList([0xFF, 0x04, 0x00]));
}
}
@override
Future<void> handleServices(List<BleService> services) async {
emulator.handleServices(services);
ftmsEmulator.handleServices(services);
await super.handleServices(services);
}
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (!emulator.processCharacteristic(characteristic, bytes)) {
if (!ftmsEmulator.processCharacteristic(characteristic, bytes)) {
await super.processCharacteristic(characteristic, bytes);
}
}
@@ -127,6 +128,15 @@ class ZwiftClickV2 extends ZwiftRide {
),
],
),
if (kDebugMode)
Button(
onPressed: () {
test();
},
leading: const Icon(Icons.translate_sharp),
style: ButtonStyle.primary(size: ButtonSize.small),
child: Text('Reset'),
),
],
)
else
@@ -159,6 +169,24 @@ class ZwiftClickV2 extends ZwiftRide {
),
],
),
if (kDebugMode && !isUnlocked)
Button(
onPressed: () {
super.setupHandshake();
},
leading: const Icon(Icons.handshake),
style: ButtonStyle.primary(size: ButtonSize.small),
child: Text('Handshake'),
),
if (kDebugMode)
Button(
onPressed: () {
test();
},
leading: const Icon(Icons.translate_sharp),
style: ButtonStyle.primary(size: ButtonSize.small),
child: Text('Reset'),
),
],
),
/*else

View File

@@ -298,6 +298,8 @@ class ZwiftEmulator extends TrainerConnection {
}
Future<void> stopAdvertising() async {
await _peripheralManager.removeAllServices();
_isServiceAdded = false;
await _peripheralManager.stopAdvertising();
isStarted.value = false;
isConnected.value = false;

View File

@@ -3,7 +3,6 @@ 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;
@@ -98,41 +97,12 @@ class ZwiftRide extends ZwiftDevice {
}
break;
case null:
final vendorDO = VendorDO.valueOf(response.dataObjectId);
if (kDebugMode) {
print('VendorDO: $vendorDO');
}
switch (vendorDO) {
case VendorDO.DEVICE_COUNT:
// TODO: Handle this case.
break;
case VendorDO.NO_CLUE:
// TODO: Handle this case.
break;
case VendorDO.PAGE_DEVICE_PAIRING:
final page = DevicePairingDataPage.fromBuffer(response.dataObjectData);
if (kDebugMode) {
// this should show the right click device
// pairingStatus = 1 => connected and paired, otherwise it can be paired but not connected
print(
'PageDevicePairing: $page => ${page.pairingDevList.map((e) => e.device.reversed.map((d) => d.toRadixString(16).padLeft(2, '0'))).join(', ')}',
);
}
break;
case VendorDO.PAIRED_DEVICE:
// TODO: Handle this case.
break;
case VendorDO.PAIRING_STATUS:
break;
}
break;
default:
break;
}
break;
case Opcode.VENDOR_MESSAGE:
final vendorOpCode = VendorOpcode.valueOf(message.second);
print('VendorOpcode: $vendorOpCode');
break;
case Opcode.LOG_DATA:
final logMessage = LogDataNotification.fromBuffer(message);

View File

@@ -11,9 +11,7 @@ class LogNotification extends BaseNotification {
final String message;
LogNotification(this.message) {
if (kDebugMode) {
//print('LogNotification: $message');
}
Logger.debug('LogNotification: $message');
}
@override

View File

@@ -0,0 +1,418 @@
import 'dart:io';
import 'package:bike_control/bluetooth/devices/trainer_connection.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';
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';
class RemoteKeyboardPairing extends TrainerConnection {
bool get isLoading => _isLoading;
late final _peripheralManager = PeripheralManager();
bool _isLoading = false;
bool _isServiceAdded = false;
bool _isSubscribedToEvents = false;
Central? _central;
GATTCharacteristic? _inputReport;
static const String connectionTitle = 'Keyboard Remote Control';
RemoteKeyboardPairing()
: super(
title: connectionTitle,
supportedActions: InGameAction.values,
);
Future<void> reconnect() async {
await _peripheralManager.stopAdvertising();
await _peripheralManager.removeAllServices();
_isServiceAdded = false;
startAdvertising().catchError((e) {
core.settings.setRemoteControlEnabled(false);
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_WARNING, 'Failed to start Remote Control pairing: $e'),
);
});
}
Future<void> startAdvertising() async {
_isLoading = true;
isStarted.value = true;
_peripheralManager.stateChanged.forEach((state) {
print('Peripheral manager state: ${state.state}');
});
if (!kIsWeb && Platform.isAndroid) {
_peripheralManager.connectionStateChanged.forEach((state) {
print('Peripheral connection state: ${state.state} of ${state.central.uuid}');
if (state.state == ConnectionState.connected) {
} else if (state.state == ConnectionState.disconnected) {
_central = null;
isConnected.value = false;
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_INFO, AppLocalizations.current.disconnected),
);
}
});
final status = await Permission.bluetoothAdvertise.request();
if (!status.isGranted) {
print('Bluetooth advertise permission not granted');
isStarted.value = false;
return;
}
}
while (_peripheralManager.state != BluetoothLowEnergyState.poweredOn && core.settings.getRemoteControlEnabled()) {
print('Waiting for peripheral manager to be powered on...');
if (core.settings.getLastTarget() == Target.thisDevice) {
return;
}
await Future.delayed(Duration(seconds: 1));
}
final inputReport = GATTCharacteristic.mutable(
uuid: UUID.fromString('2A4D'),
permissions: [GATTCharacteristicPermission.read],
properties: [GATTCharacteristicProperty.notify, GATTCharacteristicProperty.read],
descriptors: [
GATTDescriptor.immutable(
// Report Reference: ID=1, Type=Input(1)
uuid: UUID.fromString('2908'),
value: Uint8List.fromList([0x01, 0x01]),
),
],
);
if (!_isServiceAdded) {
await Future.delayed(Duration(seconds: 1));
final reportMapDataAbsolute = Uint8List.fromList([
// Keyboard Report (Report ID 1)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x85, 0x01, // Report ID (1)
0x05, 0x07, // Usage Page (Keyboard/Keypad)
0x19, 0xE0, // Usage Minimum (Left Control)
0x29, 0xE7, // Usage Maximum (Right GUI)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8)
0x81, 0x02, // Input (Data,Var,Abs) - Modifier byte
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input (Const) - Reserved byte
0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x65, // Logical Maximum (101)
0x05, 0x07, // Usage Page (Keyboard/Keypad)
0x19, 0x00, // Usage Minimum (0)
0x29, 0x65, // Usage Maximum (101)
0x81, 0x00, // Input (Data,Array) - Key array (6 keys)
0xC0, // End Collection
]);
// 1) Build characteristics
final hidInfo = GATTCharacteristic.immutable(
uuid: UUID.fromString('2A4A'),
value: Uint8List.fromList([0x11, 0x01, 0x00, 0x02]),
descriptors: [], // HID v1.11, country=0, flags=2
);
final reportMap = GATTCharacteristic.immutable(
uuid: UUID.fromString('2A4B'),
//properties: [GATTCharacteristicProperty.read],
//permissions: [GATTCharacteristicPermission.read],
value: reportMapDataAbsolute,
descriptors: [
GATTDescriptor.immutable(uuid: UUID.fromString('2908'), value: Uint8List.fromList([0x0, 0x0])),
],
);
final protocolMode = GATTCharacteristic.mutable(
uuid: UUID.fromString('2A4E'),
properties: [GATTCharacteristicProperty.read, GATTCharacteristicProperty.writeWithoutResponse],
permissions: [GATTCharacteristicPermission.read, GATTCharacteristicPermission.write],
descriptors: [],
);
final hidControlPoint = GATTCharacteristic.mutable(
uuid: UUID.fromString('2A4C'),
properties: [GATTCharacteristicProperty.writeWithoutResponse],
permissions: [GATTCharacteristicPermission.write],
descriptors: [],
);
// 2) HID service
final hidService = GATTService(
uuid: UUID.fromString(Platform.isIOS ? '1812' : '00001812-0000-1000-8000-00805F9B34FB'),
isPrimary: true,
characteristics: [
hidInfo,
reportMap,
protocolMode,
hidControlPoint,
inputReport,
],
includedServices: [],
);
if (!_isSubscribedToEvents) {
_isSubscribedToEvents = true;
_peripheralManager.characteristicReadRequested.forEach((char) {
print('Read request for characteristic: ${char}');
// You can respond to read requests here if needed
});
_peripheralManager.characteristicNotifyStateChanged.forEach((char) {
// Check if this is the input report characteristic (2A4D)
if (char.characteristic.uuid == inputReport.uuid) {
if (char.state) {
_central = char.central;
_inputReport = char.characteristic;
isConnected.value = true;
print('Input report subscribed');
} else {
_inputReport = null;
_central = null;
isConnected.value = false;
print('Input report unsubscribed');
}
}
print('Notify state changed for characteristic: ${char.characteristic.uuid}: ${char.state}');
});
}
await _peripheralManager.addService(hidService);
// 3) Optional Battery service
await _peripheralManager.addService(
GATTService(
uuid: UUID.fromString('180F'),
isPrimary: true,
characteristics: [
GATTCharacteristic.immutable(
uuid: UUID.fromString('2A19'),
value: Uint8List.fromList([100]),
descriptors: [],
),
],
includedServices: [],
),
);
_isServiceAdded = true;
}
final advertisement = Advertisement(
name:
'BikeControl ${Platform.isIOS
? 'iOS'
: Platform.isAndroid
? 'Android'
: ''}',
serviceUUIDs: [UUID.fromString(Platform.isIOS ? '1812' : '00001812-0000-1000-8000-00805F9B34FB')],
);
print('Starting advertising with Remote service...');
try {
await _peripheralManager.startAdvertising(advertisement);
} catch (e) {
if (e.toString().contains("Advertising has already started")) {
print('Advertising already started, ignoring error');
return;
} else {
rethrow;
}
}
_isLoading = false;
}
Future<void> stopAdvertising() async {
await _peripheralManager.removeAllServices();
_isServiceAdded = false;
await _peripheralManager.stopAdvertising();
isStarted.value = false;
isConnected.value = false;
_isLoading = false;
}
Future<void> notifyCharacteristic(Uint8List value) async {
if (_inputReport != null && _central != null) {
await _peripheralManager.notifyCharacteristic(_central!, _inputReport!, value: value);
}
}
@override
Future<ActionResult> sendAction(KeyPair keyPair, {required bool isKeyDown, required bool isKeyUp}) async {
if (isKeyDown && isKeyUp) {
await sendKeyPress(keyPair);
return Success('Key ${keyPair.toString()} press sent');
} else if (isKeyDown) {
await sendKeyDown(keyPair);
return Success('Key ${keyPair.toString()} down sent');
} else if (isKeyUp) {
await sendKeyUp();
return Success('Key ${keyPair.toString()} up sent');
}
return NotHandled('Illegal combination');
}
/// USB HID Keyboard scan codes for common keys
static const Map<String, int> hidKeyCodes = {
'a': 0x04,
'b': 0x05,
'c': 0x06,
'd': 0x07,
'e': 0x08,
'f': 0x09,
'g': 0x0A,
'h': 0x0B,
'i': 0x0C,
'j': 0x0D,
'k': 0x0E,
'l': 0x0F,
'm': 0x10,
'n': 0x11,
'o': 0x12,
'p': 0x13,
'q': 0x14,
'r': 0x15,
's': 0x16,
't': 0x17,
'u': 0x18,
'v': 0x19,
'w': 0x1A,
'x': 0x1B,
'y': 0x1C,
'z': 0x1D,
'1': 0x1E,
'2': 0x1F,
'3': 0x20,
'4': 0x21,
'5': 0x22,
'6': 0x23,
'7': 0x24,
'8': 0x25,
'9': 0x26,
'0': 0x27,
'enter': 0x28,
'escape': 0x29,
'backspace': 0x2A,
'tab': 0x2B,
'space': 0x2C,
'minus': 0x2D,
'equals': 0x2E,
'leftbracket': 0x2F,
'rightbracket': 0x30,
'backslash': 0x31,
'semicolon': 0x33,
'quote': 0x34,
'grave': 0x35,
'comma': 0x36,
'period': 0x37,
'slash': 0x38,
'capslock': 0x39,
'f1': 0x3A,
'f2': 0x3B,
'f3': 0x3C,
'f4': 0x3D,
'f5': 0x3E,
'f6': 0x3F,
'f7': 0x40,
'f8': 0x41,
'f9': 0x42,
'f10': 0x43,
'f11': 0x44,
'f12': 0x45,
'printscreen': 0x46,
'scrolllock': 0x47,
'pause': 0x48,
'insert': 0x49,
'home': 0x4A,
'pageup': 0x4B,
'delete': 0x4C,
'end': 0x4D,
'pagedown': 0x4E,
'right': 0x4F,
'left': 0x50,
'down': 0x51,
'up': 0x52,
};
/// Modifier key bit masks
static const int modLeftCtrl = 0x01;
static const int modLeftShift = 0x02;
static const int modLeftAlt = 0x04;
static const int modLeftGui = 0x08;
static const int modRightCtrl = 0x10;
static const int modRightShift = 0x20;
static const int modRightAlt = 0x40;
static const int modRightGui = 0x80;
/// Create a keyboard HID report
/// [modifiers] - bit mask for modifier keys (Ctrl, Shift, Alt, GUI)
/// [keyCodes] - list of up to 6 key codes to send
Uint8List keyboardReport(int modifiers, List<int> keyCodes) {
final keys = List<int>.filled(6, 0);
for (var i = 0; i < keyCodes.length && i < 6; i++) {
keys[i] = keyCodes[i];
}
// Report format: [modifiers, reserved, key1, key2, key3, key4, key5, key6]
return Uint8List.fromList([modifiers, 0x00, ...keys]);
}
/// Send a keyboard key press and release
/// [key] - the key name (e.g., 'a', 'enter', 'space', 'f1', 'up', 'down')
/// [modifiers] - optional modifier keys (use modLeftCtrl, modLeftShift, etc.)
Future<void> sendKeyPress(KeyPair keyPair, {int modifiers = 0}) async {
final usbHidUsage = keyPair.physicalKey!.usbHidUsage;
final keyCode = usbHidUsage & 0xFF;
// Send key down
final downReport = keyboardReport(modifiers, [keyCode]);
if (kDebugMode) {
print(
'Sending keyboard key down: $keyPair (0x${keyCode.toRadixString(16)}) with modifiers: 0x${modifiers.toRadixString(16)}',
);
}
await notifyCharacteristic(downReport);
await Future.delayed(Duration(milliseconds: 20));
// Send key up (empty report)
final upReport = keyboardReport(0, []);
if (kDebugMode) {
print('Sending keyboard key up');
}
await notifyCharacteristic(upReport);
await Future.delayed(Duration(milliseconds: 10));
}
/// Send a key down event only (for holding keys)
Future<void> sendKeyDown(KeyPair keyPair, {int modifiers = 0}) async {
final usbHidUsage = keyPair.physicalKey!.usbHidUsage;
final keyCode = usbHidUsage & 0xFF;
final report = keyboardReport(modifiers, [keyCode]);
await notifyCharacteristic(report);
}
/// Send a key up event (release all keys)
Future<void> sendKeyUp() async {
final report = keyboardReport(0, []);
await notifyCharacteristic(report);
}
}

View File

@@ -159,37 +159,6 @@ class RemotePairing extends TrainerConnection {
descriptors: [],
);
// Input report characteristic (notify)
final keyboardInputReport = GATTCharacteristic.mutable(
uuid: UUID.fromString('2A4D'),
permissions: [GATTCharacteristicPermission.read],
properties: [GATTCharacteristicProperty.notify, GATTCharacteristicProperty.read],
descriptors: [
GATTDescriptor.immutable(
// Report Reference: ID=1, Type=Input(1)
uuid: UUID.fromString('2908'),
value: Uint8List.fromList([0x02, 0x01]),
),
],
);
final outputReport = GATTCharacteristic.mutable(
uuid: UUID.fromString('2A4D'),
permissions: [GATTCharacteristicPermission.read, GATTCharacteristicPermission.write],
properties: [
GATTCharacteristicProperty.read,
GATTCharacteristicProperty.write,
GATTCharacteristicProperty.writeWithoutResponse,
],
descriptors: [
GATTDescriptor.immutable(
// Report Reference: ID=1, Type=Input(1)
uuid: UUID.fromString('2908'),
value: Uint8List.fromList([0x02, 0x02]),
),
],
);
// 2) HID service
final hidService = GATTService(
uuid: UUID.fromString(Platform.isIOS ? '1812' : '00001812-0000-1000-8000-00805F9B34FB'),
@@ -198,9 +167,7 @@ class RemotePairing extends TrainerConnection {
hidInfo,
reportMap,
protocolMode,
outputReport,
hidControlPoint,
keyboardInputReport,
inputReport,
],
includedServices: [],
@@ -214,18 +181,21 @@ class RemotePairing extends TrainerConnection {
});
_peripheralManager.characteristicNotifyStateChanged.forEach((char) {
// Check if this is the input report characteristic (2A4D)
if (char.characteristic.uuid == inputReport.uuid) {
if (char.state) {
_inputReport = char.characteristic;
_central = char.central;
_inputReport = char.characteristic;
isConnected.value = true;
print('Input report subscribed');
} else {
_inputReport = null;
_central = null;
isConnected.value = false;
print('Input report unsubscribed');
}
}
print(
'Notify state changed for characteristic: ${char.characteristic.uuid} vs ${char.characteristic.uuid == inputReport.uuid}: ${char.state}',
);
print('Notify state changed for characteristic: ${char.characteristic.uuid}: ${char.state}');
});
}
await _peripheralManager.addService(hidService);
@@ -259,11 +229,22 @@ class RemotePairing extends TrainerConnection {
);
print('Starting advertising with Remote service...');
await _peripheralManager.startAdvertising(advertisement);
try {
await _peripheralManager.startAdvertising(advertisement);
} catch (e) {
if (e.toString().contains("Advertising has already started")) {
print('Advertising already started, ignoring error');
return;
} else {
rethrow;
}
}
_isLoading = false;
}
Future<void> stopAdvertising() async {
await _peripheralManager.removeAllServices();
_isServiceAdded = false;
await _peripheralManager.stopAdvertising();
isStarted.value = false;
isConnected.value = false;

View File

@@ -11,6 +11,7 @@
"accessibilityUsageMonitor": "• Die App überwacht, welches Trainings-App-Fenster aktiv ist, um sicherzustellen, dass Gesten an die richtige App gesendet werden.",
"accessibilityUsageNoData": "• Über diesen Dienst werden keine personenbezogenen Daten abgerufen oder erfasst.",
"accessories": "Zubehör",
"actAsBluetoothKeyboard": "Als Bluetooth-Tastatur fungieren",
"action": "Aktion",
"adjustControllerButtons": "Controller-Tasten anpassen",
"afterDate": "Nach dem {date}",
@@ -36,6 +37,7 @@
"battery": "Batterie",
"beforeDate": "Vor dem {date}",
"bluetoothAdvertiseAccess": "Bluetooth-Zugriff",
"bluetoothKeyboardExplanation": "So können Sie Ihr Smartphone als Bluetooth-Tastatur zur Steuerung kompatibler Apps verwenden. Nach der Kopplung können Sie die Tasten Ihres Fahrradcontrollers nutzen, um Tastatureingaben an die App zu senden.",
"bluetoothTurnedOn": "Bluetooth ist eingeschaltet",
"browserNotSupported": "Dieser Browser unterstützt kein Web-Bluetooth und die Plattform wird nicht unterstützt :(",
"button": "Taste.",
@@ -153,7 +155,7 @@
"enableLocalConnectionMethodFirst": "Aktivieren Sie zuerst die Methode „Lokale Verbindung“.",
"enableMediaKeyDetection": "Medientastenerkennung aktivieren",
"enableMywhooshLinkInTheConnectionSettingsFirst": "Aktiviere zuerst MyWhoosh Link in den Verbindungseinstellungen.",
"enablePairingProcess": "Kopplungsprozess aktivieren",
"enablePairingProcess": "Als Bluetooth-Maus fungieren",
"enablePermissions": "Berechtigungen aktivieren",
"enableSteeringWithPhone": "Lenkung über Handy-Sensoren aktivieren",
"enableVibrationFeedback": "Vibrationsfeedback beim Gangwechsel aktivieren",
@@ -279,7 +281,7 @@
"openBikeControlAnnouncement": "Tolle Neuigkeiten! {trainerApp} unterstützt das OpenBikeControl-Protokoll für eine bestmögliche Benutzererfahrung.",
"openBikeControlConnection": " z. B. durch Verwendung einer OpenBikeControl-Verbindung",
"otherConnectionMethods": "Andere Verbindungsmethoden",
"pairingDescription": "Die Kopplung ermöglicht volle Anpassungsmöglichkeiten, funktioniert aber möglicherweise nicht auf allen Geräten.",
"pairingDescription": "So können Sie Ihr Smartphone als Bluetooth-Maus zur Steuerung von Apps verwenden. Nach der Kopplung können Sie die Tasten Ihres Fahrradcontrollers nutzen, um Mausbewegungen an die App zu senden.",
"pairingInstructions": "Gehe auf Deinem {targetName} in die Bluetooth-Einstellungen und suche nach BikeControl oder dem Namen Ihres Geräts. Wenn Du die Fernbedienungsfunktion nutzen möchtest, ist eine Kopplung erforderlich.",
"@pairingInstructions": {
"placeholders": {
@@ -413,9 +415,9 @@
"tryingToConnectAgain": "Verbinde erneut...",
"unassignAction": "Zuweisung aufheben",
"unlockFullVersion": "Vollversion freischalten",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl und Zwift müssen sich im selben Netzwerk befinden. Es kann einige Sekunden dauern, bis sie angezeigt werden.",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl und Zwift müssen sich im selben Netzwerk oder auf demselben Gerät befinden. Es kann einige Sekunden dauern, bis sie angezeigt werden.",
"unlock_confirmByPressingAButtonOnYourDevice": "Bestätigen Sie durch Drücken einer Taste auf Ihrem Gerät.",
"unlock_connectToBikecontrol": "Verbinden mit BikeControl",
"unlock_connectToBikecontrol": "Verbinde dich mit BikeControl“, z.B. als Stromquelle.",
"unlock_deviceIsCurrentlyLocked": "Das Gerät ist derzeit gesperrt.",
"unlock_isnowunlocked": "{device} ist jetzt freigeschaltet",
"unlock_markAsUnlocked": "Als entsperrt markieren",

View File

@@ -11,6 +11,7 @@
"accessibilityUsageMonitor": "• The app monitors which training app window is active to ensure gestures are sent to the correct app",
"accessibilityUsageNoData": "• No personal data is accessed or collected through this service",
"accessories": "Accessories",
"actAsBluetoothKeyboard": "Act as Bluetooth Keyboard",
"action": "Action",
"adjustControllerButtons": "Adjust Controller Buttons",
"afterDate": "After {date}",
@@ -36,6 +37,7 @@
"battery": "Battery",
"beforeDate": "Before {date}",
"bluetoothAdvertiseAccess": "Bluetooth Advertise access",
"bluetoothKeyboardExplanation": "This will allow you to use your phone as a Bluetooth keyboard to control compatible apps. Once paired, you can use the buttons on your bike controller to send keyboard inputs to the app.",
"bluetoothTurnedOn": "Bluetooth turned on",
"browserNotSupported": "This Browser does not support Web Bluetooth and platform is not supported :(",
"button": "button.",
@@ -153,7 +155,7 @@
"enableLocalConnectionMethodFirst": "Enable Local Connection method, first.",
"enableMediaKeyDetection": "Enable Media Key Detection",
"enableMywhooshLinkInTheConnectionSettingsFirst": "Enable MyWhoosh Link in the connection settings first.",
"enablePairingProcess": "Enable Pairing Process",
"enablePairingProcess": "Act as Bluetooth Mouse",
"enablePermissions": "Enable Permissions",
"enableSteeringWithPhone": "Enable Steering with your phone's sensors",
"enableVibrationFeedback": "Enable vibration feedback when shifting gears",
@@ -279,7 +281,7 @@
"openBikeControlAnnouncement": "Great news - {trainerApp} supports the OpenBikeControl Protocol, so you'll have the best possible experience!",
"openBikeControlConnection": " e.g. by using OpenBikeControl connection",
"otherConnectionMethods": "Other Connection Methods",
"pairingDescription": "Pairing allows full customizability, but may not work on all devices.",
"pairingDescription": "This will allow you to use your phone as a Bluetooth mouse to control apps. Once paired, you can use the buttons on your bike controller to send mouse inputs to the app.",
"pairingInstructions": "On your {targetName} go into Bluetooth settings and look for BikeControl or your machines name. Pairing is required if you want to use the remote control feature.",
"@pairingInstructions": {
"placeholders": {
@@ -413,9 +415,9 @@
"tryingToConnectAgain": "Trying to connect again...",
"unassignAction": "Unassign action",
"unlockFullVersion": "Unlock Full Version",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl and Zwift need to be on the same network. It may take a few seconds to appear.",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl and Zwift need to be on the same network or device. It may take a few seconds to appear.",
"unlock_confirmByPressingAButtonOnYourDevice": "Confirm by pressing a button on your device.",
"unlock_connectToBikecontrol": "Connect to BikeControl",
"unlock_connectToBikecontrol": "Connect to \"BikeControl\" e.g. as Power source",
"unlock_deviceIsCurrentlyLocked": "Device is currently locked",
"unlock_isnowunlocked": "{device} is now unlocked",
"unlock_markAsUnlocked": "Mark as Unlocked",

View File

@@ -11,6 +11,7 @@
"accessibilityUsageMonitor": "• L'application surveille quelle fenêtre de l'application d'entraînement est active afin de s'assurer que les gestes sont envoyés à la bonne application.",
"accessibilityUsageNoData": "• Aucune donnée personnelle n'est consultée ou collectée par le biais de ce service.",
"accessories": "Accessoires",
"actAsBluetoothKeyboard": "Fonctionne comme un clavier Bluetooth",
"action": "Action",
"adjustControllerButtons": "Ajuster les boutons de la manette",
"afterDate": "Après {date}",
@@ -36,6 +37,7 @@
"battery": "Batterie",
"beforeDate": "Avant {date}",
"bluetoothAdvertiseAccess": "Accès à la publicité Bluetooth",
"bluetoothKeyboardExplanation": "Vous pourrez ainsi utiliser votre téléphone comme clavier Bluetooth pour contrôler les applications compatibles. Une fois l'appairage effectué, vous pourrez utiliser les boutons de votre contrôleur de vélo pour envoyer des commandes à l'application.",
"bluetoothTurnedOn": "Bluetooth activé",
"browserNotSupported": "Ce navigateur ne prend pas en charge Web Bluetooth et la plateforme n'est pas prise en charge :(",
"button": "bouton.",
@@ -153,7 +155,7 @@
"enableLocalConnectionMethodFirst": "Activez d'abord le mode de connexion locale.",
"enableMediaKeyDetection": "Activer la détection des touches multimédias",
"enableMywhooshLinkInTheConnectionSettingsFirst": "Activez d'abord MyWhoosh Link dans les paramètres de connexion.",
"enablePairingProcess": "Activer le processus d'appairage",
"enablePairingProcess": "Fonctionne comme une souris Bluetooth",
"enablePermissions": "Activer les autorisations",
"enableSteeringWithPhone": "Activez la direction avec les capteurs de votre téléphone",
"enableVibrationFeedback": "Activer le retour haptique par vibration lors du changement de vitesse",
@@ -279,7 +281,7 @@
"openBikeControlAnnouncement": "Excellente nouvelle! {trainerApp} Il prend en charge le protocole OpenBikeControl, vous bénéficierez donc de la meilleure expérience possible !",
"openBikeControlConnection": " par exemple en utilisant la connexion OpenBikeControl",
"otherConnectionMethods": "Autres méthodes de connexion",
"pairingDescription": "Le jumelage permet une personnalisation complète, mais peut ne pas fonctionner sur tous les appareils.",
"pairingDescription": "Cela vous permettra d'utiliser votre téléphone comme une souris Bluetooth pour contrôler des applications. Une fois l'appairage effectué, vous pourrez utiliser les boutons de votre contrôleur de vélo pour envoyer des commandes de souris à l'application.",
"pairingInstructions": "Sur votre {targetName}, accédez aux paramètres Bluetooth et recherchez BikeControl ou le nom de votre appareil. L'appairage est nécessaire si vous souhaitez utiliser la fonction de commande à distance.",
"@pairingInstructions": {
"placeholders": {
@@ -413,9 +415,9 @@
"tryingToConnectAgain": "Tentative de reconnexion...",
"unassignAction": "Action de désaffectation",
"unlockFullVersion": "Débloquer la version complète",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl et Zwift doivent être connectés au même réseau. L'affichage peut prendre quelques secondes.",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl et Zwift doivent être connectés au même réseau ou appareil. L'affichage peut prendre quelques secondes.",
"unlock_confirmByPressingAButtonOnYourDevice": "Confirmez en appuyant sur un bouton de votre appareil.",
"unlock_connectToBikecontrol": "Se connecter à ",
"unlock_connectToBikecontrol": "Se connecter à « BikeControl », par exemple comme source d'alimentation",
"unlock_deviceIsCurrentlyLocked": "L'appareil est actuellement verrouillé.",
"unlock_isnowunlocked": "{device} est maintenant déverrouillé",
"unlock_markAsUnlocked": "Marquer comme déverrouillé",

View File

@@ -11,6 +11,7 @@
"accessibilityUsageMonitor": "• L'applicazione monitora quale finestra dell'app di allenamento è attiva per garantire che i gesti vengano inviati all'app corretta",
"accessibilityUsageNoData": "• Nessun dato personale viene raccolto o consultato tramite questo servizio",
"accessories": "Accessori",
"actAsBluetoothKeyboard": "Funziona come tastiera Bluetooth",
"action": "Azione",
"adjustControllerButtons": "Regola i pulsanti del controller",
"afterDate": "Dopo il {date}",
@@ -36,6 +37,7 @@
"battery": "Batteria",
"beforeDate": "Prima del {date}",
"bluetoothAdvertiseAccess": "Accesso pubblicitario Bluetooth",
"bluetoothKeyboardExplanation": "Questo ti permetterà di usare il tuo telefono come tastiera Bluetooth per controllare le app compatibili. Una volta associato, potrai usare i pulsanti del controller della tua bici per inviare input dalla tastiera all'app.",
"bluetoothTurnedOn": "Bluetooth attivato",
"browserNotSupported": "Questo browser non supporta il Web Bluetooth e la piattaforma non è supportata :(",
"button": "pulsante.",
@@ -153,7 +155,7 @@
"enableLocalConnectionMethodFirst": "Abilitare prima il metodo di connessione locale.",
"enableMediaKeyDetection": "Abilita rilevamento tasti multimediali",
"enableMywhooshLinkInTheConnectionSettingsFirst": "Per prima cosa, abilita MyWhoosh Link nelle impostazioni di connessione.",
"enablePairingProcess": "Abilita processo di associazione",
"enablePairingProcess": "Funziona come un mouse Bluetooth",
"enablePermissions": "Abilita autorizzazioni",
"enableSteeringWithPhone": "Abilita lo sterzo con i sensori del tuo telefono",
"enableVibrationFeedback": "Abilita il feedback delle vibrazioni durante il cambio marcia",
@@ -279,7 +281,7 @@
"openBikeControlAnnouncement": "Ottime notizie -{trainerApp} supporta il protocollo OpenBikeControl, così avrai la migliore esperienza possibile!",
"openBikeControlConnection": " ad esempio utilizzando la connessione OpenBikeControl",
"otherConnectionMethods": "Altri metodi di connessione",
"pairingDescription": "L'associazione consente la personalizzazione completa, ma potrebbe non funzionare su tutti i dispositivi.",
"pairingDescription": "Questo ti permetterà di usare il tuo telefono come mouse Bluetooth per controllare le app. Una volta associato, potrai usare i pulsanti del controller della tua bici per inviare input del mouse all'app.",
"pairingInstructions": "Sul tuo{targetName} Accedi alle impostazioni Bluetooth e cerca BikeControl o il nome del tuo dispositivo. L'associazione è necessaria se vuoi utilizzare la funzione di controllo remoto.",
"@pairingInstructions": {
"placeholders": {
@@ -413,9 +415,9 @@
"tryingToConnectAgain": "Sto provando a connettermi di nuovo...",
"unassignAction": "Annulla assegnazione azione",
"unlockFullVersion": "Sblocca la versione completa",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl e Zwift devono essere sulla stessa rete. Potrebbero essere necessari alcuni secondi per visualizzarli.",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl e Zwift devono essere sulla stessa rete o sullo stesso dispositivo. Potrebbero essere necessari alcuni secondi per visualizzarli.",
"unlock_confirmByPressingAButtonOnYourDevice": "Conferma premendo un pulsante sul tuo dispositivo.",
"unlock_connectToBikecontrol": "Connettiti a ",
"unlock_connectToBikecontrol": "Connetti a \"BikeControl\" ad esempio come fonte di alimentazione",
"unlock_deviceIsCurrentlyLocked": "Il dispositivo è attualmente bloccato",
"unlock_isnowunlocked": "{device} è ora sbloccato",
"unlock_markAsUnlocked": "Segna come sbloccato",

View File

@@ -11,6 +11,7 @@
"accessibilityUsageMonitor": "• Aplikacja monitoruje, które okno aplikacji treningowej jest aktywne, aby zapewnić, że gesty są wysyłane do właściwej aplikacji",
"accessibilityUsageNoData": "• Ta usługa nie uzyskuje dostępu do danych osobowych, ani ich nie gromadzi",
"accessories": "Akcesoria",
"actAsBluetoothKeyboard": "Działa jako klawiatura Bluetooth",
"action": "Działanie",
"adjustControllerButtons": "Dostosuj przyciski kontrolera",
"afterDate": "Po {date}",
@@ -36,6 +37,7 @@
"battery": "Bateria",
"beforeDate": "Zanim {date}",
"bluetoothAdvertiseAccess": "Dostęp do reklamy Bluetooth",
"bluetoothKeyboardExplanation": "Umożliwi to używanie telefonu jako klawiatury Bluetooth do sterowania kompatybilnymi aplikacjami. Po sparowaniu możesz używać przycisków na kontrolerze rowerowym do wysyłania poleceń z klawiatury do aplikacji.",
"bluetoothTurnedOn": "Włączono Bluetooth",
"browserNotSupported": "Ta przeglądarka nie obsługuje technologii Web Bluetooth i platforma nie jest obsługiwana :(",
"button": "przycisk.",
@@ -153,7 +155,7 @@
"enableLocalConnectionMethodFirst": "Najpierw włącz metodę połączenia lokalnego.",
"enableMediaKeyDetection": "Włącz rozpoznawanie klawiszy multimedialnych",
"enableMywhooshLinkInTheConnectionSettingsFirst": "Najpierw włącz MyWhoosh Link w ustawieniach połączenia.",
"enablePairingProcess": "Włącz proces parowania",
"enablePairingProcess": "Działa jako mysz Bluetooth",
"enablePermissions": "Nadaj uprawnienia",
"enableSteeringWithPhone": "Włącz sterowanie za pomocą czujników telefonu",
"enableVibrationFeedback": "Włącz wibracje podczas zmiany biegów",
@@ -279,7 +281,7 @@
"openBikeControlAnnouncement": "Świetna wiadomość - {trainerApp} obsługuje protokół OpenBikeControl, dzięki czemu uzyskasz najlepsze doświadczenia!",
"openBikeControlConnection": " np. za pomocą połączenia OpenBikeControl",
"otherConnectionMethods": "Inne metody połączenia",
"pairingDescription": "Parowanie umożliwia pełną personalizację, jednak może nie działać na wszystkich urządzeniach.",
"pairingDescription": "Umożliwi to używanie telefonu jako myszy Bluetooth do sterowania aplikacjami. Po sparowaniu możesz używać przycisków na kontrolerze rowerowym do wysyłania poleceń myszy do aplikacji.",
"pairingInstructions": "Przejdź do ustawień Bluetooth na twoim {targetName} i wyszukaj BikeControl lub nazwę swojego urządzenia. Parowanie jest wymagane, jeśli chcesz korzystać z funkcji zdalnego sterowania.",
"@pairingInstructions": {
"placeholders": {
@@ -413,9 +415,9 @@
"tryingToConnectAgain": "Próba ponownego połączenia...",
"unassignAction": "Anuluj przypisanie akcji",
"unlockFullVersion": "Odblokuj pełną wersję",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl i Zwift muszą być w tej samej sieci. Pojawienie się aplikacji może potrwać kilka sekund.",
"unlock_bikecontrolAndZwiftNetwork": "BikeControl i Zwift muszą być podłączone do tej samej sieci lub urządzenia. Pojawienie się aplikacji może potrwać kilka sekund.",
"unlock_confirmByPressingAButtonOnYourDevice": "Potwierdź, naciskając przycisk na swoim urządzeniu.",
"unlock_connectToBikecontrol": "Połącz się z BikeControl",
"unlock_connectToBikecontrol": "Połącz się z BikeControl”, np. jako źródło zasilania",
"unlock_deviceIsCurrentlyLocked": "Urządzenie jest obecnie zablokowane",
"unlock_isnowunlocked": "{device} jest teraz odblokowany",
"unlock_markAsUnlocked": "Oznacz jako odblokowane",

View File

@@ -2,7 +2,6 @@ import 'dart:async';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/pages/touch_area.dart';
import 'package:bike_control/utils/actions/android.dart';
import 'package:bike_control/utils/actions/base_actions.dart';
@@ -18,8 +17,10 @@ import 'package:bike_control/widgets/ui/colors.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:bike_control/widgets/ui/warning.dart';
import 'package:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';
class ButtonEditPage extends StatefulWidget {
final Keymap keymap;
@@ -85,13 +86,6 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
@override
Widget build(BuildContext context) {
final trainerApp = core.settings.getTrainerApp();
final actionsWithInGameAction = trainerApp?.keymap.keyPairs
.where((kp) => kp.inGameAction != null)
.distinctBy((kp) => kp.inGameAction)
.toList();
return IntrinsicWidth(
child: Scrollbar(
controller: _scrollController,
@@ -185,119 +179,47 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
if (core.logic.showLocalRemoteOptions) ...[
SizedBox(height: 8),
ColoredTitle(text: 'Local / Remote Setting'),
if (trainerApp != null && trainerApp is! CustomApp && actionsWithInGameAction?.isEmpty != true) ...[
if (core.actionHandler.supportedModes.contains(SupportedMode.keyboard) &&
(core.settings.getLocalEnabled() || core.settings.getRemoteKeyboardControlEnabled()))
Builder(
builder: (context) => SelectableCard(
icon: null,
title: Text(context.i18n.predefinedAction(trainerApp.name)),
isActive: false,
onPressed: () {
if (!core.settings.getLocalEnabled()) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).enableLocalConnectionMethodFirst,
);
} else {
showDropdown(
context: context,
builder: (c) => DropdownMenu(
children: actionsWithInGameAction!.map((keyPairAction) {
return MenuButton(
leading: keyPairAction.inGameAction?.icon != null
? Icon(keyPairAction.inGameAction!.icon)
: null,
onPressed: (_) {
// Copy all properties from the selected predefined action
if (core.actionHandler.supportedModes.contains(SupportedMode.keyboard)) {
_keyPair.physicalKey = keyPairAction.physicalKey;
_keyPair.logicalKey = keyPairAction.logicalKey;
_keyPair.modifiers = List.of(keyPairAction.modifiers);
} else {
_keyPair.physicalKey = null;
_keyPair.logicalKey = null;
_keyPair.modifiers = [];
}
if (core.actionHandler.supportedModes.contains(SupportedMode.touch)) {
_keyPair.touchPosition = keyPairAction.touchPosition;
} else {
_keyPair.touchPosition = Offset.zero;
}
_keyPair.isLongPress = keyPairAction.isLongPress;
_keyPair.inGameAction = keyPairAction.inGameAction;
_keyPair.inGameActionValue = keyPairAction.inGameActionValue;
_keyPair.androidAction = null;
setState(() {});
},
child: Text(keyPairAction.toString()),
);
}).toList(),
),
);
}
},
),
),
],
if (core.actionHandler.supportedModes.contains(SupportedMode.keyboard))
SelectableCard(
icon: RadixIcons.keyboard,
title: Text(context.i18n.simulateKeyboardShortcut),
isActive:
_keyPair.physicalKey != null && !_keyPair.isSpecialKey && core.settings.getLocalEnabled(),
value: _keyPair.toString(),
onPressed: () async {
if (!core.settings.getLocalEnabled()) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).enableLocalConnectionMethodFirst,
);
} else {
await showDialog<void>(
context: context,
barrierDismissible: false, // enable Escape key
builder: (c) => HotKeyListenerDialog(
customApp: core.actionHandler.supportedApp! as CustomApp,
keyPair: _keyPair,
),
);
_keyPair.androidAction = null;
setState(() {});
widget.onUpdate();
}
builder: (context) {
return SelectableCard(
icon: RadixIcons.keyboard,
title: Text(context.i18n.simulateKeyboardShortcut),
isActive:
_keyPair.physicalKey != null &&
!_keyPair.isSpecialKey &&
(core.settings.getLocalEnabled() || core.settings.getRemoteKeyboardControlEnabled()),
value: _keyPair.toString(),
onPressed: () async {
await _showModeDropdown(context, SupportedMode.keyboard);
},
);
},
),
if (core.actionHandler.supportedModes.contains(SupportedMode.touch))
SelectableCard(
title: Text(context.i18n.simulateTouch),
icon: core.actionHandler is AndroidActions ? Icons.touch_app_outlined : BootstrapIcons.mouse,
isActive:
((core.actionHandler is AndroidActions || _keyPair.physicalKey == null) &&
_keyPair.touchPosition != Offset.zero) &&
core.settings.getLocalEnabled(),
value: _keyPair.toString(),
onPressed: () async {
if (!core.settings.getLocalEnabled()) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).enableLocalConnectionMethodFirst,
);
} else {
if (_keyPair.touchPosition == Offset.zero) {
_keyPair.touchPosition = Offset(50, 50);
}
_keyPair.physicalKey = null;
_keyPair.logicalKey = null;
_keyPair.androidAction = null;
await Navigator.of(context).push<bool?>(
MaterialPageRoute(
builder: (c) => TouchAreaSetupPage(
keyPair: _keyPair,
),
),
);
setState(() {});
widget.onUpdate();
}
if (core.actionHandler.supportedModes.contains(SupportedMode.touch) &&
(core.settings.getLocalEnabled() || core.settings.getRemoteControlEnabled()))
Builder(
builder: (context) {
return SelectableCard(
title: Text(context.i18n.simulateTouch),
icon: core.actionHandler is AndroidActions ? Icons.touch_app_outlined : BootstrapIcons.mouse,
isActive:
((core.actionHandler is AndroidActions || _keyPair.physicalKey == null) &&
_keyPair.touchPosition != Offset.zero) &&
(core.settings.getLocalEnabled() || core.settings.getRemoteControlEnabled()),
value: _keyPair.toString(),
trailing: IconButton.secondary(
icon: Icon(Icons.ondemand_video),
onPressed: () {
launchUrlString('https://youtube.com/shorts/SvLOQqu2Dqg?feature=share');
},
),
onPressed: () async {
await _showModeDropdown(context, SupportedMode.touch);
},
);
},
),
@@ -308,10 +230,15 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
isActive: _keyPair.isSpecialKey && core.settings.getLocalEnabled(),
title: Text(context.i18n.simulateMediaKey),
value: _keyPair.toString(),
trailing: IconButton.secondary(
icon: Icon(Icons.ondemand_video),
onPressed: () {
launchUrlString('https://youtube.com/shorts/ClY1eTnmAv0?feature=share');
},
),
onPressed: () {
if (!core.settings.getLocalEnabled()) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).enableLocalConnectionMethodFirst,
);
} else {
@@ -411,9 +338,15 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
isActive: _keyPair.androidAction != null && core.settings.getLocalEnabled(),
title: Text(AppLocalizations.of(context).androidSystemAction),
value: _keyPair.androidAction?.title,
trailing: IconButton.secondary(
icon: Icon(Icons.ondemand_video),
onPressed: () {
launchUrlString('https://youtube.com/shorts/zqD5ARGIVmE?feature=share');
},
),
onPressed: () {
if (!core.settings.getLocalEnabled()) {
buildToast(navigatorKey.currentContext!, title: 'Enable Local Connection method, first.');
buildToast(title: 'Enable Local Connection method, first.');
} else {
showDropdown(
context: context,
@@ -565,6 +498,7 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
_keyPair.androidAction = null;
_keyPair.inGameAction = action;
_keyPair.inGameActionValue = ingame;
_keyPair.isLongPress = _keyPair.isLongPress ? true : action.isLongPress;
widget.onUpdate();
setState(() {});
},
@@ -580,6 +514,7 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
_keyPair.androidAction = null;
_keyPair.inGameAction = action;
_keyPair.inGameActionValue = null;
_keyPair.isLongPress = _keyPair.isLongPress ? true : action.isLongPress;
widget.onUpdate();
setState(() {});
}
@@ -589,11 +524,133 @@ class _ButtonEditPageState extends State<ButtonEditPage> {
);
}).toList();
}
Future<void> _showModeDropdown(BuildContext context, SupportedMode supportedMode) async {
final trainerApp = core.settings.getTrainerApp();
final actionsWithInGameAction = trainerApp?.keymap.keyPairs
.where(
(kp) =>
kp.inGameAction != null &&
switch (supportedMode) {
SupportedMode.keyboard => kp.physicalKey != null,
SupportedMode.touch => kp.touchPosition != Offset.zero,
SupportedMode.media => kp.isSpecialKey,
},
)
.distinctBy((kp) => kp.inGameAction)
.toList();
final isEnabled =
supportedMode == SupportedMode.keyboard &&
(core.settings.getLocalEnabled() || core.settings.getRemoteKeyboardControlEnabled()) ||
supportedMode == SupportedMode.touch &&
(core.settings.getLocalEnabled() || core.settings.getRemoteControlEnabled()) ||
supportedMode == SupportedMode.media && core.settings.getLocalEnabled();
if (!isEnabled) {
return buildToast(
title: AppLocalizations.of(context).enableLocalConnectionMethodFirst,
);
} else if (actionsWithInGameAction != null && actionsWithInGameAction.isNotEmpty) {
showDropdown(
context: context,
builder: (c) => DropdownMenu(
children: [
MenuLabel(child: Text(context.i18n.predefinedAction(trainerApp?.name ?? 'App'))),
...actionsWithInGameAction.map((keyPairAction) {
return MenuButton(
leading: keyPairAction.inGameAction?.icon != null ? Icon(keyPairAction.inGameAction!.icon) : null,
onPressed: (_) {
// Copy all properties from the selected predefined action
if (core.actionHandler.supportedModes.contains(SupportedMode.keyboard)) {
_keyPair.physicalKey = keyPairAction.physicalKey;
_keyPair.logicalKey = keyPairAction.logicalKey;
_keyPair.modifiers = List.of(keyPairAction.modifiers);
} else {
_keyPair.physicalKey = null;
_keyPair.logicalKey = null;
_keyPair.modifiers = [];
}
if (core.actionHandler.supportedModes.contains(SupportedMode.touch)) {
_keyPair.touchPosition = keyPairAction.touchPosition;
} else {
_keyPair.touchPosition = Offset.zero;
}
_keyPair.isLongPress = keyPairAction.isLongPress;
_keyPair.inGameAction = keyPairAction.inGameAction;
_keyPair.inGameActionValue = keyPairAction.inGameActionValue;
_keyPair.androidAction = null;
setState(() {});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(keyPairAction.inGameAction?.title ?? ''),
Text(switch (supportedMode) {
SupportedMode.keyboard => keyPairAction.logicalKey?.keyLabel ?? 'Not assigned',
SupportedMode.touch =>
'X:${keyPairAction.touchPosition.dx.toInt()}, Y:${keyPairAction.touchPosition.dy.toInt()}',
SupportedMode.media => throw UnimplementedError(),
}).muted.small,
],
),
);
}),
MenuDivider(),
MenuLabel(child: Text('Custom ${supportedMode.name.capitalize()} action')),
MenuButton(
leading: Icon(Icons.edit_outlined),
onPressed: (_) {
_editAction(supportedMode);
},
child: Text('Custom'),
),
],
),
);
} else {
_editAction(supportedMode);
}
}
Future<void> _editAction(SupportedMode supportedMode) async {
if (supportedMode == SupportedMode.keyboard) {
await showDialog<void>(
context: context,
barrierDismissible: false, // enable Escape key
builder: (c) => HotKeyListenerDialog(
customApp: core.actionHandler.supportedApp! as CustomApp,
keyPair: _keyPair,
),
);
_keyPair.androidAction = null;
setState(() {});
widget.onUpdate();
} else if (supportedMode == SupportedMode.touch) {
if (_keyPair.touchPosition == Offset.zero) {
_keyPair.touchPosition = Offset(50, 50);
}
_keyPair.physicalKey = null;
_keyPair.logicalKey = null;
_keyPair.androidAction = null;
await Navigator.of(context).push<bool?>(
MaterialPageRoute(
builder: (c) => TouchAreaSetupPage(
keyPair: _keyPair,
),
),
);
setState(() {});
widget.onUpdate();
}
}
}
class SelectableCard extends StatelessWidget {
final Widget title;
final Widget? subtitle;
final Widget? trailing;
final IconData? icon;
final bool isActive;
final String? value;
@@ -604,6 +661,7 @@ class SelectableCard extends StatelessWidget {
required this.title,
this.icon,
this.subtitle,
this.trailing,
required this.isActive,
this.value,
required this.onPressed,
@@ -648,6 +706,7 @@ class SelectableCard extends StatelessWidget {
: null,
title: title,
subtitle: value != null && isActive ? Text(value!) : subtitle,
trailing: trailing,
),
),
);

View File

@@ -6,6 +6,7 @@ import 'package:bike_control/bluetooth/devices/openbikecontrol/obc_mdns_emulator
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/zwift_emulator.dart';
import 'package:bike_control/bluetooth/remote_keyboard_pairing.dart';
import 'package:bike_control/bluetooth/remote_pairing.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/pages/touch_area.dart';
@@ -22,7 +23,8 @@ import 'package:bike_control/widgets/apps/openbikecontrol_ble_tile.dart';
import 'package:bike_control/widgets/apps/openbikecontrol_mdns_tile.dart';
import 'package:bike_control/widgets/apps/zwift_mdns_tile.dart';
import 'package:bike_control/widgets/apps/zwift_tile.dart';
import 'package:bike_control/widgets/pair_widget.dart';
import 'package:bike_control/widgets/keyboard_pair_widget.dart';
import 'package:bike_control/widgets/mouse_pair_widget.dart';
import 'package:bike_control/widgets/ui/gradient_text.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:bike_control/widgets/ui/warning.dart';
@@ -172,7 +174,7 @@ class _ButtonSimulatorState extends State<ButtonSimulator> {
} else {
_pressedAction = null;
setState(() {});
buildToast(context, title: 'No connected trainer.');
buildToast(title: 'No connected trainer.');
}
return KeyEventResult.ignored;
@@ -232,12 +234,21 @@ class _ButtonSimulatorState extends State<ButtonSimulator> {
),
OpenBikeControlMdnsEmulator.connectionTitle => OpenBikeControlMdnsTile(),
OpenBikeControlBluetoothEmulator.connectionTitle => OpenBikeControlBluetoothTile(),
RemotePairing.connectionTitle => RemotePairingWidget(),
RemotePairing.connectionTitle => RemoteMousePairingWidget(),
RemoteKeyboardPairing.connectionTitle => RemoteKeyboardPairingWidget(),
_ => SizedBox.shrink(),
},
...connectedTrainers.map(
(connection) {
final supportedActions = connection.supportedActions;
final supportedActions = connection.supportedActions == InGameAction.values
? core.settings
.getTrainerApp()!
.keymap
.keyPairs
.mapNotNull((k) => k.inGameAction)
.distinct()
.toList()
: connection.supportedActions;
final actionGroups = {
if (supportedActions.contains(InGameAction.shiftUp) &&
@@ -443,7 +454,7 @@ class _ButtonSimulatorState extends State<ButtonSimulator> {
}) async {
if (!connection.isConnected.value) {
if (down) {
buildToast(context, title: 'No connected trainer.');
buildToast(title: 'No connected trainer.');
}
return;
@@ -499,7 +510,7 @@ class _ButtonSimulatorState extends State<ButtonSimulator> {
);
await IAPManager.instance.incrementCommandCount();
if (result is! Success) {
buildToast(context, title: result.message);
buildToast(title: result.message);
}
}
}

View File

@@ -110,56 +110,6 @@ class _DevicePageState extends State<DevicePage> {
),
],
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows))
ValueListenableBuilder(
valueListenable: core.mediaKeyHandler.isMediaKeyDetectionEnabled,
builder: (context, value, child) {
return SelectableCard(
isActive: value,
icon: value ? Icons.check_box : Icons.check_box_outline_blank,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
Text(context.i18n.enableMediaKeyDetection),
Text(
context.i18n.mediaKeyDetectionTooltip,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
),
),
],
),
onPressed: () {
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value =
!core.mediaKeyHandler.isMediaKeyDetectionEnabled.value;
},
);
},
),
SizedBox(),
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS) && !core.settings.getShowOnboarding())
SelectableCard(
isActive: core.settings.getPhoneSteeringEnabled(),
icon: core.settings.getPhoneSteeringEnabled() ? Icons.check_box : Icons.check_box_outline_blank,
title: Row(
spacing: 4,
children: [
Icon(InGameAction.navigateRight.icon!, size: 16),
Icon(InGameAction.navigateLeft.icon!, size: 16),
SizedBox(),
Expanded(child: Text(AppLocalizations.of(context).enableSteeringWithPhone)),
],
),
onPressed: () {
final enable = !core.settings.getPhoneSteeringEnabled();
core.settings.setPhoneSteeringEnabled(enable);
core.connection.toggleGyroscopeSteering(enable);
setState(() {});
},
),
Gap(12),
if (!screenshotMode)
Column(
@@ -169,7 +119,7 @@ class _DevicePageState extends State<DevicePage> {
OutlineButton(
onPressed: () {
launchUrlString(
'https://github.com/jonasbark/swiftcontrol/?tab=readme-ov-file#supported-devices',
'https://github.com/OpenBikeControl/bikecontrol/?tab=readme-ov-file#supported-devices',
);
},
leading: Icon(Icons.gamepad_outlined),
@@ -228,8 +178,66 @@ class _DevicePageState extends State<DevicePage> {
),
],
),
Gap(12),
SizedBox(),
Gap(24),
if (!kIsWeb && (Platform.isMacOS || Platform.isWindows || Platform.isIOS))
ValueListenableBuilder(
valueListenable: core.mediaKeyHandler.isMediaKeyDetectionEnabled,
builder: (context, value, child) {
return SelectableCard(
isActive: value,
icon: value ? Icons.check_box : Icons.check_box_outline_blank,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8,
children: [
Text(context.i18n.enableMediaKeyDetection),
Text(
context.i18n.mediaKeyDetectionTooltip,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
),
),
],
),
onPressed: () {
final newValue = !core.mediaKeyHandler.isMediaKeyDetectionEnabled.value;
core.mediaKeyHandler.isMediaKeyDetectionEnabled.value = newValue;
core.settings.setMediaKeyDetectionEnabled(newValue);
},
);
},
),
Gap(8),
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS) && !core.settings.getShowOnboarding())
SelectableCard(
isActive: core.settings.getPhoneSteeringEnabled(),
icon: core.settings.getPhoneSteeringEnabled() ? Icons.check_box : Icons.check_box_outline_blank,
title: Row(
spacing: 4,
children: [
Icon(InGameAction.navigateRight.icon!, size: 16),
Icon(InGameAction.navigateLeft.icon!, size: 16),
SizedBox(),
Expanded(child: Text(AppLocalizations.of(context).enableSteeringWithPhone)),
IconButton.secondary(
icon: Icon(Icons.ondemand_video),
onPressed: () {
launchUrlString('https://youtube.com/shorts/zqD5ARGIVmE?feature=share');
},
),
],
),
onPressed: () {
final enable = !core.settings.getPhoneSteeringEnabled();
core.settings.setPhoneSteeringEnabled(enable);
core.connection.toggleGyroscopeSteering(enable);
setState(() {});
},
),
SizedBox(height: 16),
if (core.connection.controllerDevices.isNotEmpty)
Row(
spacing: 8,

View File

@@ -92,7 +92,7 @@ class _ChangelogPageState extends State<MarkdownPage> {
Future<void> _loadOnlineVersion() async {
// load latest version
final response = await http.get(
Uri.parse('https://raw.githubusercontent.com/jonasbark/swiftcontrol/refs/heads/main/${widget.assetPath}'),
Uri.parse('https://raw.githubusercontent.com/OpenBikeControl/bikecontrol/refs/heads/main/${widget.assetPath}'),
);
if (response.statusCode == 200) {
final latestMd = response.body;

View File

@@ -14,6 +14,7 @@ import 'package:bike_control/widgets/scan.dart';
import 'package:bike_control/widgets/title.dart';
import 'package:bike_control/widgets/ui/help_button.dart';
import 'package:bike_control/widgets/ui/permissions_list.dart';
import 'package:dartx/dartx.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';
@@ -108,9 +109,10 @@ class _OnboardingPageState extends State<OnboardingPage> {
_OnboardingStep.trainer => _TrainerOnboardingStep(
onComplete: () {
setState(() {
if (core.settings.getTrainerApp()?.supportsOpenBikeProtocol.contains(
if (core.settings.getTrainerApp()?.supportsOpenBikeProtocol.containsAny([
OpenBikeProtocolSupport.network,
) ??
OpenBikeProtocolSupport.dircon,
]) ??
false) {
_currentStep = _OnboardingStep.openbikecontrol;
} else {
@@ -256,7 +258,7 @@ class _ConnectOnboardingStepState extends State<_ConnectOnboardingStep> {
OutlineButton(
onPressed: () {
launchUrlString('https://github.com/jonasbark/swiftcontrol/?tab=readme-ov-file#supported-devices');
launchUrlString('https://github.com/OpenBikeControl/bikecontrol/?tab=readme-ov-file#supported-devices');
},
leading: Icon(Icons.gamepad_outlined),
child: Text(context.i18n.showSupportedControllers),

View File

@@ -296,6 +296,8 @@ class _TouchAreaSetupPageState extends State<TouchAreaSetupPage> {
final relativeX = ((newPos.dx - _imageRect.left) / _imageRect.width).clamp(0.0, 1.0);
final relativeY = ((newPos.dy - _imageRect.top) / _imageRect.height).clamp(0.0, 1.0);
keyPair.touchPosition = Offset(relativeX * 100.0, relativeY * 100.0);
keyPair.inGameAction = null;
keyPair.inGameActionValue = null;
setState(() {});
},
color: Colors.red,

View File

@@ -14,7 +14,8 @@ import 'package:bike_control/widgets/apps/openbikecontrol_mdns_tile.dart';
import 'package:bike_control/widgets/apps/zwift_mdns_tile.dart';
import 'package:bike_control/widgets/apps/zwift_tile.dart';
import 'package:bike_control/widgets/iap_status_widget.dart';
import 'package:bike_control/widgets/pair_widget.dart';
import 'package:bike_control/widgets/keyboard_pair_widget.dart';
import 'package:bike_control/widgets/mouse_pair_widget.dart';
import 'package:bike_control/widgets/ui/colored_title.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:dartx/dartx.dart';
@@ -25,6 +26,7 @@ import 'package:universal_ble/universal_ble.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
import '../utils/keymap/apps/supported_app.dart';
import '../utils/keymap/apps/zwift.dart';
class TrainerPage extends StatefulWidget {
final bool isMobile;
@@ -53,7 +55,7 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
if (core.logic.showForegroundMessage) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// show snackbar to inform user that the app needs to stay in foreground
buildToast(context, title: AppLocalizations.current.touchSimulationForegroundMessage);
buildToast(title: AppLocalizations.current.touchSimulationForegroundMessage);
});
}
@@ -81,7 +83,7 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
UniversalBle.getBluetoothAvailabilityState().then((state) {
if (state == AvailabilityState.poweredOn && mounted) {
core.remotePairing.reconnect();
buildToast(context, title: AppLocalizations.current.touchSimulationForegroundMessage);
buildToast(title: AppLocalizations.current.touchSimulationForegroundMessage);
}
});
}
@@ -91,9 +93,8 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
final showLocalAsOther =
(core.logic.showObpBluetoothEmulator || core.logic.showObpMdnsEmulator) &&
core.logic.showLocalControl &&
!core.settings.getLocalEnabled();
//(core.logic.showObpBluetoothEmulator || core.logic.showObpMdnsEmulator) &&
false && core.logic.showLocalControl && !core.settings.getLocalEnabled();
final showWhooshLinkAsOther =
(core.logic.showObpBluetoothEmulator || core.logic.showObpMdnsEmulator) && core.logic.showMyWhooshLink;
@@ -122,11 +123,12 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
),
if (core.logic.showLocalControl && !showLocalAsOther) LocalTile(),
if (core.logic.showMyWhooshLink && !showWhooshLinkAsOther) MyWhooshLinkTile(),
if (core.logic.showRemote && core.settings.getTrainerApp() is! Zwift) RemoteKeyboardPairingWidget(),
];
final otherTiles = [
if (core.logic.showRemote) RemotePairingWidget(),
if (showLocalAsOther) LocalTile(),
if (core.logic.showRemote) RemoteMousePairingWidget(),
if (core.logic.showLocalControl && showLocalAsOther) LocalTile(),
if (showWhooshLinkAsOther) MyWhooshLinkTile(),
];
@@ -202,8 +204,8 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
),
),
if (core.settings.getTrainerApp() != null) ...[
Gap(22),
if (recommendedTiles.isNotEmpty) ...[
Gap(22),
ColoredTitle(text: context.i18n.recommendedConnectionMethods),
Gap(12),
],
@@ -228,6 +230,8 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
child: Accordion(
items: [
AccordionItem(
expanded:
recommendedTiles.isEmpty || (core.logic.showRemote && core.remotePairing.isStarted.value),
trigger: AccordionTrigger(child: ColoredTitle(text: context.i18n.otherConnectionMethods)),
content: Column(
children: [
@@ -269,7 +273,6 @@ class _TrainerPageState extends State<TrainerPage> with WidgetsBindingObserver {
onPressed: () {
if (core.settings.getTrainerApp() == null) {
buildToast(
context,
level: LogLevel.LOGLEVEL_WARNING,
title: context.i18n.selectTrainerApp,
);

View File

@@ -36,7 +36,7 @@ class _UnlockPageState extends State<UnlockPage> with SingleTickerProviderStateM
void _isConnectedUpdate() {
setState(() {});
if (emulator.isUnlocked.value) {
if (ftmsEmulator.isUnlocked.value) {
_close();
}
}
@@ -47,8 +47,8 @@ class _UnlockPageState extends State<UnlockPage> with SingleTickerProviderStateM
_isInTrialPhase = !IAPManager.instance.isPurchased.value && IAPManager.instance.isTrialExpired;
_ticker = createTicker((_) {
if (emulator.waiting.value) {
final waitUntil = emulator.connectionDate!.add(Duration(minutes: 1));
if (ftmsEmulator.waiting.value) {
final waitUntil = ftmsEmulator.connectionDate!.add(Duration(minutes: 1));
final secondsUntil = waitUntil.difference(DateTime.now()).inSeconds;
if (mounted) {
@@ -79,13 +79,13 @@ class _UnlockPageState extends State<UnlockPage> with SingleTickerProviderStateM
core.settings.setObpMdnsEnabled(false);
}
emulator.isUnlocked.value = false;
emulator.alreadyUnlocked.value = false;
emulator.waiting.value = false;
emulator.isConnected.addListener(_isConnectedUpdate);
emulator.isUnlocked.addListener(_isConnectedUpdate);
emulator.alreadyUnlocked.addListener(_isConnectedUpdate);
emulator.startServer().then((_) {}).catchError((e, s) {
ftmsEmulator.isUnlocked.value = false;
ftmsEmulator.alreadyUnlocked.value = false;
ftmsEmulator.waiting.value = false;
ftmsEmulator.isConnected.addListener(_isConnectedUpdate);
ftmsEmulator.isUnlocked.addListener(_isConnectedUpdate);
ftmsEmulator.alreadyUnlocked.addListener(_isConnectedUpdate);
ftmsEmulator.startServer().then((_) {}).catchError((e, s) {
recordError(e, s, context: 'Emulator');
core.connection.signalNotification(AlertNotification(LogLevel.LOGLEVEL_ERROR, e.toString()));
});
@@ -96,10 +96,10 @@ class _UnlockPageState extends State<UnlockPage> with SingleTickerProviderStateM
void dispose() {
_ticker.dispose();
if (!_isInTrialPhase) {
emulator.isConnected.removeListener(_isConnectedUpdate);
emulator.isUnlocked.removeListener(_isConnectedUpdate);
emulator.alreadyUnlocked.removeListener(_isConnectedUpdate);
emulator.stop();
ftmsEmulator.isConnected.removeListener(_isConnectedUpdate);
ftmsEmulator.isUnlocked.removeListener(_isConnectedUpdate);
ftmsEmulator.alreadyUnlocked.removeListener(_isConnectedUpdate);
ftmsEmulator.stop();
if (_wasZwiftMdnsEmulatorActive) {
core.zwiftMdnsEmulator.startServer();
@@ -171,30 +171,30 @@ class _UnlockPageState extends State<UnlockPage> with SingleTickerProviderStateM
closeDrawer(context);
},
),
] else if (!emulator.isConnected.value) ...[
] else if (!ftmsEmulator.isConnected.value) ...[
Text(AppLocalizations.of(context).unlock_openZwift).li,
Text(AppLocalizations.of(context).unlock_connectToBikecontrol).li,
SizedBox(height: 32),
Text(AppLocalizations.of(context).unlock_bikecontrolAndZwiftNetwork).small,
] else if (emulator.alreadyUnlocked.value) ...[
] else if (ftmsEmulator.alreadyUnlocked.value) ...[
Text(AppLocalizations.of(context).unlock_yourZwiftClickMightBeUnlockedAlready),
SizedBox(height: 8),
Text(AppLocalizations.of(context).unlock_confirmByPressingAButtonOnYourDevice).small,
] else if (!emulator.isUnlocked.value)
] else if (!ftmsEmulator.isUnlocked.value)
Text(AppLocalizations.of(context).unlock_waitingForZwift)
else
Text('Zwift Click is unlocked! You can now close this page.'),
SizedBox(height: 32),
if (!_showManualSteps && !_isInTrialPhase) ...[
if (emulator.waiting.value && _secondsRemaining >= 0)
if (ftmsEmulator.waiting.value && _secondsRemaining >= 0)
Center(child: CircularProgressIndicator(value: 1 - (_secondsRemaining / 60), size: 20))
else if (emulator.alreadyUnlocked.value)
else if (ftmsEmulator.alreadyUnlocked.value)
Center(child: Icon(Icons.lock_clock))
else
SmallProgressIndicator(),
SizedBox(height: 20),
],
if (!emulator.isUnlocked.value && !_showManualSteps) ...[
if (!ftmsEmulator.isUnlocked.value && !_showManualSteps) ...[
if (!_isInTrialPhase) ...[
SizedBox(height: 32),
Center(child: Text(AppLocalizations.of(context).unlock_notWorking).small),

View File

@@ -17,13 +17,15 @@ class AndroidActions extends BaseActions {
final accessibilityHandler = Accessibility();
StreamSubscription<void>? _keymapUpdateSubscription;
StreamSubscription<WindowEvent>? _accessibilitySubscription;
StreamSubscription<AKeyEvent>? _hidKeyPressedSubscription;
AndroidActions({super.supportedModes = const [SupportedMode.touch, SupportedMode.media]});
@override
void init(SupportedApp? supportedApp) {
super.init(supportedApp);
streamEvents().listen((windowEvent) {
_accessibilitySubscription = streamEvents().listen((windowEvent) {
if (supportedApp != null) {
windowInfo = windowEvent;
}
@@ -38,7 +40,7 @@ class AndroidActions extends BaseActions {
updateHandledKeys();
});
hidKeyPressed().listen((keyPressed) async {
_hidKeyPressedSubscription = hidKeyPressed().listen((keyPressed) async {
final hidDevice = HidDevice(keyPressed.source);
final button = hidDevice.getOrAddButton(keyPressed.hidKey, () => ControllerButton(keyPressed.hidKey));
@@ -129,4 +131,11 @@ class AndroidActions extends BaseActions {
accessibilityHandler.setHandledKeys(handledKeys);
}
@override
void cleanup() {
_accessibilitySubscription?.cancel();
_keymapUpdateSubscription?.cancel();
_hidKeyPressedSubscription?.cancel();
}
}

View File

@@ -49,6 +49,8 @@ abstract class BaseActions {
BaseActions({required this.supportedModes});
void cleanup();
void init(SupportedApp? supportedApp) {
this.supportedApp = supportedApp;
debugPrint('Supported app: ${supportedApp?.name ?? "None"}');
@@ -176,11 +178,41 @@ abstract class BaseActions {
class StubActions extends BaseActions {
StubActions({super.supportedModes = const []});
final List<(ControllerButton button, bool isDown, bool isUp)> performedActions = [];
final List<PerformedAction> performedActions = [];
@override
Future<ActionResult> performAction(ControllerButton button, {bool isKeyDown = true, bool isKeyUp = false}) async {
performedActions.add((button, isKeyDown, isKeyUp));
performedActions.add(PerformedAction(button, isDown: isKeyDown, isUp: isKeyUp));
return Future.value(Ignored('${button.name.splitByUpperCase()} clicked'));
}
@override
void cleanup() {
performedActions.clear();
}
}
class PerformedAction {
final ControllerButton button;
final bool isDown;
final bool isUp;
PerformedAction(this.button, {required this.isDown, required this.isUp});
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PerformedAction &&
runtimeType == other.runtimeType &&
button.copyWith(sourceDeviceId: null) == other.button.copyWith(sourceDeviceId: null) &&
isDown == other.isDown &&
isUp == other.isUp;
@override
int get hashCode => Object.hash(button, isDown, isUp);
@override
String toString() {
return '{button: $button, isDown: $isDown, isUp: $isUp}';
}
}

View File

@@ -40,8 +40,6 @@ class DesktopActions extends BaseActions {
final label = keyPair.logicalKey!.keyLabel;
final keyName = label.isNotEmpty ? label : keyPair.logicalKey!.debugName ?? 'Key';
buildToast(
navigatorKey.currentContext!,
location: ToastLocation.bottomLeft,
title:
'${isKeyDown
@@ -96,4 +94,7 @@ class DesktopActions extends BaseActions {
}
}
}
@override
void cleanup() {}
}

View File

@@ -7,7 +7,7 @@ import 'package:bike_control/utils/keymap/buttons.dart';
import 'package:bike_control/utils/keymap/keymap.dart';
class RemoteActions extends BaseActions {
RemoteActions({super.supportedModes = const [SupportedMode.touch]});
RemoteActions({super.supportedModes = const [SupportedMode.touch, SupportedMode.keyboard]});
@override
Future<ActionResult> performAction(ControllerButton button, {required bool isKeyDown, required bool isKeyUp}) async {
@@ -16,14 +16,22 @@ class RemoteActions extends BaseActions {
return superResult;
}
final keyPair = supportedApp!.keymap.getKeyPair(button)!;
if (!core.remotePairing.isConnected.value) {
if (!core.remotePairing.isConnected.value && !core.remoteKeyboardPairing.isConnected.value) {
return Error('Not connected to a ${core.settings.getLastTarget()?.name ?? 'remote'} device');
}
if (keyPair.physicalKey != null && keyPair.touchPosition == Offset.zero) {
return Error('Physical key actions are not supported, yet');
} else {
if (core.remotePairing.isConnected.value) {
if (keyPair.touchPosition == Offset.zero) {
return Error('Key $keyPair does not have a valid touch position');
}
return core.remotePairing.sendAction(keyPair, isKeyDown: isKeyDown, isKeyUp: isKeyUp);
} else if (core.remoteKeyboardPairing.isConnected.value) {
if (keyPair.physicalKey == null) {
return Error('Key $keyPair does not have a valid physical key for keyboard actions');
}
return core.remoteKeyboardPairing.sendAction(keyPair, isKeyDown: isKeyDown, isKeyUp: isKeyUp);
} else {
return Error('Not connected to a ${core.settings.getLastTarget()?.name ?? 'remote'} device');
}
}
@@ -32,4 +40,7 @@ class RemoteActions extends BaseActions {
// for remote actions we use the relative position only
return keyPair.touchPosition;
}
@override
void cleanup() {}
}

View File

@@ -5,9 +5,9 @@ import 'package:bike_control/bluetooth/devices/openbikecontrol/obc_mdns_emulator
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:prop/prop.dart';
import 'package:bike_control/bluetooth/devices/zwift/zwift_emulator.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/bluetooth/remote_keyboard_pairing.dart';
import 'package:bike_control/bluetooth/remote_pairing.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/actions/android.dart';
@@ -21,6 +21,7 @@ import 'package:dartx/dartx.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:prop/prop.dart';
import 'package:universal_ble/universal_ble.dart';
import '../bluetooth/connection.dart';
@@ -44,6 +45,7 @@ class Core {
late final obpMdnsEmulator = OpenBikeControlMdnsEmulator();
late final obpBluetoothEmulator = OpenBikeControlBluetoothEmulator();
late final remotePairing = RemotePairing();
late final remoteKeyboardPairing = RemoteKeyboardPairing();
late final mediaKeyHandler = MediaKeyHandler();
late final logic = CoreLogic();
@@ -168,7 +170,11 @@ class CoreLogic {
}
bool get showObpMdnsEmulator {
return core.settings.getTrainerApp()?.supportsOpenBikeProtocol.contains(OpenBikeProtocolSupport.network) == true;
return core.settings.getTrainerApp()?.supportsOpenBikeProtocol.containsAny([
OpenBikeProtocolSupport.network,
OpenBikeProtocolSupport.dircon,
]) ==
true;
}
bool get showObpBluetoothEmulator {
@@ -180,6 +186,10 @@ class CoreLogic {
return core.settings.getRemoteControlEnabled() && showRemote;
}
bool get isRemoteKeyboardControlEnabled {
return core.settings.getRemoteKeyboardControlEnabled() && showRemote;
}
bool get showMyWhooshLink =>
core.settings.getTrainerApp() is MyWhoosh &&
core.settings.getLastTarget() != null &&
@@ -210,7 +220,8 @@ class CoreLogic {
core.settings.getTrainerApp()?.supportsOpenBikeProtocol.isNotEmpty == true;
bool get showLocalRemoteOptions =>
core.actionHandler.supportedModes.isNotEmpty && ((showLocalControl) || (isRemoteControlEnabled));
core.actionHandler.supportedModes.isNotEmpty &&
(showLocalControl || isRemoteControlEnabled || isRemoteKeyboardControlEnabled);
bool get hasNoConnectionMethod =>
!screenshotMode &&
@@ -235,6 +246,7 @@ class CoreLogic {
if (isZwiftBleEnabled) core.zwiftEmulator,
if (isZwiftMdnsEnabled) core.zwiftMdnsEmulator,
if (isRemoteControlEnabled) core.remotePairing,
if (isRemoteKeyboardControlEnabled) core.remoteKeyboardPairing,
].filter((e) => e.isConnected.value).toList();
List<TrainerConnection> get enabledTrainerConnections => [
@@ -244,6 +256,7 @@ class CoreLogic {
if (isZwiftBleEnabled) core.zwiftEmulator,
if (isZwiftMdnsEnabled) core.zwiftMdnsEmulator,
if (isRemoteControlEnabled) core.remotePairing,
if (isRemoteKeyboardControlEnabled) core.remoteKeyboardPairing,
];
List<TrainerConnection> get trainerConnections => [
@@ -253,6 +266,7 @@ class CoreLogic {
if (showZwiftBleEmulator) core.zwiftEmulator,
if (showZwiftMsdnEmulator) core.zwiftMdnsEmulator,
if (showRemote) core.remotePairing,
if (showRemote) core.remoteKeyboardPairing,
];
Future<bool> isTrainerConnected() async {
@@ -329,5 +343,15 @@ class CoreLogic {
);
});
}
if (isRemoteKeyboardControlEnabled && !core.remoteKeyboardPairing.isStarted.value) {
core.remoteKeyboardPairing.startAdvertising().catchError((e, s) {
recordError(e, s, context: 'Remote Keyboard Pairing');
core.settings.setRemoteKeyboardControlEnabled(false);
core.connection.signalNotification(
AlertNotification(LogLevel.LOGLEVEL_WARNING, 'Failed to start Remote Keyboard Control pairing: $e'),
);
});
}
}
}

View File

@@ -217,6 +217,8 @@ class IAPManager {
}
void setAttributes() {
_revenueCatService?.setAttributes();
if (!screenshotMode) {
_revenueCatService?.setAttributes();
}
}
}

View File

@@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';
import 'package:bike_control/bluetooth/messages/notification.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/widgets/ui/toast.dart';
@@ -34,7 +33,6 @@ class RevenueCatService {
final int Function() getDailyCommandLimit;
final void Function(int limit) setDailyCommandLimit;
static const _isAndroidWorking = false;
bool _isInitialized = false;
String? _trialStartDate;
String? _lastCommandDate;
@@ -119,9 +117,7 @@ class RevenueCatService {
_isInitialized = true;
if (Platform.isAndroid && !isPurchasedNotifier.value && !_isAndroidWorking) {
setDailyCommandLimit(10000);
} else if (!isTrialExpired && Platform.isAndroid) {
if (!isTrialExpired && Platform.isAndroid) {
setDailyCommandLimit(80);
}
} catch (e, s) {
@@ -240,14 +236,7 @@ class RevenueCatService {
/// Purchase the full version (use paywall instead)
Future<void> purchaseFullVersion(BuildContext context) async {
// Direct the user to the paywall for a better experience
if (Platform.isAndroid && !_isAndroidWorking) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).unlockingNotPossible,
duration: Duration(seconds: 5),
);
setDailyCommandLimit(10000);
} else if (Platform.isMacOS) {
if (Platform.isMacOS) {
try {
final offerings = await Purchases.getOfferings();
final purchaseParams = PurchaseParams.package(offerings.current!.availablePackages.first);
@@ -258,7 +247,7 @@ class RevenueCatService {
} on PlatformException catch (e) {
var errorCode = PurchasesErrorHelper.getErrorCode(e);
if (errorCode != PurchasesErrorCode.purchaseCancelledError) {
buildToast(context, title: e.message);
buildToast(title: e.message);
}
}
} else {
@@ -314,6 +303,9 @@ class RevenueCatService {
/// Increment the daily command count
Future<void> incrementCommandCount() async {
if (isPurchasedNotifier.value) {
return; // No need to track for purchased users
}
try {
final today = DateTime.now().toIso8601String().split('T')[0];
final lastDate = await _prefs.read(key: _lastCommandDateKey);
@@ -332,7 +324,7 @@ class RevenueCatService {
} catch (e, s) {
final count = _dailyCommandCount ?? 0;
_dailyCommandCount = count + 1;
// e.g. https://github.com/jonasbark/swiftcontrol/issues/279
// e.g. https://github.com/OpenBikeControl/bikecontrol/issues/279
debugPrint('Error incrementing command count: $e');
recordError(e, s, context: 'Incrementing command count');
}

View File

@@ -92,7 +92,6 @@ class WindowsIAPService {
if (status == StorePurchaseStatus.succeeded || status == StorePurchaseStatus.alreadyPurchased) {
IAPManager.instance.isPurchased.value = true;
buildToast(
navigatorKey.currentContext!,
title: 'Purchase Successful',
subtitle: 'Thank you for your purchase! You now have unlimited access.',
);

View File

@@ -10,7 +10,7 @@ class OpenBikeControl extends SupportedApp {
packageName: "org.openbikecontrol",
compatibleTargets: Target.values,
supportsZwiftEmulation: false,
supportsOpenBikeProtocol: OpenBikeProtocolSupport.values,
supportsOpenBikeProtocol: [OpenBikeProtocolSupport.network, OpenBikeProtocolSupport.ble],
keymap: Keymap(
keyPairs: [],
),

View File

@@ -50,6 +50,18 @@ class Rouvy extends SupportedApp {
logicalKey: LogicalKeyboardKey.keyB,
inGameAction: InGameAction.back,
),
KeyPair(
buttons: [ZwiftButtons.a],
physicalKey: PhysicalKeyboardKey.keyY,
logicalKey: LogicalKeyboardKey.keyY,
inGameAction: InGameAction.kudos,
),
KeyPair(
buttons: [ZwiftButtons.y],
physicalKey: PhysicalKeyboardKey.keyZ,
logicalKey: LogicalKeyboardKey.keyZ,
inGameAction: InGameAction.pause,
),
],
),
);

View File

@@ -12,6 +12,7 @@ import 'my_whoosh.dart';
enum OpenBikeProtocolSupport {
ble,
network,
dircon,
}
abstract class SupportedApp {

View File

@@ -18,6 +18,7 @@ class TrainingPeaks extends SupportedApp {
packageName: "com.indieVelo.client",
compatibleTargets: !kIsWeb && Platform.isIOS ? [Target.otherDevice] : Target.values,
supportsZwiftEmulation: false,
supportsOpenBikeProtocol: [OpenBikeProtocolSupport.ble, OpenBikeProtocolSupport.dircon],
star: true,
keymap: Keymap(
keyPairs: [

View File

@@ -12,8 +12,8 @@ enum InGameAction {
shiftUp('Shift Up', icon: BootstrapIcons.patchPlus),
shiftDown('Shift Down', icon: BootstrapIcons.patchMinus),
uturn('U-Turn', alternativeTitle: 'Down', icon: BootstrapIcons.arrowDownUp),
steerLeft('Steer Left', alternativeTitle: 'Left', icon: RadixIcons.doubleArrowLeft),
steerRight('Steer Right', alternativeTitle: 'Right', icon: RadixIcons.doubleArrowRight),
steerLeft('Steer Left', alternativeTitle: 'Left', icon: RadixIcons.doubleArrowLeft, isLongPress: true),
steerRight('Steer Right', alternativeTitle: 'Right', icon: RadixIcons.doubleArrowRight, isLongPress: true),
// mywhoosh
cameraAngle('Change Camera Angle', possibleValues: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], icon: BootstrapIcons.cameraReels),
@@ -31,9 +31,13 @@ enum InGameAction {
back('Back', icon: BootstrapIcons.arrowLeft),
rideOnBomb('Ride On Bomb', icon: LucideIcons.bomb, isLongPress: true),
// rouvy
kudos('Kudos', icon: BootstrapIcons.handThumbsUp),
pause('Pause/Resume', icon: BootstrapIcons.pause, isLongPress: true),
// headwind
headwindSpeed('Headwind Speed', possibleValues: [0, 25, 50, 75, 100]),
headwindHeartRateMode('Headwind HR Mode'),
headwindSpeed('Headwind Speed', possibleValues: [0, 25, 50, 75, 100], icon: Icons.air),
headwindHeartRateMode('Headwind HR Mode', icon: Icons.favorite),
// openbikecontrol
up('Up', icon: RadixIcons.arrowUp),
@@ -95,7 +99,7 @@ class ControllerButton {
}
String get displayName {
if (sourceDeviceId == null || true) {
if (sourceDeviceId == null) {
return name;
}

View File

@@ -8,6 +8,7 @@ import 'package:bike_control/utils/actions/android.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:flutter/services.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
@@ -104,13 +105,17 @@ class Keymap {
void addNewButtons(List<ControllerButton> availableButtons) {
final newButtons = availableButtons.filter((button) => getKeyPair(button) == null);
for (final button in newButtons) {
final buttonFromBase = core.settings.getTrainerApp()?.keymap.getKeyPair(button);
addKeyPair(
KeyPair(
touchPosition: Offset.zero,
touchPosition: buttonFromBase?.touchPosition ?? Offset.zero,
buttons: [button],
physicalKey: null,
logicalKey: null,
isLongPress: false,
inGameAction: button.action,
physicalKey: buttonFromBase?.physicalKey,
logicalKey: buttonFromBase?.logicalKey,
isLongPress: buttonFromBase?.isLongPress ?? false,
inGameActionValue: buttonFromBase?.inGameActionValue,
androidAction: buttonFromBase?.androidAction,
),
);
}
@@ -164,7 +169,12 @@ class KeyPair {
_ => Icons.keyboard,
},
//_ when inGameAction != null && core.logic.emulatorEnabled => Icons.link,
_ when inGameAction != null && inGameAction!.icon != null && core.logic.emulatorEnabled => inGameAction!.icon,
_
when inGameAction != null &&
inGameAction!.icon != null &&
(core.logic.emulatorEnabled ||
[InGameAction.headwindHeartRateMode, InGameAction.headwindSpeed].contains(inGameAction!)) =>
inGameAction!.icon,
_
when androidAction != null &&
@@ -193,10 +203,9 @@ class KeyPair {
bool get hasActiveAction =>
screenshotMode ||
(physicalKey != null &&
core.logic.showLocalControl &&
core.settings.getLocalEnabled() &&
core.actionHandler.supportedModes.contains(SupportedMode.keyboard)) ||
(physicalKey != null && (core.logic.showLocalControl && core.settings.getLocalEnabled()) ||
(core.logic.showRemote && core.settings.getRemoteKeyboardControlEnabled()) &&
core.actionHandler.supportedModes.contains(SupportedMode.keyboard)) ||
(isSpecialKey &&
core.logic.showLocalControl &&
core.settings.getLocalEnabled() &&
@@ -222,11 +231,17 @@ class KeyPair {
(inGameAction != null &&
core.logic.showZwiftMsdnEmulator &&
core.settings.getZwiftMdnsEmulatorEnabled() &&
core.zwiftMdnsEmulator.supportedActions.contains(inGameAction));
core.zwiftMdnsEmulator.supportedActions.contains(inGameAction)) ||
(inGameAction != null &&
[InGameAction.headwindHeartRateMode, InGameAction.headwindSpeed].contains(inGameAction) &&
(core.connection.accessories.isNotEmpty || kDebugMode));
@override
String toString() {
final text = (inGameAction != null && core.logic.emulatorEnabled)
final text =
(inGameAction != null &&
(core.logic.emulatorEnabled ||
[InGameAction.headwindHeartRateMode, InGameAction.headwindSpeed].contains(inGameAction!)))
? [
inGameAction!.title,
if (inGameActionValue != null) '$inGameActionValue',
@@ -246,13 +261,16 @@ class KeyPair {
: (physicalKey != null && core.actionHandler.supportedModes.contains(SupportedMode.keyboard))
? null
: (touchPosition != Offset.zero && core.logic.showLocalRemoteOptions)
? 'X:${touchPosition.dx.toInt()}, Y:${touchPosition.dy.toInt()}'
? 'X:${touchPosition.dx.toInt()}, Y:${touchPosition.dy.toInt()}${inGameAction != null ? ' (${inGameAction!.title})' : ''}'
: '';
if (text != null && text.isNotEmpty) {
return text;
}
final baseKey = logicalKey?.keyLabel ?? text ?? 'Not assigned';
if (physicalKey == null || !core.actionHandler.supportedModes.contains(SupportedMode.keyboard)) {
return 'Not assigned';
}
if (modifiers.isEmpty || baseKey == 'Not assigned') {
if (baseKey.trim().isEmpty) {
return 'Space';

View File

@@ -91,9 +91,9 @@ class KeymapManager {
if (jsonData != null && jsonData.isNotEmpty) {
final success = await core.settings.importCustomAppProfile(jsonData);
if (success) {
buildToast(context, title: context.i18n.profileImportedSuccessfully);
buildToast(title: context.i18n.profileImportedSuccessfully);
} else {
buildToast(context, title: context.i18n.failedToImportProfile);
buildToast(title: context.i18n.failedToImportProfile);
}
}
},
@@ -107,7 +107,7 @@ class KeymapManager {
if (jsonData != null) {
Clipboard.setData(ClipboardData(text: jsonData));
buildToast(context, title: context.i18n.profileExportedToClipboard(currentProfile));
buildToast(title: context.i18n.profileExportedToClipboard(currentProfile));
}
},
),

View File

@@ -4,7 +4,6 @@ import 'dart:isolate';
import 'dart:ui';
import 'package:bike_control/gen/l10n.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/requirements/platform.dart';
@@ -133,7 +132,6 @@ class NotificationRequirement extends PlatformRequirement {
?.requestNotificationsPermission();
if (result == false) {
buildToast(
navigatorKey.currentContext!,
title: 'Enable notifications for BikeControl in Android Settings',
);
}
@@ -148,7 +146,6 @@ class NotificationRequirement extends PlatformRequirement {
core.settings.setHasAskedPermissions(true);
if (result == false) {
buildToast(
navigatorKey.currentContext!,
title: 'Enable notifications for BikeControl in System Preferences → Notifications → Bike Control',
);
launchUrlString('x-apple.systempreferences:com.apple.preference.notifications');
@@ -164,7 +161,6 @@ class NotificationRequirement extends PlatformRequirement {
core.settings.setHasAskedPermissions(true);
if (result == false) {
buildToast(
navigatorKey.currentContext!,
title: 'Enable notifications for BikeControl in System Preferences → Notifications → Bike Control',
);
launchUrlString('x-apple.systempreferences:com.apple.preference.notifications');
@@ -290,6 +286,7 @@ class NotificationRequirement extends PlatformRequirement {
core.connection.disconnectAll();
}
if (message == 'close') {
core.actionHandler.cleanup();
core.connection.stop();
SystemNavigator.pop();
AndroidFlutterLocalNotificationsPlugin().stopForegroundService();

View File

@@ -22,7 +22,6 @@ class KeyboardRequirement extends PlatformRequirement {
@override
Future<void> call(BuildContext context, VoidCallback onUpdate) async {
buildToast(
context,
title: AppLocalizations.current.enableKeyboardAccessMessage,
);
await keyPressSimulator.requestAccess(onlyOpenPrefPane: Platform.isMacOS);
@@ -62,7 +61,7 @@ class BluetoothTurnedOn extends PlatformRequirement {
await PeripheralManager().showAppSettings();
} else if (currentState == AvailabilityState.poweredOff) {
if (Platform.isMacOS) {
buildToast(context, title: name);
buildToast(title: name);
} else {
await UniversalBle.enableBluetooth();
}

View File

@@ -319,6 +319,14 @@ class Settings {
return prefs.getBool('remote_control_enabled') ?? false;
}
void setRemoteKeyboardControlEnabled(bool value) {
prefs.setBool('remote_keyboard_control_enabled', value);
}
bool getRemoteKeyboardControlEnabled() {
return prefs.getBool('remote_keyboard_control_enabled') ?? false;
}
bool getLocalEnabled() {
return prefs.getBool('local_control_enabled') ?? false;
}
@@ -406,4 +414,12 @@ class Settings {
Future<void> setHasAskedPermissions(bool asked) async {
await prefs.setBool('asked_permissions', asked);
}
bool getMediaKeyDetectionEnabled() {
return prefs.getBool('media_key_detection_enabled') ?? false;
}
Future<void> setMediaKeyDetectionEnabled(bool enabled) async {
await prefs.setBool('media_key_detection_enabled', enabled);
}
}

View File

@@ -1,4 +1,3 @@
import 'package:prop/prop.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/pages/markdown.dart';
@@ -6,6 +5,7 @@ import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/widgets/ui/connection_method.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
class MyWhooshLinkTile extends StatefulWidget {
@@ -43,7 +43,6 @@ class _MywhooshLinkTileState extends State<MyWhooshLinkTile> {
core.whooshLink.stopServer();
} else if (value) {
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).myWhooshLinkInfo,
level: LogLevel.LOGLEVEL_INFO,
duration: Duration(seconds: 6),
@@ -60,7 +59,6 @@ class _MywhooshLinkTileState extends State<MyWhooshLinkTile> {
recordError(e, s, context: 'MyWhoosh Link Server');
core.settings.setMyWhooshLinkEnabled(false);
buildToast(
context,
title: context.i18n.errorStartingMyWhooshLink,
);
});

View File

@@ -1,10 +1,10 @@
import 'package:prop/prop.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
import 'package:bike_control/widgets/ui/connection_method.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:dartx/dartx.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
class OpenBikeControlBluetoothTile extends StatefulWidget {
@@ -45,7 +45,6 @@ class _OpenBikeProtocolTileState extends State<OpenBikeControlBluetoothTile> {
recordError(e, s, context: 'OBP BLE Emulator');
core.settings.setObpBleEnabled(false);
buildToast(
context,
level: LogLevel.LOGLEVEL_WARNING,
title: context.i18n.errorStartingOpenBikeControlBluetoothServer,
);

View File

@@ -1,13 +1,15 @@
import 'dart:async';
import 'dart:io';
import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.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:dartx/dartx.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../utils/keymap/apps/custom_app.dart';
@@ -152,8 +154,48 @@ class _HotKeyListenerState extends State<HotKeyListenerDialog> {
mainAxisSize: MainAxisSize.min,
spacing: 20,
children: [
Text(AppLocalizations.current.pressKeyToAssign(_pressedButton.toString())),
Text(
AppLocalizations.current.pressKeyToAssign(_pressedButton?.displayName ?? _pressedButton.toString()),
),
Text(_formatKey(_pressedKey)),
if (kDebugMode && (Platform.isAndroid || Platform.isIOS))
SizedBox(
height: 300,
width: 300,
child: ListView(
shrinkWrap: true,
children: LogicalKeyboardKey.knownLogicalKeys
.map(
(key) => ListTile(
contentPadding: EdgeInsets.zero,
minVerticalPadding: 0,
title: Row(
children: [
Chip(label: Text(key.keyLabel)),
],
),
onTap: () {
setState(() {
_pressedKey = KeyDownEvent(
physicalKey: PhysicalKeyboardKey(0x80),
logicalKey: key,
character: null,
timeStamp: Duration.zero,
);
widget.customApp.setKey(
_pressedButton!,
physicalKey: _pressedKey!.physicalKey,
logicalKey: key,
modifiers: _activeModifiers.toList(),
touchPosition: widget.keyPair?.touchPosition,
);
});
},
),
)
.toList(),
),
),
],
),
),

View File

@@ -3,7 +3,6 @@ import 'dart:io';
import 'package:bike_control/bluetooth/messages/notification.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/i18n_extension.dart';
import 'package:bike_control/utils/iap/iap_manager.dart';
@@ -280,7 +279,6 @@ class _IAPStatusWidgetState extends State<IAPStatusWidget> {
if (redeemed) {
await IAPManager.instance.redeem(purchaseId);
buildToast(
context,
title: 'Success',
subtitle: 'Purchase redeemed successfully!',
);
@@ -469,7 +467,6 @@ class _IAPStatusWidgetState extends State<IAPStatusWidget> {
} catch (e) {
if (mounted) {
buildToast(
navigatorKey.currentContext!,
title: 'Error',
subtitle: 'An error occurred: $e',
);

View File

@@ -0,0 +1,53 @@
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/widgets/ui/connection_method.dart';
import 'package:prop/prop.dart' show LogLevel;
import 'package:shadcn_flutter/shadcn_flutter.dart';
class RemoteKeyboardPairingWidget extends StatefulWidget {
const RemoteKeyboardPairingWidget({super.key});
@override
State<RemoteKeyboardPairingWidget> createState() => _PairWidgetState();
}
class _PairWidgetState extends State<RemoteKeyboardPairingWidget> {
@override
Widget build(BuildContext context) {
return ValueListenableBuilder(
valueListenable: core.remoteKeyboardPairing.isStarted,
builder: (context, isStarted, child) {
return ValueListenableBuilder(
valueListenable: core.remoteKeyboardPairing.isConnected,
builder: (context, isConnected, child) {
return ConnectionMethod(
supportedActions: null,
isEnabled: core.logic.isRemoteKeyboardControlEnabled,
isStarted: isStarted,
showTroubleshooting: true,
type: ConnectionMethodType.bluetooth,
instructionLink: 'https://youtube.com/shorts/qalBSiAz7wg',
title: AppLocalizations.of(context).actAsBluetoothKeyboard,
description: AppLocalizations.of(context).bluetoothKeyboardExplanation,
isConnected: isConnected,
requirements: core.permissions.getRemoteControlRequirements(),
onChange: (value) async {
core.settings.setRemoteKeyboardControlEnabled(value);
if (!value) {
core.remoteKeyboardPairing.stopAdvertising();
} else {
core.remoteKeyboardPairing.startAdvertising().catchError((e) {
core.settings.setRemoteControlEnabled(false);
core.connection.signalNotification(AlertNotification(LogLevel.LOGLEVEL_ERROR, e.toString()));
});
}
setState(() {});
},
);
},
);
},
);
}
}

View File

@@ -75,7 +75,7 @@ class _KeymapExplanationState extends State<KeymapExplanation> {
@override
Widget build(BuildContext context) {
final keyButtonMap = core.connection.devices.associateWith((d) {
final keyButtonMap = core.connection.controllerDevices.associateWith((d) {
final allButtons = d.availableButtons;
return widget.keymap.keyPairs
.whereNot(
@@ -101,27 +101,16 @@ class _KeymapExplanationState extends State<KeymapExplanation> {
for (final devicePair in keyButtonMap.entries) ...[
SizedBox(height: 12),
ColoredTitle(text: devicePair.key.toString()),
if (devicePair.value.isEmpty)
Text(
devicePair.key.buttonExplanation,
style: TextStyle(height: 1),
).muted,
for (final keyPair in devicePair.value) ...[
Button.card(
style: ButtonStyle.card().withBackgroundColor(color: Theme.of(context).colorScheme.background),
onPressed: () async {
if (core.actionHandler.supportedApp is! CustomApp) {
final currentProfile = core.actionHandler.supportedApp!.name;
final newName = await KeymapManager().duplicate(
context,
currentProfile,
skipName: '$currentProfile (Copy)',
);
if (newName != null && context.mounted) {
buildToast(context, title: context.i18n.createdNewCustomProfile(newName));
final selectedKeyPair = core.actionHandler.supportedApp!.keymap.keyPairs.firstWhere(
(e) => e == keyPair,
);
_openKeyPairEditor(selectedKeyPair);
}
} else {
_openKeyPairEditor(keyPair);
}
_openKeyPairEditor(keyPair);
},
child: Row(
children: [
@@ -176,7 +165,22 @@ class _KeymapExplanationState extends State<KeymapExplanation> {
);
}
Future<void> _openKeyPairEditor(KeyPair selectedKeyPair) async {
Future<void> _openKeyPairEditor(KeyPair keyPair) async {
KeyPair selectedKeyPair = keyPair;
if (core.actionHandler.supportedApp is! CustomApp) {
final currentProfile = core.actionHandler.supportedApp!.name;
final newName = await KeymapManager().duplicate(
context,
currentProfile,
skipName: '$currentProfile (Copy)',
);
if (newName != null && context.mounted) {
buildToast(title: context.i18n.createdNewCustomProfile(newName));
selectedKeyPair = core.actionHandler.supportedApp!.keymap.keyPairs.firstWhere(
(e) => e == keyPair,
);
}
}
_isDrawerOpen = true;
await openDrawer(
context: context,

View File

@@ -69,7 +69,7 @@ class _LogviewerState extends State<LogViewer> {
.join('\n');
Clipboard.setData(ClipboardData(text: logText));
buildToast(context, title: context.i18n.logsHaveBeenCopiedToClipboard);
buildToast(title: context.i18n.logsHaveBeenCopiedToClipboard);
},
),
],

View File

@@ -143,6 +143,12 @@ class BKMenuButton extends StatelessWidget {
await core.settings.reset();
},
),
MenuButton(
child: Text('Disconnect'),
onPressed: (c) async {
core.connection.disconnectAll();
},
),
MenuDivider(),
],
if (currentPage == BCPage.logs) ...[

View File

@@ -9,14 +9,14 @@ import 'package:shadcn_flutter/shadcn_flutter.dart';
import '../utils/requirements/multi.dart';
class RemotePairingWidget extends StatefulWidget {
const RemotePairingWidget({super.key});
class RemoteMousePairingWidget extends StatefulWidget {
const RemoteMousePairingWidget({super.key});
@override
State<RemotePairingWidget> createState() => _PairWidgetState();
State<RemoteMousePairingWidget> createState() => _PairWidgetState();
}
class _PairWidgetState extends State<RemotePairingWidget> {
class _PairWidgetState extends State<RemoteMousePairingWidget> {
@override
Widget build(BuildContext context) {
return ValueListenableBuilder(

View File

@@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:math' as math;
import 'dart:ui';
import 'package:prop/prop.dart';
import 'package:bike_control/utils/actions/base_actions.dart' as actions;
import 'package:bike_control/utils/core.dart';
import 'package:bike_control/utils/i18n_extension.dart';
@@ -12,6 +11,7 @@ import 'package:bike_control/widgets/ui/button_widget.dart';
import 'package:bike_control/widgets/ui/toast.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import '../bluetooth/messages/notification.dart';
@@ -104,13 +104,12 @@ class _TestbedState extends State<Testbed> with SingleTickerProviderStateMixin,
_keys.removeLast();
}
} else if (core.actionHandler.supportedApp == null) {
buildToast(context, level: LogLevel.LOGLEVEL_WARNING, title: context.i18n.selectTrainerAppAndTarget);
buildToast(level: LogLevel.LOGLEVEL_WARNING, title: context.i18n.selectTrainerAppAndTarget);
} else {
final button = data.buttonsClicked.first;
if (core.actionHandler.supportedApp is! CustomApp &&
core.actionHandler.supportedApp?.keymap.getKeyPair(button) == null) {
buildToast(
context,
level: LogLevel.LOGLEVEL_WARNING,
titleWidget: Text.rich(
TextSpan(
@@ -146,7 +145,6 @@ class _TestbedState extends State<Testbed> with SingleTickerProviderStateMixin,
}
} else if (data is ActionNotification && data.result is! actions.Ignored) {
buildToast(
context,
location: ToastLocation.bottomLeft,
level: data.result is actions.Error ? LogLevel.LOGLEVEL_WARNING : LogLevel.LOGLEVEL_INFO,
title: data.result.message,
@@ -154,7 +152,6 @@ class _TestbedState extends State<Testbed> with SingleTickerProviderStateMixin,
);
} else if (data is AlertNotification) {
buildToast(
context,
location: ToastLocation.bottomRight,
level: data.level,
title: data.alertMessage,

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';
import 'package:bike_control/bluetooth/messages/notification.dart';
import 'package:bike_control/gen/l10n.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/utils/core.dart';
@@ -49,11 +50,17 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
WidgetsBinding.instance.addObserver(this);
if (updater.isAvailable) {
updater.readCurrentPatch().then((patch) {
setState(() {
shorebirdPatch = patch;
});
});
updater
.readCurrentPatch()
.then((patch) {
core.connection.signalNotification(LogNotification('Current Shorebird patch: $patch'));
setState(() {
shorebirdPatch = patch;
});
})
.catchError((e, s) {
recordError(e, s, context: 'Shorebird');
});
}
if (packageInfoValue == null) {
@@ -87,21 +94,31 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
if (updateStatus == UpdateStatus.outdated) {
updater
.update()
.then((value) {
.then((value) async {
setState(() {
_updateType = UpdateType.shorebird;
});
final nextPatch = await updater.readNextPatch();
final currentVersion = Version.parse(packageInfoValue!.version);
setState(() {
_newVersion = Version(
currentVersion.major,
currentVersion.minor,
currentVersion.patch,
build: nextPatch?.number.toString() ?? '',
);
});
})
.catchError((e) {
buildToast(context, title: AppLocalizations.current.failedToUpdate(e.toString()));
buildToast(title: AppLocalizations.current.failedToUpdate(e.toString()));
});
} else if (updateStatus == UpdateStatus.restartRequired) {
_updateType = UpdateType.shorebird;
}
if (_updateType == UpdateType.shorebird) {
final nextPatch = await updater.readNextPatch();
final currentVersion = Version.parse(packageInfoValue!.version);
setState(() {
final currentVersion = Version.parse(packageInfoValue!.version);
_newVersion = Version(
currentVersion.major,
currentVersion.minor,
@@ -159,7 +176,7 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
}
} else if (Platform.isWindows) {
final url = Uri.parse(
'https://raw.githubusercontent.com/jonasbark/swiftcontrol/refs/heads/main/WINDOWS_STORE_VERSION.txt',
'https://raw.githubusercontent.com/OpenBikeControl/bikecontrol/refs/heads/main/WINDOWS_STORE_VERSION.txt',
);
final res = await http.get(url, headers: {'User-Agent': 'Mozilla/5.0'});
if (res.statusCode != 200) return null;
@@ -201,7 +218,7 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
await _shorebirdRestart();
} else if (_updateType == UpdateType.playStore) {
await launchUrlString(
'https://play.google.com/store/apps/details?id=org.jonasbark.swiftcontrol',
'https://play.google.com/store/apps/details?id=de.jonasbark.swiftcontrol',
mode: LaunchMode.externalApplication,
);
} else if (_updateType == UpdateType.appStore) {
@@ -255,7 +272,7 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
});
} else if (Platform.isWindows) {
setState(() {
_updateType = UpdateType.appStore;
_updateType = UpdateType.windowsStore;
_newVersion = parsed;
});
}

View File

@@ -12,6 +12,7 @@ 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';
import 'package:url_launcher/url_launcher_string.dart';
enum ConnectionMethodType {
bluetooth,
@@ -91,7 +92,7 @@ class _ConnectionMethodState extends State<ConnectionMethod> with WidgetsBinding
return SelectableCard(
onPressed: () {
if (kIsWeb) {
buildToast(context, title: 'Not Supported on Web :)');
buildToast(title: 'Not Supported on Web :)');
} else if (widget.requirements.isEmpty) {
widget.onChange(!widget.isEnabled);
} else {
@@ -163,13 +164,19 @@ class _ConnectionMethodState extends State<ConnectionMethod> with WidgetsBinding
style: widget.isEnabled && Theme.of(context).brightness == Brightness.light
? ButtonStyle.outline().withBorder(border: Border.all(color: Colors.gray.shade500))
: ButtonStyle.outline(),
leading: Icon(Icons.help_outline),
leading: Icon(
widget.instructionLink!.contains("youtube") ? Icons.ondemand_video : Icons.help_outline,
),
onPressed: () {
openDrawer(
context: context,
position: OverlayPosition.bottom,
builder: (c) => MarkdownPage(assetPath: widget.instructionLink!),
);
if (widget.instructionLink!.contains("youtube")) {
launchUrlString(widget.instructionLink!);
} else {
openDrawer(
context: context,
position: OverlayPosition.bottom,
builder: (c) => MarkdownPage(assetPath: widget.instructionLink!),
);
}
},
child: Text(AppLocalizations.of(context).instructions),
),
@@ -230,7 +237,7 @@ class _ConnectionMethodState extends State<ConnectionMethod> with WidgetsBinding
Future.wait(widget.requirements.map((e) => e.getStatus())).then((result) {
final allDone = result.every((e) => e);
if (context.mounted) {
if (context.mounted && widget.isEnabled != allDone) {
widget.onChange(allDone);
}
});

View File

@@ -50,7 +50,7 @@ class HelpButton extends StatelessWidget {
MenuButton(
leading: Icon(RadixIcons.githubLogo),
onPressed: (c) {
launchUrlString('https://github.com/jonasbark/swiftcontrol/issues');
launchUrlString('https://github.com/OpenBikeControl/bikecontrol/issues');
},
child: Text('GitHub'),
),
@@ -94,7 +94,7 @@ class HelpButton extends StatelessWidget {
leading: Icon(RadixIcons.githubLogo),
onPressed: () {
Navigator.pop(context);
launchUrlString('https://github.com/jonasbark/swiftcontrol/issues');
launchUrlString('https://github.com/OpenBikeControl/bikecontrol/issues');
},
child: const Text('GitHub'),
),

View File

@@ -1,9 +1,9 @@
import 'package:prop/prop.dart';
import 'package:bike_control/main.dart';
import 'package:bike_control/widgets/ui/button_widget.dart';
import 'package:prop/prop.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
void buildToast(
BuildContext context, {
void buildToast({
LogLevel level = LogLevel.LOGLEVEL_INFO,
String? title,
Widget? titleWidget,
@@ -13,45 +13,51 @@ void buildToast(
String? subtitle,
Duration? duration,
}) {
showToast(
context: context,
location: location,
showDuration: switch (level) {
LogLevel.LOGLEVEL_DEBUG => const Duration(seconds: 2),
LogLevel.LOGLEVEL_INFO => duration ?? const Duration(seconds: 3),
LogLevel.LOGLEVEL_WARNING => duration ?? const Duration(seconds: 5),
LogLevel.LOGLEVEL_ERROR => duration ?? const Duration(seconds: 7),
_ => duration ?? const Duration(seconds: 3),
},
builder: (context, overlay) => SurfaceCard(
filled: switch (level) {
LogLevel.LOGLEVEL_WARNING => true,
LogLevel.LOGLEVEL_ERROR => true,
_ => false,
if (navigatorKey.currentContext?.mounted ?? false) {
final isMobile = MediaQuery.sizeOf(navigatorKey.currentContext!).width < 600;
showToast(
context: navigatorKey.currentContext!,
location: location,
showDuration: switch (level) {
LogLevel.LOGLEVEL_DEBUG => const Duration(seconds: 2),
LogLevel.LOGLEVEL_INFO => duration ?? const Duration(seconds: 3),
LogLevel.LOGLEVEL_WARNING => duration ?? const Duration(seconds: 5),
LogLevel.LOGLEVEL_ERROR => duration ?? const Duration(seconds: 7),
_ => duration ?? const Duration(seconds: 3),
},
fillColor: switch (level) {
LogLevel.LOGLEVEL_DEBUG => null,
LogLevel.LOGLEVEL_INFO => null,
LogLevel.LOGLEVEL_WARNING => Theme.of(context).colorScheme.chart1,
LogLevel.LOGLEVEL_ERROR => Theme.of(context).colorScheme.destructive,
_ => null,
},
child: Basic(
title: titleWidget ?? Text(title ?? ''),
subtitle: subtitle != null ? Text(subtitle) : null,
trailing: titleWidget is ButtonWidget
? null
: PrimaryButton(
size: ButtonSize.small,
onPressed: () {
// Close the toast programmatically when clicking Undo.
overlay.close();
onClose?.call();
},
child: Text(closeTitle),
),
trailingAlignment: Alignment.center,
builder: (context, overlay) => Container(
margin: EdgeInsets.only(bottom: isMobile ? 50 : 0),
child: SurfaceCard(
filled: switch (level) {
LogLevel.LOGLEVEL_WARNING => true,
LogLevel.LOGLEVEL_ERROR => true,
_ => false,
},
fillColor: switch (level) {
LogLevel.LOGLEVEL_DEBUG => null,
LogLevel.LOGLEVEL_INFO => null,
LogLevel.LOGLEVEL_WARNING => Theme.of(context).colorScheme.chart1,
LogLevel.LOGLEVEL_ERROR => Theme.of(context).colorScheme.destructive,
_ => null,
},
child: Basic(
title: titleWidget ?? Text(title ?? ''),
subtitle: subtitle != null ? Text(subtitle) : null,
trailing: titleWidget is ButtonWidget
? null
: PrimaryButton(
size: ButtonSize.small,
onPressed: () {
// Close the toast programmatically when clicking Undo.
overlay.close();
onClose?.call();
},
child: Text(closeTitle),
),
trailingAlignment: Alignment.center,
),
),
),
),
);
);
}
}

View File

@@ -5,6 +5,7 @@
import FlutterMacOS
import Foundation
import audio_session
import bluetooth_low_energy_darwin
import device_info_plus
import file_selector_macos
@@ -15,6 +16,7 @@ import gamepads_darwin
import in_app_purchase_storekit
import in_app_review
import ios_receipt
import just_audio
import keypress_simulator_macos
import media_key_detector_macos
import nsd_macos
@@ -28,6 +30,7 @@ import wakelock_plus
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
BluetoothLowEnergyDarwinPlugin.register(with: registry.registrar(forPlugin: "BluetoothLowEnergyDarwinPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
@@ -38,6 +41,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
IosReceiptPlugin.register(with: registry.registrar(forPlugin: "IosReceiptPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
KeypressSimulatorMacosPlugin.register(with: registry.registrar(forPlugin: "KeypressSimulatorMacosPlugin"))
MediaKeyDetectorPlugin.register(with: registry.registrar(forPlugin: "MediaKeyDetectorPlugin"))
NsdMacosPlugin.register(with: registry.registrar(forPlugin: "NsdMacosPlugin"))

View File

@@ -1,4 +1,6 @@
PODS:
- audio_session (0.0.1):
- FlutterMacOS
- bluetooth_low_energy_darwin (0.0.1):
- Flutter
- FlutterMacOS
@@ -23,6 +25,9 @@ PODS:
- FlutterMacOS
- ios_receipt (0.0.1):
- FlutterMacOS
- just_audio (0.0.1):
- Flutter
- FlutterMacOS
- keypress_simulator_macos (0.0.1):
- FlutterMacOS
- media_key_detector_macos (0.0.1):
@@ -53,6 +58,7 @@ PODS:
- FlutterMacOS
DEPENDENCIES:
- audio_session (from `Flutter/ephemeral/.symlinks/plugins/audio_session/macos`)
- bluetooth_low_energy_darwin (from `Flutter/ephemeral/.symlinks/plugins/bluetooth_low_energy_darwin/darwin`)
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
@@ -64,6 +70,7 @@ DEPENDENCIES:
- in_app_purchase_storekit (from `Flutter/ephemeral/.symlinks/plugins/in_app_purchase_storekit/darwin`)
- in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`)
- ios_receipt (from `Flutter/ephemeral/.symlinks/plugins/ios_receipt/macos`)
- just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/darwin`)
- keypress_simulator_macos (from `Flutter/ephemeral/.symlinks/plugins/keypress_simulator_macos/macos`)
- media_key_detector_macos (from `Flutter/ephemeral/.symlinks/plugins/media_key_detector_macos/macos`)
- nsd_macos (from `Flutter/ephemeral/.symlinks/plugins/nsd_macos/macos`)
@@ -82,6 +89,8 @@ SPEC REPOS:
- RevenueCat
EXTERNAL SOURCES:
audio_session:
:path: Flutter/ephemeral/.symlinks/plugins/audio_session/macos
bluetooth_low_energy_darwin:
:path: Flutter/ephemeral/.symlinks/plugins/bluetooth_low_energy_darwin/darwin
device_info_plus:
@@ -104,6 +113,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos
ios_receipt:
:path: Flutter/ephemeral/.symlinks/plugins/ios_receipt/macos
just_audio:
:path: Flutter/ephemeral/.symlinks/plugins/just_audio/darwin
keypress_simulator_macos:
:path: Flutter/ephemeral/.symlinks/plugins/keypress_simulator_macos/macos
media_key_detector_macos:
@@ -128,6 +139,7 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos
SPEC CHECKSUMS:
audio_session: 728ae3823d914f809c485d390274861a24b0904e
bluetooth_low_energy_darwin: 50bc79258e60586e4c4bed5948bd31d925f37fac
device_info_plus: 1b14eed9bf95428983aed283a8d51cce3d8c4215
file_selector_macos: 3e56eaea051180007b900eacb006686fd54da150
@@ -139,6 +151,7 @@ SPEC CHECKSUMS:
in_app_purchase_storekit: 2342c0a5da86593124d08dd13d920f39a52b273a
in_app_review: 866c9b17c87a7b46a395bda43f5d3ca02deb585a
ios_receipt: 8741a75f39e6ca0866313b73c69a5b674cf5c98c
just_audio: a42c63806f16995daf5b219ae1d679deb76e6a79
keypress_simulator_macos: f8556f9101f9f2f175652e0bceddf0fe82a4c6b2
media_key_detector_macos: a93757a483b4b47283ade432b1af9e427c47329f
nsd_macos: 1a38a38a33adbb396b4c6f303bc076073514cadc

2
prop

Submodule prop updated: 2283bd5273...a154bf1b7c

31
prop_public/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
# 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/
.flutter-plugins-dependencies
/build/
/coverage/

10
prop_public/.metadata Normal file
View File

@@ -0,0 +1,10 @@
# 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: "3b62efc2a3da49882f43c372e0bc53daef7295a6"
channel: "stable"
project_type: package

3
prop_public/CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
## 0.0.1
* TODO: Describe initial release.

92
prop_public/LICENSE Normal file
View File

@@ -0,0 +1,92 @@
NON-COMMERCIAL SOFTWARE LICENSE AGREEMENT
Version 1.0
Copyright (c) 2026 OpenBikeControl UG (haftungsbeschränkt).
All rights reserved.
1. Definitions
“Software” means the source code, object code, binaries, and associated documentation made available by the Licensor under this License.
“Commercial Use” means any use of the Software, directly or indirectly, that is intended for or results in:
• monetary compensation,
• sale, licensing, or subscription fees,
• advertising or sponsorship revenue,
• inclusion in a product or service that is sold or monetized,
• distribution through paid applications or application marketplaces.
“Licensor” means the copyright holder.
2. Grant of License
Subject to the terms of this License, the Licensor grants you a non-exclusive, non-transferable, revocable license to:
• use the Software for personal, educational, or internal evaluation purposes only;
• modify the Software for non-commercial purposes;
• redistribute the Software only in source form, free of charge, and only under this same License.
3. Restrictions
You may not, without prior written permission from the Licensor:
• use the Software for any Commercial Use;
• distribute the Software as part of a paid or monetized product or service;
• distribute the Software via application marketplaces (including but not limited to Apple App Store or Google Play) where the application itself or related services are monetized;
• sublicense, sell, rent, or lease the Software.
4. Attribution
All copies and derivative works must retain:
• this License text;
• all existing copyright notices.
5. No Patent License
This License does not grant any patent rights.
6. Termination
Any violation of this License automatically terminates your rights under this License.
Upon termination, you must cease all use and distribution of the Software.
7. Disclaimer of Warranty
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
8. Limitation of Liability
IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY DAMAGES ARISING FROM THE USE OF THE SOFTWARE.
9. Governing Law
This License shall be governed by the laws of [YOUR COUNTRY], excluding conflict-of-law rules.
10. Commercial Licensing
Commercial use is available under separate commercial license terms.
Contact: jonas@openbikecontrol.org
End of License

1
prop_public/README.md Normal file
View File

@@ -0,0 +1 @@
This is a stub package - contact me if you need the full implementation.

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

View File

@@ -0,0 +1,19 @@
//INFO: This is a stub - contact me if you need the full implementation.
import 'package:flutter/foundation.dart';
class ClickEmulator {
final ValueNotifier<bool> isStarted = ValueNotifier(false);
final ValueNotifier<bool> isConnected = ValueNotifier(false);
Future<void> startServer() async {
isStarted.value = true;
}
void stop() {
isStarted.value = false;
isConnected.value = false;
}
void writeNotification(List<int> bytes) {}
}

View File

@@ -0,0 +1,19 @@
import 'dart:io';
import 'package:universal_ble/universal_ble.dart';
class DirCon {
final Socket socket;
DirCon({required this.socket});
List<String> get serviceUUIDs => [];
List<BleCharacteristic> getCharacteristics(String serviceUUID) => [];
void processWriteCallback(String characteristicUUID, List<int> characteristicData) {}
void handleIncomingData(List<int> data) {}
void sendCharacteristicNotification(String uuid, List<int> responseData) {}
}

View File

@@ -0,0 +1,26 @@
//INFO: This is a stub - contact me if you need the full implementation.
import 'package:flutter/foundation.dart';
import 'package:universal_ble/universal_ble.dart';
class FtmsEmulator {
final ValueNotifier<bool> isStarted = ValueNotifier(false);
final ValueNotifier<bool> isConnected = ValueNotifier(false);
final ValueNotifier<bool> isUnlocked = ValueNotifier(false);
final ValueNotifier<bool> alreadyUnlocked = ValueNotifier(false);
final ValueNotifier<bool> waiting = ValueNotifier(false);
DateTime get connectionDate => DateTime.now();
bool processCharacteristic(String characteristic, Uint8List bytes) {
return false;
}
void setScanResult(BleDevice scanResult) {}
Future<void> startServer() async {}
void stop() {}
void handleServices(List<BleService> services) {}
}

View File

@@ -0,0 +1,25 @@
//INFO: This is a stub - contact me if you need the full implementation.
import 'package:shared_preferences/shared_preferences.dart';
final propPrefs = PropPrefs();
class PropPrefs {
late final SharedPreferences _prefs;
void initialize(SharedPreferences prefs) {
_prefs = prefs;
}
DateTime? getZwiftClickV2LastUnlock(String deviceId) {
final key = 'clickV2_$deviceId';
final timestamp = _prefs.getInt('${key}_unlock_date');
if (timestamp == null) return null;
return DateTime.fromMillisecondsSinceEpoch(timestamp);
}
void setZwiftClickV2LastUnlock(String deviceId, DateTime dateTime) {
final key = 'clickV2_$deviceId';
_prefs.setInt("${key}_unlock_date", dateTime.millisecondsSinceEpoch);
}
}

View File

@@ -0,0 +1,39 @@
//INFO: This is a stub - contact me if you need the full implementation.
import 'package:flutter/foundation.dart';
class SharedLogic {
static Uint8List? handleWriteRequest(String characteristic, Uint8List value) {
return null;
}
static Future<void> keepAlive() async {}
static void stopKeepAlive() {}
}
class Logger {
static void info(String text) {
if (kDebugMode) {
print('${DateTime.now()} \x1B[32m$text\x1B[0m');
}
}
static void warn(String text) {
if (kDebugMode) {
print('\x1B[33m$text\x1B[0m');
}
}
static void error(String text) {
if (kDebugMode) {
print('\x1B[31m$text\x1B[0m');
}
}
static void debug(String s) {
if (kDebugMode) {
print('\x1B[34m$s\x1B[0m');
}
}
}

23
prop_public/lib/prop.dart Normal file
View File

@@ -0,0 +1,23 @@
export 'emulators/click_emulator.dart';
export 'emulators/prefs.dart';
export 'emulators/shared.dart';
export 'protocol/zp.pb.dart';
export 'protocol/zp.pbenum.dart';
export 'protocol/zwift.pb.dart';
String bytesToHex(List<int> bytes, {bool spaced = false}) {
return bytes.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join(spaced ? ' ' : '');
}
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;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,583 @@
//
// 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');

View File

@@ -0,0 +1,965 @@
//
// 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

@@ -0,0 +1,95 @@
//
// 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');

26
prop_public/pubspec.yaml Normal file
View File

@@ -0,0 +1,26 @@
name: prop
description: "Prop"
version: 0.0.1
publish_to: none
homepage: https://bikecontrol.app
environment:
sdk: ^3.10.7
flutter: ">=1.17.0"
dependencies:
protobuf: ^4.2.0
dartx: any
shared_preferences: ^2.5.3
universal_ble:
git:
url: https://github.com/jonasbark/universal_ble.git
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0

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