Compare commits

..

29 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
a7a3e8bb0d Fix code review issues: equality operator bug and improve code clarity
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:13:14 +00:00
copilot-swe-agent[bot]
cbb617ab5d Update documentation for media key device source detection
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:12:20 +00:00
copilot-swe-agent[bot]
37fbae5eab Add device source detection for Windows media keys using Raw Input API
Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
2026-02-04 14:11:10 +00:00
copilot-swe-agent[bot]
ae9ee8b513 Initial plan 2026-02-04 14:05:03 +00: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
70 changed files with 9082 additions and 1015 deletions

View File

@@ -89,7 +89,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,61 +101,19 @@ 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
if: false
uses: shorebirdtech/shorebird-patch@v1
with:
platform: ios
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
if: false
runs-on: windows-latest
steps:
@@ -187,4 +145,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,11 @@
### Unreleased
**Features**:
- Windows: Add device source detection for media hotkeys
- Distinguish between multiple bluetooth media controllers
- Configure different actions for each controller even when they have the same buttons
- Uses Windows Raw Input API to identify device sources
### 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

@@ -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

@@ -0,0 +1 @@
.

View File

@@ -94,26 +94,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) ||

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';
@@ -47,8 +48,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,
) {
@@ -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,
),

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';
@@ -27,6 +28,7 @@ class GyroscopeSteering extends BaseDevice {
StreamSubscription<GyroscopeEvent>? _gyroscopeSubscription;
StreamSubscription<AccelerometerEvent>? _accelerometerSubscription;
StreamSubscription<MagnetometerEvent>? _magnetometerSubscription;
// Calibration state
final SteeringEstimator _estimator = SteeringEstimator();
@@ -44,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
@@ -54,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) {
@@ -75,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...'));
@@ -134,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();
@@ -179,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'));
}
@@ -207,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,
@@ -219,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(
@@ -240,9 +402,17 @@ 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;
setState(() {});
@@ -288,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

@@ -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,7 +1,6 @@
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';
@@ -29,6 +28,9 @@ class ShimanoDi2 extends BluetoothDevice {
final _lastButtons = <int, int>{};
bool _isInitialized = false;
@override
String get buttonExplanation => 'Click a D-Fly button to configure them.';
@override
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
if (characteristic.toLowerCase() == ShimanoDi2Constants.D_FLY_CHANNEL_UUID) {
@@ -79,13 +81,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),
),
],

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

@@ -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
@@ -65,13 +65,13 @@ class ZwiftClickV2 extends ZwiftRide {
@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);
}
}
@@ -159,6 +159,15 @@ 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'),
),
],
),
/*else

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

@@ -413,9 +413,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

@@ -413,9 +413,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

@@ -413,9 +413,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

@@ -413,9 +413,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

@@ -413,9 +413,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

@@ -20,6 +20,7 @@ import 'package:bike_control/widgets/ui/warning.dart';
import 'package:dartx/dartx.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,43 @@ 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) ...[
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(
builder: (context) {
return SelectableCard(
icon: RadixIcons.keyboard,
title: Text(context.i18n.simulateKeyboardShortcut),
isActive:
_keyPair.physicalKey != null && !_keyPair.isSpecialKey && core.settings.getLocalEnabled(),
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();
}
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(),
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,6 +226,12 @@ 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(
@@ -411,6 +335,12 @@ 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.');
@@ -589,11 +519,127 @@ 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();
if (!core.settings.getLocalEnabled()) {
return buildToast(
navigatorKey.currentContext!,
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 +650,7 @@ class SelectableCard extends StatelessWidget {
required this.title,
this.icon,
this.subtitle,
this.trailing,
required this.isActive,
this.value,
required this.onPressed,
@@ -648,6 +695,7 @@ class SelectableCard extends StatelessWidget {
: null,
title: title,
subtitle: value != null && isActive ? Text(value!) : subtitle,
trailing: trailing,
),
),
);

View File

@@ -150,6 +150,12 @@ class _DevicePageState extends State<DevicePage> {
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: () {
@@ -169,7 +175,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),

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

@@ -256,7 +256,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

@@ -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"}');
@@ -183,4 +185,7 @@ class StubActions extends BaseActions {
performedActions.add((button, isKeyDown, isKeyUp));
return Future.value(Ignored('${button.name.splitByUpperCase()} clicked'));
}
@override
void cleanup() {}
}

View File

@@ -96,4 +96,7 @@ class DesktopActions extends BaseActions {
}
}
}
@override
void cleanup() {}
}

View File

@@ -32,4 +32,7 @@ class RemoteActions extends BaseActions {
// for remote actions we use the relative position only
return keyPair.touchPosition;
}
@override
void cleanup() {}
}

View File

@@ -241,6 +241,8 @@ class RevenueCatService {
Future<void> purchaseFullVersion(BuildContext context) async {
// Direct the user to the paywall for a better experience
if (Platform.isAndroid && !_isAndroidWorking) {
_trialStartDate = null;
await startTrial();
buildToast(
navigatorKey.currentContext!,
title: AppLocalizations.of(context).unlockingNotPossible,
@@ -332,7 +334,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

@@ -104,14 +104,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],
inGameAction: button.action,
physicalKey: null,
logicalKey: null,
isLongPress: false,
physicalKey: buttonFromBase?.physicalKey,
logicalKey: buttonFromBase?.logicalKey,
isLongPress: buttonFromBase?.isLongPress ?? false,
inGameActionValue: buttonFromBase?.inGameActionValue,
androidAction: buttonFromBase?.androidAction,
),
);
}
@@ -247,13 +250,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

@@ -25,7 +25,7 @@ class MediaKeyHandler {
_smtc?.disableSmtc();
} else {
mediaKeyDetector.setIsPlaying(isPlaying: false);
mediaKeyDetector.removeListener(_onMediaKeyDetectedListener);
mediaKeyDetector.removeListenerWithDevice(_onMediaKeyDetectedListenerWithDevice);
}
} else {
FlutterVolumeController.addListener(
@@ -80,7 +80,7 @@ class MediaKeyHandler {
);
_smtc!.buttonPressStream.listen(_onMediaKeyPressedListener);
} else {
mediaKeyDetector.addListener(_onMediaKeyDetectedListener);
mediaKeyDetector.addListenerWithDevice(_onMediaKeyDetectedListenerWithDevice);
mediaKeyDetector.setIsPlaying(isPlaying: true);
}
}
@@ -88,7 +88,11 @@ class MediaKeyHandler {
}
bool _onMediaKeyDetectedListener(MediaKey mediaKey) {
final hidDevice = HidDevice('HID Device');
return _onMediaKeyDetectedListenerWithDevice(mediaKey, 'HID Device');
}
bool _onMediaKeyDetectedListenerWithDevice(MediaKey mediaKey, String deviceId) {
final hidDevice = HidDevice(deviceId);
var availableDevice = core.connection.controllerDevices.firstOrNullWhere(
(e) => e.toString() == hidDevice.toString(),

View File

@@ -290,6 +290,7 @@ class NotificationRequirement extends PlatformRequirement {
core.connection.disconnectAll();
}
if (message == 'close') {
core.actionHandler.cleanup();
core.connection.stop();
SystemNavigator.pop();
AndroidFlutterLocalNotificationsPlugin().stopForegroundService();

View File

@@ -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(context, title: context.i18n.createdNewCustomProfile(newName));
selectedKeyPair = core.actionHandler.supportedApp!.keymap.keyPairs.firstWhere(
(e) => e == keyPair,
);
}
}
_isDrawerOpen = true;
await openDrawer(
context: context,

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

@@ -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) {
@@ -84,6 +91,7 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
return;
} else if (updater.isAvailable) {
final updateStatus = await updater.checkForUpdate();
core.connection.signalNotification(LogNotification('Shorebird update status: $updateStatus'));
if (updateStatus == UpdateStatus.outdated) {
updater
.update()
@@ -96,12 +104,15 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
buildToast(context, title: AppLocalizations.current.failedToUpdate(e.toString()));
});
} else if (updateStatus == UpdateStatus.restartRequired) {
_updateType = UpdateType.shorebird;
if (Platform.isIOS) {
// TODO other platforms can't be trusted https://github.com/shorebirdtech/shorebird/issues/3498
_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 +170,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;
@@ -255,7 +266,7 @@ class _AppTitleState extends State<AppTitle> with WidgetsBindingObserver {
});
} else if (Platform.isWindows) {
setState(() {
_updateType = UpdateType.appStore;
_updateType = UpdateType.windowsStore;
_newVersion = parsed;
});
}

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

@@ -21,12 +21,24 @@ class MediaKeyDetector {
_platform.addListener(listener);
}
/// Listen for the media key event with device information
void addListenerWithDevice(void Function(MediaKey mediaKey, String deviceId) listener) {
_lazilyInitialize();
_platform.addListenerWithDevice(listener);
}
/// Remove the previously registered listener
void removeListener(void Function(MediaKey mediaKey) listener) {
_lazilyInitialize();
_platform.removeListener(listener);
}
/// Remove the previously registered listener with device information
void removeListenerWithDevice(void Function(MediaKey mediaKey, String deviceId) listener) {
_lazilyInitialize();
_platform.removeListenerWithDevice(listener);
}
void _lazilyInitialize() {
if (!_initialized) {
_platform.initialize();

View File

@@ -50,6 +50,7 @@ abstract class MediaKeyDetectorPlatform extends PlatformInterface {
void initialize();
final List<void Function(MediaKey mediaKey)> _listeners = [];
final List<void Function(MediaKey mediaKey, String deviceId)> _listenersWithDevice = [];
/// Listen for the media key event
void addListener(void Function(MediaKey mediaKey) listener) {
@@ -58,16 +59,33 @@ abstract class MediaKeyDetectorPlatform extends PlatformInterface {
}
}
/// Listen for the media key event with device information
void addListenerWithDevice(void Function(MediaKey mediaKey, String deviceId) listener) {
if (!_listenersWithDevice.contains(listener)) {
_listenersWithDevice.add(listener);
}
}
/// Remove the previously registered listener
void removeListener(void Function(MediaKey mediaKey) listener) {
_listeners.remove(listener);
}
/// Remove the previously registered listener with device information
void removeListenerWithDevice(void Function(MediaKey mediaKey, String deviceId) listener) {
_listenersWithDevice.remove(listener);
}
/// Trigger all listeners to indicate that the specified media key was pressed
void triggerListeners(MediaKey mediaKey) {
void triggerListeners(MediaKey mediaKey, [String? deviceId]) {
for (final l in _listeners) {
l(mediaKey);
}
if (deviceId != null) {
for (final l in _listenersWithDevice) {
l(mediaKey, deviceId);
}
}
}
final Map<LogicalKeyboardKey, MediaKey> _keyMap = {

View File

@@ -1,3 +1,4 @@
export './media_key.dart' show MediaKey;
export './media_key_event.dart' show MediaKeyEvent;
export './method_channel_media_key_detector.dart'
show MethodChannelMediaKeyDetector;

View File

@@ -0,0 +1,28 @@
/// Represents a media key event with device information
class MediaKeyEvent {
/// Creates a media key event
const MediaKeyEvent({
required this.key,
required this.deviceId,
});
/// The media key that was pressed
final String key;
/// The unique identifier of the device that sent the event
final String deviceId;
@override
String toString() => 'MediaKeyEvent(key: $key, deviceId: $deviceId)';
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is MediaKeyEvent &&
runtimeType == other.runtimeType &&
key == other.key &&
deviceId == other.deviceId;
@override
int get hashCode => key.hashCode ^ deviceId.hashCode;
}

View File

@@ -1,3 +1,12 @@
# 0.0.3
- **NEW**: Add device source detection using Windows Raw Input API
- Media key events now include unique device identifier
- Enables distinguishing between multiple bluetooth media controllers
- Adds `addListenerWithDevice` API for device-aware event handling
- Maintains backward compatibility with existing `addListener` API
- Falls back to RegisterHotKey API for compatibility
# 0.0.2
- Implement global media key detection using Windows RegisterHotKey API

View File

@@ -6,7 +6,7 @@ The windows implementation of `media_key_detector`.
## Features
This plugin provides global media key detection on Windows using the Windows `RegisterHotKey` API. This allows your application to respond to media keys (play/pause, next track, previous track, volume up, volume down) even when it's not the focused application.
This plugin provides global media key detection on Windows with device source identification. This allows your application to respond to media keys (play/pause, next track, previous track, volume up, volume down) from multiple devices and distinguish which device sent each event.
### Supported Media Keys
@@ -19,17 +19,33 @@ This plugin provides global media key detection on Windows using the Windows `Re
### Implementation Details
The plugin uses:
- `RegisterHotKey` Windows API for global hotkey registration
- Event channels for communicating media key events to Dart
- Window message handlers to process WM_HOTKEY messages
- **Raw Input API** for device-specific media key detection (primary method)
- `RegisterHotKey` Windows API for global hotkey registration (fallback)
- Event channels for communicating media key events with device information to Dart
- Window message handlers to process WM_INPUT and WM_HOTKEY messages
Hotkeys are registered when `setIsPlaying(true)` is called and automatically unregistered when `setIsPlaying(false)` is called or when the plugin is destroyed.
The Raw Input API allows the plugin to identify which physical device (e.g., keyboard, bluetooth remote) sent the media key event. This enables users with multiple media controllers to configure different actions for each device.
Hotkeys and raw input are registered when `setIsPlaying(true)` is called and automatically unregistered when `setIsPlaying(false)` is called or when the plugin is destroyed.
### Device Source Detection
When a media key is pressed, the plugin provides:
- The media key that was pressed (e.g., playPause, fastForward)
- The unique device identifier of the source device
This enables scenarios where:
- A user has two bluetooth media remotes
- Both remotes have a "play" button
- Each remote can be configured to trigger different actions
## Usage
This package is [endorsed][endorsed_link], which means you can simply use `media_key_detector`
normally. This package will be automatically included in your app when you do.
### Basic Usage (without device information)
```dart
import 'package:media_key_detector/media_key_detector.dart';
@@ -58,6 +74,35 @@ mediaKeyDetector.addListener((MediaKey key) {
});
```
### Advanced Usage (with device identification)
```dart
import 'package:media_key_detector/media_key_detector.dart';
// Enable media key detection
mediaKeyDetector.setIsPlaying(isPlaying: true);
// Listen for media key events with device information
mediaKeyDetector.addListenerWithDevice((MediaKey key, String deviceId) {
// deviceId contains the unique identifier of the device that sent the event
// For example: "\\?\HID#VID_046D&PID_C52B&MI_00#..."
print('Media key $key pressed by device: $deviceId');
// Configure different actions based on device
if (deviceId.contains('VID_046D')) {
// Handle keys from Logitech device
handleLogitechRemote(key);
} else if (deviceId.contains('VID_05AC')) {
// Handle keys from Apple device
handleAppleKeyboard(key);
} else {
// Handle keys from other devices
handleGenericDevice(key);
}
});
```
[endorsed_link]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis

View File

@@ -19,13 +19,26 @@ class MediaKeyDetectorWindows extends MediaKeyDetectorPlatform {
@override
void initialize() {
_eventChannel.receiveBroadcastStream().listen((event) {
final keyIdx = event as int;
MediaKey? key;
if (keyIdx > -1 && keyIdx < MediaKey.values.length) {
key = MediaKey.values[keyIdx];
String? deviceId;
// Check if event is a map (new format with device info)
if (event is Map) {
final keyIdx = event['key'] as int?;
deviceId = event['device'] as String?;
if (keyIdx != null && keyIdx > -1 && keyIdx < MediaKey.values.length) {
key = MediaKey.values[keyIdx];
}
} else if (event is int) {
// Backward compatibility: old format with just key index
if (event > -1 && event < MediaKey.values.length) {
key = MediaKey.values[event];
}
}
if (key != null) {
triggerListeners(key);
triggerListeners(key, deviceId);
}
});
}

View File

@@ -12,6 +12,10 @@
#include <map>
#include <memory>
#include <atomic>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
namespace {
@@ -44,6 +48,15 @@ class MediaKeyDetectorWindows : public flutter::Plugin {
// Unregister global hotkeys
void UnregisterHotkeys();
// Register for raw input from keyboard devices
void RegisterRawInput(HWND hwnd);
// Unregister raw input
void UnregisterRawInput(HWND hwnd);
// Get device identifier from device handle
std::string GetDeviceIdentifier(HANDLE hDevice);
// Handle Windows messages
std::optional<LRESULT> HandleWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
@@ -52,6 +65,10 @@ class MediaKeyDetectorWindows : public flutter::Plugin {
std::atomic<bool> is_playing_{false};
int window_proc_id_ = -1;
bool hotkeys_registered_ = false;
bool raw_input_registered_ = false;
// Cache for device identifiers
std::map<HANDLE, std::string> device_cache_;
};
// static
@@ -104,6 +121,8 @@ MediaKeyDetectorWindows::MediaKeyDetectorWindows(flutter::PluginRegistrarWindows
}
MediaKeyDetectorWindows::~MediaKeyDetectorWindows() {
HWND hwnd = registrar_->GetView()->GetNativeWindow();
UnregisterRawInput(hwnd);
UnregisterHotkeys();
if (window_proc_id_ != -1) {
registrar_->UnregisterTopLevelWindowProcDelegate(window_proc_id_);
@@ -124,10 +143,13 @@ void MediaKeyDetectorWindows::HandleMethodCall(
if (is_playing_it != arguments->end()) {
if (auto* is_playing = std::get_if<bool>(&is_playing_it->second)) {
is_playing_.store(*is_playing);
HWND hwnd = registrar_->GetView()->GetNativeWindow();
if (*is_playing) {
RegisterHotkeys();
RegisterRawInput(hwnd);
} else {
UnregisterHotkeys();
UnregisterRawInput(hwnd);
}
result->Success();
return;
@@ -185,8 +207,131 @@ void MediaKeyDetectorWindows::UnregisterHotkeys() {
hotkeys_registered_ = false;
}
void MediaKeyDetectorWindows::RegisterRawInput(HWND hwnd) {
if (raw_input_registered_) {
return;
}
// Register for raw input from keyboard devices
RAWINPUTDEVICE rid[1];
// Keyboard devices
rid[0].usUsagePage = 0x01; // Generic Desktop Controls
rid[0].usUsage = 0x06; // Keyboard
rid[0].dwFlags = RIDEV_INPUTSINK; // Receive input even when not in foreground
rid[0].hwndTarget = hwnd;
if (RegisterRawInputDevices(rid, 1, sizeof(rid[0]))) {
raw_input_registered_ = true;
}
}
void MediaKeyDetectorWindows::UnregisterRawInput(HWND hwnd) {
if (!raw_input_registered_) {
return;
}
// Unregister raw input
RAWINPUTDEVICE rid[1];
rid[0].usUsagePage = 0x01;
rid[0].usUsage = 0x06;
rid[0].dwFlags = RIDEV_REMOVE;
rid[0].hwndTarget = nullptr;
RegisterRawInputDevices(rid, 1, sizeof(rid[0]));
raw_input_registered_ = false;
device_cache_.clear();
}
std::string MediaKeyDetectorWindows::GetDeviceIdentifier(HANDLE hDevice) {
// Check cache first
auto it = device_cache_.find(hDevice);
if (it != device_cache_.end()) {
return it->second;
}
// Get device name
UINT size = 0;
GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, nullptr, &size);
if (size == 0) {
return "Unknown Device";
}
std::vector<char> name(size);
if (GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, name.data(), &size) == static_cast<UINT>(-1)) {
return "Unknown Device";
}
std::string deviceName(name.data());
// Cache the result
device_cache_[hDevice] = deviceName;
return deviceName;
}
std::optional<LRESULT> MediaKeyDetectorWindows::HandleWindowProc(
HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
// Handle raw input messages for device-specific detection
if (message == WM_INPUT && event_sink_) {
UINT dwSize;
GetRawInputData((HRAWINPUT)lparam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER));
std::vector<BYTE> buffer(dwSize);
if (GetRawInputData((HRAWINPUT)lparam, RID_INPUT, buffer.data(), &dwSize, sizeof(RAWINPUTHEADER)) != dwSize) {
return std::nullopt;
}
RAWINPUT* raw = (RAWINPUT*)buffer.data();
if (raw->header.dwType == RIM_TYPEKEYBOARD) {
RAWKEYBOARD& keyboard = raw->data.keyboard;
// Check for media keys
int key_index = -1;
// Media keys have VKey codes
// Check for key down event (RI_KEY_MAKE is defined as 0, so we check both explicitly)
if (keyboard.Flags == RI_KEY_MAKE) { // Key down event
switch (keyboard.VKey) {
case VK_MEDIA_PLAY_PAUSE:
key_index = 0; // MediaKey.playPause
break;
case VK_MEDIA_PREV_TRACK:
key_index = 1; // MediaKey.rewind
break;
case VK_MEDIA_NEXT_TRACK:
key_index = 2; // MediaKey.fastForward
break;
case VK_VOLUME_UP:
key_index = 3; // MediaKey.volumeUp
break;
case VK_VOLUME_DOWN:
key_index = 4; // MediaKey.volumeDown
break;
}
if (key_index >= 0) {
// Get device identifier
std::string deviceId = GetDeviceIdentifier(raw->header.hDevice);
// Send event with both key index and device identifier
flutter::EncodableMap event_data;
event_data[EncodableValue("key")] = EncodableValue(key_index);
event_data[EncodableValue("device")] = EncodableValue(deviceId);
event_sink_->Success(EncodableValue(event_data));
return 0;
}
}
}
}
// Fallback to hotkey messages (for compatibility)
if (message == WM_HOTKEY && event_sink_) {
int key_index = -1;
@@ -210,7 +355,12 @@ std::optional<LRESULT> MediaKeyDetectorWindows::HandleWindowProc(
}
if (key_index >= 0) {
event_sink_->Success(EncodableValue(key_index));
// Send event with key index only (no device info for hotkey)
flutter::EncodableMap event_data;
event_data[EncodableValue("key")] = EncodableValue(key_index);
event_data[EncodableValue("device")] = EncodableValue("HID Device");
event_sink_->Success(EncodableValue(event_data));
}
return 0;

2
prop

Submodule prop updated: 2283bd5273...7517d9727b

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,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,9 @@
//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;
}
}

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

View File

@@ -1857,5 +1857,5 @@ packages:
source: hosted
version: "0.0.4"
sdks:
dart: ">=3.10.7 <4.0.0"
dart: ">=3.10.3 <4.0.0"
flutter: ">=3.38.4"

View File

@@ -1,7 +1,7 @@
name: bike_control
description: "BikeControl - Control your virtual riding"
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 4.6.2+91
version: 4.6.2+93
environment:
sdk: ^3.9.0
@@ -66,7 +66,7 @@ dependencies:
in_app_update: ^4.2.5
http: ^1.3.0
prop:
path: prop
path: prop_public
shadcn_flutter:
git:
url: https://github.com/sunarya-thito/shadcn_flutter.git

View File

@@ -90,9 +90,9 @@ BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "de.jonasbark" "\0"
VALUE "FileDescription", "bike_control" "\0"
VALUE "FileDescription", "BikeControl" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "bike_control" "\0"
VALUE "InternalName", "BikeControl" "\0"
VALUE "LegalCopyright", "Copyright (C) 2025 de.jonasbark. All rights reserved." "\0"
VALUE "OriginalFilename", "bike_control.exe" "\0"
VALUE "ProductName", "BikeControl" "\0"

View File

@@ -68,7 +68,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.Create(L"bike_control", origin, size))
if (!window.Create(L"BikeControl", origin, size))
{
return EXIT_FAILURE;
}