Compare commits

...

1024 Commits

Author SHA1 Message Date
Roberto Viola
2eba8e83f6 Update qdomyos-zwift.pri 2025-11-18 17:56:48 +01:00
Roberto Viola
de2ac21aa9 Computrainer Android 6 2025-11-18 17:54:28 +01:00
Roberto Viola
59228197ac Update horizontreadmill.cpp (#3842) 2025-11-18 13:17:59 +01:00
Roberto Viola
f7b514c623 Add Kettler USB bike support for Android (#3878) 2025-11-17 20:07:28 +01:00
Roberto Viola
088208ff57 Update project.pbxproj 2025-11-17 15:29:23 +01:00
Roberto Viola
a5a4b93407 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-17 11:59:25 +01:00
Roberto Viola
47696c24ad Add support for NordicTrack Series 7 treadmill
Introduces detection, initialization, and polling logic for the NordicTrack Series 7 treadmill in proformtreadmill. Updates QZSettings and settings UI to include the new model, allowing users to select and configure it.
2025-11-17 11:59:19 +01:00
Roberto Viola
ba9da36087 Update project.pbxproj 2025-11-17 10:24:03 +01:00
Roberto Viola
8fcc9b6725 Update fakerower.cpp 2025-11-17 10:23:16 +01:00
Roberto Viola
d065dd5bd1 2.20.15 2025-11-17 10:13:46 +01:00
Roberto Viola
6f42a0d2cc Fix: Apply volume gear patch only when volume_change_gears is enabled (#3881) 2025-11-17 06:16:17 +01:00
Roberto Viola
14e2e16595 Fix iOS Live Activity updates for ellipticals with builtin heart rate (#3879) 2025-11-16 21:42:14 +01:00
Roberto Viola
025a757c35 2.20.14 2025-11-15 07:52:34 +01:00
Roberto Viola
292a5600c9 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-14 20:08:06 +01:00
Roberto Viola
468bc8f87b Concept2>QZ: Rower Distance Discrepancy (Issue #3872) 2025-11-14 20:07:51 +01:00
Roberto Viola
b0e011fd34 Update project.pbxproj 2025-11-14 12:50:21 +01:00
Roberto Viola
2ef0a3c5a7 kinomap and exr compatibility on android added 2025-11-14 10:45:48 +01:00
Roberto Viola
019b3c8abb Schwinn 411/510e cadence issue 2025-11-14 08:55:05 +01:00
Roberto Viola
317116f2d5 Update fakerower.cpp 2025-11-14 08:04:05 +01:00
Roberto Viola
fe005a2f00 SMARTBIKE added 2025-11-13 10:04:59 +01:00
Roberto Viola
08c1e26d3b mqtt settings in command line 2025-11-12 13:53:42 +01:00
Roberto Viola
e98820601a Update project.pbxproj 2025-11-12 11:02:21 +01:00
Roberto Viola
c499092460 Skandika wiry not working correct in qz app (Discussion #3860) 2025-11-12 08:18:17 +01:00
Roberto Viola
e3d50bda7c Add setting for Skandika X-2000 protocol selection
Introduces a new setting to enable or disable the X-2000 protocol for Skandika Wiri bikes. Updates the device discovery logic to respect this setting and adds a corresponding option in the settings UI, allowing users to select the appropriate protocol for their bike model.
2025-11-11 08:36:09 +01:00
Roberto Viola
c060e8b24a height setting fixed for miles units 2025-11-11 08:32:10 +01:00
Roberto Viola
f15f841860 Revert "Remove MLKit integration (#3859)"
This reverts commit 54a8b2619a.
2025-11-10 12:07:48 +01:00
Roberto Viola
15010b27dd Walking Tread Bootcamp (Issue #3856) 2025-11-10 10:03:03 +01:00
Roberto Viola
88c6091e21 Fix division by zero in speed calculation
Added a check to set Speed to 0 when instantPace is zero, preventing a division by zero error during speed calculation.
2025-11-10 08:27:59 +01:00
Roberto Viola
4a6df1c020 handleurl build fix for android 2025-11-09 12:04:34 +01:00
Roberto Viola
3d24e7c1a0 2.20.13 2025-11-09 11:52:18 +01:00
Roberto Viola
54a8b2619a Remove MLKit integration (#3859)
* Remove MLKit integration

- Remove OCR UI elements from settings.qml (Peloton and Zwift auto-sync features)
- Remove MLKit meta-data from AndroidManifest.xml
- Remove MLKit dependencies from build.gradle (both Amazon and Google Play versions)
- Keep underlying properties and qzsettings intact, only UI elements removed

* Restore Zwift OCR settings for Windows only

- Restored zwift_ocr, zwift_ocr_climb_portal, zwift_workout_ocr UI elements
- These settings are visible only on Windows (Qt.platform.os === "windows")
- Windows uses PaddleOCR for screen reading, not MLKit
- Android/iOS OCR features remain removed (they used MLKit)
- Updated labels to clarify these use PaddleOCR, not MLKit

* Remove MLKit OCR code from ScreenCaptureService

- Removed all MLKit imports (InputImage, Text, TextRecognition, etc.)
- Removed TextRecognizer field initialization
- Removed OCR processing code from onImageAvailable method
- Service kept for compatibility but OCR functionality disabled
- Fixes compilation errors after MLKit dependency removal

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-09 11:50:04 +01:00
Roberto Viola
038c4a6165 Update project.pbxproj 2025-11-07 08:14:27 +01:00
Roberto Viola
0831a4ed20 Comment out total distance calculation logic
email "debug qz file rower" from Martin B. on 6/11/2025

The code for calculating total distance from characteristic data has been commented out. Instead, distance is now incremented based on speed and elapsed time, possibly for testing or to address an issue with the original calculation.
2025-11-07 08:04:03 +01:00
Roberto Viola
74fc5f660c problem with Bkool smart bike 1.0 conection #3851 2025-11-07 07:59:22 +01:00
Roberto Viola
ae5dd54738 zwo message commands to TTS (Issue #3823) (#3824) 2025-11-05 14:46:38 +01:00
Roberto Viola
c0299b16ac Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3491211756
2025-11-05 14:41:48 +01:00
Roberto Viola
6401a66f4c Update project.pbxproj 2025-11-05 14:18:05 +01:00
Roberto Viola
ba064c2acd Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3490770427
2025-11-05 13:26:37 +01:00
Roberto Viola
9375f15207 Update AndroidManifest.xml 2025-11-05 10:40:17 +01:00
Roberto Viola
24183a4968 added all the android library aligned to 16k 2025-11-05 10:39:36 +01:00
Roberto Viola
9e1537caad 2.20.12 2025-11-05 10:07:38 +01:00
Roberto Viola
9fe72d13c0 Support for Proform Trainer 9.0 (PFTL69921-INT.4) (Issue #144)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3490007042
2025-11-05 09:58:09 +01:00
Roberto Viola
df5e80a5be Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-05 09:39:30 +01:00
Roberto Viola
3b751d44e6 Treadmill incline multiplied on QZ output [BUG] #2511
BH Vanquish II no regula la velocidad automáticamente #3839
2025-11-05 09:39:24 +01:00
Roberto Viola
3815e45107 PitPat-T01 treadmill #3589 (#3737)
* PitPat-T01 treadmill #3589

* fixing

* wait for a packet and init from 0

* Update deerruntreadmill.cpp

* Update deerruntreadmill.cpp

* new xor

* stop command handled

* minspeedstep handled

* start and stop?

* start and stop

* Update deerruntreadmill.cpp
2025-11-05 08:25:12 +01:00
Roberto Viola
580eb3f092 Create libc++_shared.so 2025-11-04 17:02:41 +01:00
Roberto Viola
aba59cd136 Update peloton.h 2025-11-04 17:02:20 +01:00
Roberto Viola
369fbc4bc0 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-04 17:01:42 +01:00
Roberto Viola
871e704852 resistance for elliptical in the summary must be not the peloton resistance 2025-11-04 14:44:03 +01:00
Roberto Viola
b574e86804 cadence for elliptical in apple health must divide by 2 2025-11-04 14:43:44 +01:00
Roberto Viola
91735a714b Update project.pbxproj 2025-11-04 12:48:51 +01:00
Roberto Viola
da3b5b168e Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 12:47:47 +01:00
Roberto Viola
d339cd461d Cadence and Wattage no responding the right way in Zwift (using a Elite Drivo 2) (Issue #3767) 2025-11-04 12:05:03 +01:00
Roberto Viola
f5ac438905 Update project.pbxproj 2025-11-04 11:42:42 +01:00
Roberto Viola
073b331535 Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 11:40:49 +01:00
Roberto Viola
184c99ff6c Bkool smart bike (Issue #3774) 2025-11-04 11:35:06 +01:00
Roberto Viola
b25f7acf20 Support for Proform Trainer 9.0 (PFTL69921-INT.4)
https://github.com/cagnulein/QZCompanionNordictrackTreadmill/issues/144#issuecomment-3482194626
2025-11-04 11:11:33 +01:00
Roberto Viola
cb0df3ae27 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-04 10:56:20 +01:00
Roberto Viola
7f9ffb7e0e heart rate monitors battery levels (Issue #3833) 2025-11-04 10:55:49 +01:00
Roberto Viola
dd104da06d Update project.pbxproj 2025-11-04 10:37:54 +01:00
Roberto Viola
9440089d05 Trying to figure out how to best use this, monitor vs control (Discussion #3834) 2025-11-04 10:35:51 +01:00
Roberto Viola
39b6ad7463 Peloton and Yesoul resistance numbers the same #3729 2025-11-04 09:46:13 +01:00
Roberto Viola
fdc548fda7 Matrix FTMS Bikes not showing any data (Issue #3837) 2025-11-04 09:40:57 +01:00
Roberto Viola
cc85cbba4f Update project.pbxproj 2025-11-03 16:03:23 +01:00
Roberto Viola
7576a77cd8 Add sanity check for cadence calculation
Cadence is now only updated if the 5-second average is below 200, preventing unrealistic values from being set due to erroneous stride data.
2025-11-03 15:53:48 +01:00
Roberto Viola
61c633474a iOS Apple Health: elliptical as cycling speed and distance 2025-11-03 14:44:29 +01:00
Roberto Viola
69aefc0b30 Domyos 900 + garmin fenix = ANT+ FTMS profile ( smart trainer bike) (Issue #3835) 2025-11-03 14:01:32 +01:00
Roberto Viola
19ca844968 Update qdomyos-zwift.pri 2025-11-03 13:40:40 +01:00
Roberto Viola
5bb3a808a1 ftmselliptical: Refactor cadence calculation logic
Introduces an instantCadence metric to store the immediate cadence value and updates Cadence to use a 5-second average. This improves the accuracy and stability of cadence reporting in ypooelliptical.
2025-11-03 13:15:06 +01:00
Roberto Viola
63cedd457d Update project.pbxproj 2025-11-03 12:11:31 +01:00
Roberto Viola
d9925ac780 SCH_411_510E cadence overflow 2025-11-03 12:11:03 +01:00
Roberto Viola
e4a71e2940 Improve cadence calculation using stride count
Email: Schwinn 411/510e compatibility 03/11/2025

Cadence is now calculated from stride count differences when no external cadence sensor is present, providing more accurate RPM values. Added tracking for last stride count and timestamp to support this calculation.
2025-11-03 12:06:22 +01:00
Roberto Viola
d66d2fd915 Add support for FS-YK Bluetooth bike model
Recognizes devices with names starting with 'FS-YK-' and sets up model-specific flags and behavior. FS-YK bikes are now detected and marked as not supporting ERG mode natively.
2025-11-03 11:37:17 +01:00
Roberto Viola
d20f651672 Add option to force virtual treadmill mode
Introduces a new setting 'virtual_device_force_treadmill' allowing rower devices to be presented as treadmills to client apps. Updates the settings UI, QZSettings class, and device logic to support this feature.
2025-11-03 10:03:18 +01:00
Roberto Viola
19a564d832 Domyos bike 900 disconnecting[BUG] (Issue #3829) 2025-11-03 08:40:15 +01:00
Roberto Viola
5e100f8857 Enable manual workflow dispatch for nordictrack-build job
Modified the nordictrack-build job condition to allow manual triggering
in addition to scheduled runs.

Changes:
- Updated job condition from 'schedule' only to 'schedule || workflow_dispatch'
- This allows users to manually trigger the nordictrack build from GitHub Actions UI

Now the nordictrack-build job can be triggered:
1. Automatically: Every night at midnight (cron schedule)
2. Manually: Via GitHub Actions "Run workflow" button

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 16:16:46 +01:00
Roberto Viola
5491007a2a Add NordicTrack Rower variant to GitHub Actions workflow
Extended the nordictrack-build job to include a third variant for rower
devices, in addition to existing treadmill and bike variants.

Changes:
- Added rower variant to matrix strategy with proform_rower_ip setting
- Updated artifact list to include nordictrack-rower-android-trial APK
- Added rower description in release notes section

The workflow will now build three specialized APKs:
- android-debug-nordictrack-treadmill.apk (nordictrack_2950_ip)
- android-debug-nordictrack-bike.apk (tdf_10_ip)
- android-debug-nordictrack-rower.apk (proform_rower_ip) [NEW]

All three variants use the same nordictrack-build-grpc branch (PR #3478)
and set their respective IP settings to "localhost" for gRPC communication.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 16:12:57 +01:00
Giuseppe Macario
028b5b4c4a typos and grammar (#3768)
* Update HomeForm.ui.qml

grammar

* Update settings.qml

typos
2025-11-02 15:19:33 +01:00
Roberto Viola
8eb0083897 Add SCH_411_510E to power divisor exception list
SCH_411_510E devices now use a divisor of 1.0 for instant power calculation, aligning with other listed models. This change ensures correct power readings for SCH_411_510E ellipticals.
2025-11-02 14:52:52 +01:00
Roberto Viola
89ed87ecb1 Update project.pbxproj 2025-11-02 14:19:15 +01:00
Roberto Viola
eac18d7a51 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-11-02 14:18:15 +01:00
Roberto Viola
d9a50973cd Improve cadence and power calculation for SCH_411_510E
Cadence is now calculated from speed for SCH_411_510E devices when step count is unavailable and the cadence sensor is disabled. Instant power calculation logic is updated to always process when the flag is set, and SCH_411_510E is excluded from the DOMYOS power calculation branch.
2025-11-02 14:18:11 +01:00
Roberto Viola
39c33f3ebc Make SCH_290R behave like hammer_racer_s in FTMS bike
Add SCH_290R device support to FTMS bike with same behavior as hammer_racer_s.
The device will subscribe only to FTMS service and use the same initialization logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 12:15:28 +01:00
Roberto Viola
2858468a04 Update project.pbxproj 2025-11-01 21:16:52 +01:00
Roberto Viola
1bbbda4efb Technogym ride 2025-11-01 21:16:21 +01:00
Roberto Viola
49fc672538 Technogym ride 2025-11-01 21:08:18 +01:00
Roberto Viola
d93107e286 Update project.pbxproj 2025-11-01 20:00:38 +01:00
Roberto Viola
08af7d61a5 rouvy dircon fixed! 2025-11-01 19:07:54 +01:00
Roberto Viola
e25dfc2354 Add debug logging and update slope change handling
Added debug output for requested slope changes in BLEPeripheralManagerTreadmillZwift and corrected indentation. In virtualtreadmill.cpp, restored lastSlopeChanged assignment after heart rate update to ensure proper slope change timing.
2025-11-01 15:28:07 +01:00
Roberto Viola
a4a4d1b9c5 App closes after Bluetooth connection (Issue #3807) 2025-10-31 20:37:34 +01:00
Roberto Viola
5761865916 Only able to control resistance or incline at once (Issue #3798) (#3813) 2025-10-31 13:22:23 +01:00
Roberto Viola
5be7b8530e Add SCH_290R to recognized Bluetooth devices
Included support for devices with names starting with SCH_290R in the device discovery logic to ensure proper recognition and handling.
2025-10-31 10:40:29 +01:00
Roberto Viola
fe44490ad9 Update project.pbxproj 2025-10-31 08:19:52 +01:00
Roberto Viola
97138d8492 Add FTMS bike filter to device discovery
Device discovery now checks if the FTMS bike list contains the default FTMS bike before proceeding. This adds an additional filter to improve device selection accuracy.
2025-10-31 08:14:12 +01:00
Roberto Viola
76845d5507 Toputure TEB1 (Issue #3814)
Updated forceResistance and deviceDiscovered methods to handle SPORT01 devices. Resistance is now initialized to 1 for SPORT01, ensuring correct behavior on device discovery and resistance setting.
2025-10-30 14:20:23 +01:00
Roberto Viola
28bc5670c4 Update project.pbxproj 2025-10-30 13:24:55 +01:00
Roberto Viola
e0b84cb4a3 Check SCH_411_510E before processing instant power
Added a condition to ensure instant power is only processed when SCH_411_510E is not set. This prevents unintended behavior for devices with SCH_411_510E.
2025-10-30 13:23:27 +01:00
Roberto Viola
4cdf23d544 Toputure TEB1 #3814 2025-10-30 11:22:34 +01:00
Roberto Viola
7beb1aed6f set watchos to 6.0
https://developer.apple.com/forums/thread/805538
2025-10-30 09:00:59 +01:00
Roberto Viola
91841a1ff7 Find minimum start offset in target metrics
mail from Christian P. 29/10/2025 "qdomyos-zwift"

Replaces logic that assumed the first element was chronologically first with a search for the minimum 'start' offset among all target metrics. This ensures the correct offset is used even if the data is unordered.
2025-10-30 08:54:07 +01:00
Roberto Viola
886310497c Update project.pbxproj 2025-10-29 15:36:01 +01:00
Roberto Viola
5e96d3cff3 Update ypooelliptical.cpp 2025-10-29 13:59:20 +01:00
Roberto Viola
d66af32eed Update project.pbxproj 2025-10-29 13:55:41 +01:00
Roberto Viola
982318326f Elliptical FlowFitness 2Xi (Issue #3811) 2025-10-29 13:54:37 +01:00
Roberto Viola
2d680b9c4c Update project.pbxproj 2025-10-29 09:47:19 +01:00
Roberto Viola
17e2d211c1 Update watt calculation for SCH_411_510E device
Modified the power calculation logic to exclude SCH_411_510E from the divisor adjustment and to handle watt calculation for SCH_411_510E similarly to DOMYOS. Also moved the debug emit for current watt outside conditional blocks for consistent logging.
2025-10-29 09:41:14 +01:00
Roberto Viola
e1020be250 Bkool smart bike #3774 2025-10-29 09:17:22 +01:00
Roberto Viola
ce219a790a Sportstech sbike lite autoresistance in Rouvy #3803 2025-10-28 14:51:41 +01:00
Roberto Viola
7e55ded95d QZ Android Sends Data Even Without Pedaling (Issue #3763) 2025-10-28 12:31:45 +01:00
Roberto Viola
f70c6e8feb Add FIT_BK to 2-byte resistance protocol in ftmsbike
This ensures FIT_BK bikes receive resistance values multiplied by 10 using the 2-byte protocol, consistent with other similar bikes (JFBK5_0, DIRETO_XR, YPBM).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 19:53:36 +01:00
Roberto Viola
bdfaaecc83 Update WorkoutTracking.swift 2025-10-27 15:34:42 +01:00
Roberto Viola
4622fd6df2 Update project.pbxproj 2025-10-27 15:24:43 +01:00
Roberto Viola
fa5691fa2a Fix cadence handling for SCH_411_510E 2025-10-27 15:12:54 +01:00
Roberto Viola
2b995f8396 adding rowing, elliptical and walking on ios apple health 2025-10-27 14:55:34 +01:00
Roberto Viola
e044dc69bc fixing github ios CI 2025-10-27 11:45:25 +01:00
Roberto Viola
26bf095f19 Update project.pbxproj 2025-10-27 10:41:21 +01:00
Roberto Viola
2ba66d9625 writing ios heart rate without using apple watch and air pods 3 2025-10-27 10:40:45 +01:00
Roberto Viola
621440f981 writing ios heart rate without using apple watch and air pods 3 2025-10-27 09:47:56 +01:00
Roberto Viola
a0c1efce9c right device type in apple health from ios directly 2025-10-26 15:53:22 +01:00
Roberto Viola
861f916eb4 Update Windows build job to windows-2022
Changed the GitHub Actions workflow to use 'windows-2022' instead of 'windows-latest' for the window-build job. Also updated the build step to use Windows path separators and removed the explicit msys2 shell specification.
2025-10-26 14:23:28 +01:00
Roberto Viola
8ae1c59b41 Update project.pbxproj 2025-10-26 13:51:13 +01:00
Roberto Viola
d213b5dffe Add support for SCH411/510E elliptical device 2025-10-26 13:49:03 +01:00
Roberto Viola
099531be72 Después de cargar el archivo gpx, no se visualiza el mapa #3795 2025-10-26 13:40:54 +01:00
Roberto Viola
b7e92ab33c Fix Windows MinGW build after GitHub Actions runner update
GitHub migrated windows-latest from Windows Server 2022 to 2025, which
changed how PowerShell inherits PATH from MSYS2. The qthttpserver build
step now explicitly uses the msys2 shell to access MinGW tools (g++, make).

Changes:
- Add shell: msys2 {0} to Build qthttpserver step
- Fix path separator from backslash to forward slash for MSYS2 compatibility

Fixes: "Project ERROR: Cannot run compiler 'g++'"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 13:30:28 +01:00
Roberto Viola
0720d431db ios github build fixed 2025-10-26 13:16:39 +01:00
Roberto Viola
62c7b7b9df Add FTMS auto-detection for Domyos-Bike
- Check ftms_bike is disabled before connecting to domyosbike in bluetooth.cpp
- Auto-switch to FTMS bike when main service not found but FTMS service available
- Show toast notification to restart app when FTMS service detected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 08:38:43 +02:00
Roberto Viola
4eed4be958 Update project.pbxproj 2025-10-24 17:55:13 +02:00
Roberto Viola
eb0dc48d24 Add support for SCH411/510E elliptical device
Added SCH411/510E device support to ypooelliptical class following the same FTMS pattern used for other devices like SCH_590E, E35, and KETTLER.

Changes:
- Added SCH_411_510E boolean flag to ypooelliptical.h
- Added device detection in bluetooth.cpp
- Updated all FTMS conditional checks to include SCH_411_510E

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 17:27:16 +02:00
Roberto Viola
4ff8e8335a GTABikeV ios compatibility 2025-10-24 08:42:05 +02:00
Roberto Viola
ec263a402d Update project.pbxproj 2025-10-23 21:14:47 +02:00
Roberto Viola
0ffb06cc79 Bkool smart bike #3774 (#3792) 2025-10-23 21:08:53 +02:00
Roberto Viola
302526000f Enable continuous gear shifting by decoupling from system volume limits on Android (Issue #3775) (#3779) 2025-10-23 13:34:33 +02:00
Roberto Viola
76891d41e2 Request : add support for Proform Sport 7.0 treadmill #2635
mail Re: I'm having problems with a Proform 7.0 Sport treadmill. The data is refreshed every 5 seconds, so it becomes impossible to uy application... in fact, with Kinomaps it ends up taking me out of the training due to many disconnections... for Kinomaps, when it stays at 0 km/h it pauses... thank you very much in advance and congratulations for this magnificent application 21/10/2025
2025-10-22 09:03:09 +02:00
Roberto Viola
bb3f9fe216 GTABikeV ios compatibility 2025-10-22 08:17:47 +02:00
Roberto Viola
dd0ce73260 Update trxappgateusbbike.cpp 2025-10-21 17:06:57 +02:00
Roberto Viola
206fa06049 Adjust packet length check for TOORX_SRX_500
Changed the minimum packet length for TOORX_SRX_500 from 21 to 19 in characteristicChanged. This ensures short packets are correctly ignored for this bike type.
2025-10-21 08:51:44 +02:00
Roberto Viola
3985eecfe6 Update trxappgateusbbike.cpp 2025-10-21 08:50:40 +02:00
Roberto Viola
97a7b5c27c Think A102-0063521 2025-10-20 15:05:24 +02:00
Roberto Viola
02c7063655 Update project.pbxproj 2025-10-20 10:59:18 +02:00
Roberto Viola
0067a728a4 iOS live activity continues after app closes (Issue #3783) 2025-10-20 09:34:23 +02:00
Roberto Viola
3ec15253d0 issues connecting zwift play with thinkrider max 2 (Issue #3758) (#3759)
* issues connecting zwift play with thinkrider max 2 (Issue #3758)

* Revert "issues connecting zwift play with thinkrider max 2 (Issue #3758)"

This reverts commit c657127675.

* avoiding char 0xFFF4 for cadence increment

* Update tacxneo2.cpp

* Update tacxneo2.cpp
2025-10-16 15:53:07 +02:00
Roberto Viola
09772d0968 ICSE patching
mail from Jean - Connectivity from 16/10/2025
2025-10-16 15:37:57 +02:00
Roberto Viola
6496e0cf7c Update project.pbxproj 2025-10-16 13:43:30 +02:00
Roberto Viola
b6ef01c59a ICSE patching
mail from Jean - Connectivity from 16/10/2025
2025-10-16 13:41:20 +02:00
Roberto Viola
522ea54ff2 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-15 10:24:55 +02:00
Roberto Viola
ba4cc11196 Walking speed surges/spikes #3757 2025-10-15 10:24:49 +02:00
Roberto Viola
95622182c9 Update project.pbxproj 2025-10-13 17:08:55 +02:00
Roberto Viola
0349dfcbaf Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-13 17:08:13 +02:00
Roberto Viola
9fc9d9cfe9 patching ftmsbike for multiple connectedAndDiscovered.
email from Jean-Noel - Connectivity from 13/10/2025
2025-10-13 16:12:53 +02:00
Roberto Viola
5ea16d0869 fixing git for live activities 2025-10-13 09:15:25 +02:00
Roberto Viola
57b259fcba ICSE reset to 15 seconds
mail "Connectivity" from Jean 13/10/2025
2025-10-13 08:05:34 +02:00
Roberto Viola
b78cf1fca5 fixing crash on ios 2025-10-11 07:39:04 +02:00
Roberto Viola
77b71e56de Update project.pbxproj 2025-10-10 14:00:25 +02:00
Roberto Viola
c8e3d370a1 fixing build on ios 2025-10-10 13:54:27 +02:00
Roberto Viola
ab8a325da2 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-10 13:43:24 +02:00
Roberto Viola
a3158514af Update project.pbxproj 2025-10-10 13:42:54 +02:00
Roberto Viola
2804d4686a Proform Rower (Proform 750R) cannot change resistance from app (Issue #3746) 2025-10-10 13:39:06 +02:00
Roberto Viola
cf0dc2d00d nordictrack integration broken #3731 2025-10-10 10:12:08 +02:00
Roberto Viola
164aa38cb1 adding horizon treadmill XP
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 20:53:30 +02:00
Roberto Viola
14998d0f25 TOPUTURE TP1 2025-10-09 13:29:40 +02:00
Roberto Viola
ca74fe7ccd fixing wattage reset on the elliptical class 2025-10-09 09:55:38 +02:00
Roberto Viola
facba11bae miles on live activity 2025-10-09 08:00:17 +02:00
Giuseppe Macario
8b8302fb53 typos (#3744) 2025-10-09 04:59:43 +02:00
Roberto Viola
eaea4bf8b8 Recently I managed to decode the Rowing data from Merach NovaRow R50, are any guideline I can follow in order to add it to the app? #3593 2025-10-08 14:01:24 +02:00
Roberto Viola
3d9c3e4103 Recently I managed to decode the Rowing data from Merach NovaRow R50, are any guideline I can follow in order to add it to the app? (Discussion #3593) 2025-10-08 12:00:02 +02:00
Roberto Viola
e840d7b3e9 Update bkoolbike.cpp 2025-10-07 15:03:27 +02:00
Roberto Viola
3a248ad2c5 Update project.pbxproj 2025-10-07 15:01:35 +02:00
Roberto Viola
5912d7df2d Airpods pro 3 heart rate (#3718)
* Airpods Pro 3 Heart Rate

* Update project.pbxproj
2025-10-07 14:53:48 +02:00
Roberto Viola
94842114e6 BKOOL Bike V 1 2025-10-07 14:47:16 +02:00
Roberto Viola
d83df0ba5a Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-07 08:54:33 +02:00
Roberto Viola
0764fb50b2 Peloton Walking Pace Targets at bottom of range (Issue #3738) 2025-10-07 08:54:26 +02:00
Roberto Viola
bb5de868ab Live Actions iOS (#3735)
* Add iOS Live Activity support at startup

- Created LiveActivityManager.swift for managing fitness metrics Live Activities
- Added Objective-C++ bridge (ios_liveactivity.h/mm) for Qt integration
- Updated Info.plist with NSSupportsLiveActivities flag
- Initialized LiveActivityManager in AppDelegate on app startup (iOS 16.1+)
- Added new files to qdomyos-zwift.pri build configuration

Live Activities display real-time fitness metrics (speed, cadence, power, heart rate, distance, calories) on Lock Screen and Dynamic Island.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update project.pbxproj

* Update AppDelegate.swift

* fixing build error

* let's see

* qzwidget

* distance fixed in live activities

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-05 14:34:17 +02:00
Roberto Viola
2b8fe6c28d Schwinn CABLE concerns (Issue #3727) 2025-10-04 06:50:45 +02:00
Roberto Viola
0153e09f0d TOPUTURE TP1 treadmill 2025-10-03 15:19:09 +02:00
Roberto Viola
dc44433d7c Update project.pbxproj 2025-10-03 12:45:32 +02:00
Roberto Viola
8bdefdb331 Auto inclination not working when using an Android tablet (Issue #3730) 2025-10-03 12:44:01 +02:00
Roberto Viola
c7f5e320fc Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-10-02 15:35:10 +02:00
Roberto Viola
c1582cc763 When using Watt Gain < 1 , unable to fulfil the requested power in Workouts (ERG) (Issue #3728) 2025-10-02 15:34:58 +02:00
Roberto Viola
f2f0f7a793 Update project.pbxproj 2025-10-01 17:07:23 +02:00
Roberto Viola
3d665e397e BKOOL Bike V 1 2025-10-01 17:06:13 +02:00
Roberto Viola
194f8686f3 Update project.pbxproj 2025-10-01 15:49:33 +02:00
Roberto Viola
fb79d0ddd6 SportsTech sWalk Walking Pad 2025-10-01 15:39:55 +02:00
Roberto Viola
d7e0a4e441 stop workout confirmation 2025-10-01 09:54:44 +02:00
Roberto Viola
465123a156 KUBIsport BC91EK 2025-10-01 09:30:48 +02:00
Roberto Viola
88d01562b1 DMASUN Bikes 2025-09-30 15:34:15 +02:00
Roberto Viola
85421f41b8 KUBIsport BC91EK 2025-09-30 08:11:11 +02:00
Roberto Viola
a67cb10633 Update project.pbxproj 2025-09-29 13:35:41 +02:00
Roberto Viola
f00a161fc1 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-29 13:33:10 +02:00
Roberto Viola
c071c56eb7 Toorx BRX R100 ergo bicycle 2025-09-29 13:33:03 +02:00
Roberto Viola
b39f769423 Update project.pbxproj 2025-09-28 08:41:58 +02:00
Roberto Viola
dde526c059 Merach MRK-T25-EF79 (T25) discovered but no tiles report any activity (Issue #3720) 2025-09-28 08:38:39 +02:00
Roberto Viola
c223d6e81d ORLAUF ARES device added 2025-09-27 14:44:58 +02:00
Roberto Viola
d531a1d313 ios adb debug 2025-09-26 09:05:07 +02:00
Roberto Viola
b0722cc827 ios adb log 2025-09-26 08:46:06 +02:00
Roberto Viola
2e534abfbb Update lockscreen.mm 2025-09-24 16:23:48 +02:00
Roberto Viola
6d3ca9877a Update project.pbxproj 2025-09-24 16:08:07 +02:00
Roberto Viola
f477cb32ab Proform CSX210 2025-09-24 12:10:34 +02:00
Roberto Viola
51b79ed413 Wattage gain max value increase #3709 2025-09-24 09:32:56 +02:00
Roberto Viola
fa78f03f0a D500 trainer added 2025-09-22 08:16:39 +02:00
Roberto Viola
a40fec4082 adding LSApplicationCategoryType on iOS 2025-09-21 07:38:50 +02:00
Roberto Viola
f6a9d8ca4e removed gears gain changes from Wizard.qml 2025-09-18 16:30:25 +02:00
Roberto Viola
dd2bfc4e1b Update proformbike.cpp 2025-09-18 12:09:24 +02:00
Roberto Viola
06fd78378e Proform CSX210 2025-09-18 11:38:11 +02:00
Roberto Viola
f28574245c Update project.pbxproj 2025-09-18 09:58:38 +02:00
Roberto Viola
b964c523dd How to Make 10s Intervals Work with Virtual Shifting #3603 2025-09-18 09:50:06 +02:00
Roberto Viola
0721bc3ec5 Update project.pbxproj 2025-09-17 17:00:58 +02:00
Roberto Viola
3f783305b2 How to Make 10s Intervals Work with Virtual Shifting #3603 2025-09-17 17:00:09 +02:00
Roberto Viola
be29180e48 Update project.pbxproj 2025-09-17 12:22:46 +02:00
Roberto Viola
19c65d7d90 Taurua IC90 (#3697) 2025-09-17 12:20:21 +02:00
Roberto Viola
704c7f1f80 Kingsmith WalkingPad R3 Hybrid+ 2025-09-16 10:49:48 +02:00
Roberto Viola
678ac9d466 adding info for MAC 2025-09-16 10:00:15 +02:00
Roberto Viola
a8a6c5d736 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-16 09:39:33 +02:00
Roberto Viola
e8408710df adding MACCATALYST for ios 2025-09-16 09:39:13 +02:00
Roberto Viola
47825f0783 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-16 09:16:26 +02:00
Roberto Viola
f7ce518812 mobvoi se manual incline (Issue #3690) 2025-09-16 09:16:21 +02:00
Roberto Viola
f887a068b9 Power zone tiles not using erg mode (Issue #3681) 2025-09-15 13:49:29 +02:00
Roberto Viola
6ecbce4b87 adding KICKR RUN treadmill 2025-09-15 11:26:44 +02:00
Roberto Viola
9454d75f55 Update project.pbxproj 2025-09-12 10:39:04 +02:00
Roberto Viola
4063321418 Update project.pbxproj 2025-09-12 09:27:16 +02:00
Roberto Viola
bb88d58e47 Power zone tiles not using erg mode (Issue #3681) 2025-09-12 09:26:17 +02:00
Roberto Viola
7bc2f065c0 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-09-12 08:52:58 +02:00
Roberto Viola
c773b45ddf 2.20.11 2025-09-12 08:52:55 +02:00
Roberto Viola
eaf7db7813 Implement threaded FIT backup file writing (#3676)
* Implement threaded FIT backup file writing

- Add FitBackupWriter class to handle FIT file saving in background thread
- Move FIT backup writing from main thread to dedicated worker thread
- Use Qt's signal/slot mechanism with QueuedConnection for thread safety
- Similar implementation pattern to existing LogWriter threading
- Prevents UI blocking during FIT file saves every minute

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* build fix

* fix

* fix signal

* fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-11 20:46:36 +02:00
Roberto Viola
a29f6350d0 Update project.pbxproj 2025-09-11 12:39:53 +02:00
Roberto Viola
65ad925d37 How to Make 10s Intervals Work with Virtual Shifting (Discussion #3603) 2025-09-11 12:33:49 +02:00
Roberto Viola
8fd486d582 adding decimal places to current strokes length 2025-09-10 09:35:47 +02:00
Roberto Viola
8fa5dcadcb strokelength for Concept rower 2025-09-09 16:03:58 +02:00
Roberto Viola
6abf6c9cfd strokelength for Concept rower 2025-09-08 16:05:19 +02:00
Roberto Viola
b4603da714 Saris H3+ Slow to gear and resistance/incline changes on Zwift (Windows) + QZ on Android 16 (Pixel 8 Pro) #3660 2025-09-08 15:26:17 +02:00
Roberto Viola
b27e84de69 Update project.pbxproj 2025-09-05 11:44:02 +02:00
Roberto Viola
49337cbbc6 Update toorxtreadmill.h 2025-09-05 11:34:34 +02:00
Roberto Viola
fe2f5e923c Pafer treadmill #2985 2025-09-05 09:20:43 +02:00
Roberto Viola
69f54dbd54 Pafer treadmill #2985 2025-09-05 09:18:53 +02:00
Roberto Viola
bc20ec0d8f Option to Enable/Disable Haptic Feedback on Zwift Play Controllers (Issue #3669) 2025-09-05 08:44:45 +02:00
Roberto Viola
278add7a11 Setting resistance for skandika nordlys (Issue #3667) 2025-09-04 16:11:18 +02:00
Roberto Viola
6e90091883 Support for LSG Treadmills (Issue #3665) 2025-09-04 09:29:16 +02:00
Roberto Viola
ebda22d7b4 skandika nordlys 2025-09-03 16:20:01 +02:00
Roberto Viola
625ffb3932 skandika nordlys 2025-09-03 16:17:28 +02:00
Roberto Viola
fe6868911e Controlar intensidad de un workout aumentando o disminuyendo el porcentaje de FTP objetivo (Discussion #3664) 2025-09-03 10:28:57 +02:00
Roberto Viola
1c73d15377 webserverinfosender disconnect crash (#3661) 2025-09-01 15:20:50 +02:00
Roberto Viola
c33ee55efb Update homeform.cpp 2025-09-01 11:50:25 +02:00
Roberto Viola
56979a2122 Update homeform.cpp 2025-09-01 11:07:31 +02:00
Roberto Viola
3e1db8bfdf Support ROWING device type in writeProcess
mail "Question re QZ App" from Michael M. of 31/8/2025

Extended the writeProcess method to handle the ROWING device type in addition to BIKE. This allows the processor to support additional device types for characteristic writes.
2025-09-01 11:05:57 +02:00
Roberto Viola
10fdc52446 QZ & Peloton Sync Drift in Tread Classes (Issue #3624) 2025-09-01 10:56:41 +02:00
Roberto Viola
23d23c40a5 QZ & Peloton Sync Drift in Tread Classes (Issue #3624) 2025-09-01 09:54:59 +02:00
Roberto Viola
90e8eeb983 Update main.yml 2025-08-31 06:47:17 +02:00
Roberto Viola
dcf395ec46 Update main.yml 2025-08-29 16:06:13 +02:00
Roberto Viola
d55cb553d3 Add chart display mode setting with zoom controls (#3627)
Introduces a new 'chart_display_mode' setting allowing users to select between both charts, heart rate only, or power only in the chart footer. Updates QML and settings UI to support this option, and adds zoom buttons to each chart for focused time-range viewing. JavaScript logic is enhanced to handle dynamic chart display and zooming, including interval-based updates to the visible time window.
2025-08-29 15:32:52 +02:00
Roberto Viola
b862d26bc3 Multiple files in different instances Other Folder in Training Program List (#3651)
* Update TrainingProgramsList.qml

* Update TrainingProgramsList.qml

* did for gpx, profiles and settings
2025-08-29 10:35:37 +02:00
Roberto Viola
d5e4f11849 Active Calories (#3630)
* first commit

* Update AppDelegate.swift

* watchkit

* apex bike cadence updated

* adding something for debug

* Update project.pbxproj

* removing basal

* fixing

* build 1145

* Update project.pbxproj

* Add option to calculate calories from heart rate

Introduces a new setting to calculate calories based on heart rate data instead of power. Updates the bluetoothdevice logic to support HR-based calorie calculation, adds a new metric for HR calories, and exposes the option in the settings UI. Also updates QZSettings to include the new configuration key and default.

* build 1149

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Zwift erg mode workouts not functioning #3643

* Update project.pbxproj
2025-08-29 08:43:29 +02:00
Roberto Viola
5e9679f6c3 Merach W50 FTMS Treadmill 2025-08-29 08:40:25 +02:00
Roberto Viola
8799c447fb QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-27 14:57:18 +02:00
Roberto Viola
bcdb767b7e adding compensation when there is a power sensor and an ergModeSupported bike (PR #3388) 2025-08-27 11:29:22 +02:00
Roberto Viola
15e208d34c Zwift erg mode workouts not functioning (Discussion #3643)
Improves logic for routing power requests to the bike, including handling of virtual bikes, ZwiftPlay, and external power sensors. Updates FTMS characteristic change handling to block simulation commands in resistance level mode and only allow power commands when no external power sensor is present.
2025-08-27 10:48:48 +02:00
Roberto Viola
f16c41e6dd Zwift erg mode workouts not functioning (Discussion #3643)
Refines the logic for routing FTMS power commands to the bike by considering the presence of an external power sensor and erg mode support. Now allows power commands through when no external power sensor is configured and erg mode is supported, even if resistance level mode is active. Adds more detailed debug output for easier troubleshooting.
2025-08-27 10:43:57 +02:00
Roberto Viola
9110c55cb1 Zwift erg mode workouts not functioning (Discussion #3643) 2025-08-27 10:39:17 +02:00
Roberto Viola
881e155cbc QZ & Peloton Sync Drift in Tread Classes #3624 2025-08-27 09:39:26 +02:00
Roberto Viola
e2d187a7bd Zwift erg mode workouts not functioning (Discussion #3643) 2025-08-26 14:57:11 +02:00
Roberto Viola
66821d884a Update main.yml 2025-08-26 13:54:32 +02:00
Roberto Viola
73ad1dc46c Add support for KS-HDSY-X21C treadmill variant
Introduces detection and handling for KS-HDSY-X21C devices, including new flags and GATT service/characteristic UUIDs. This improves compatibility with additional Kingsmith treadmill models.
2025-08-26 08:22:20 +02:00
Roberto Viola
c91a2d3ee5 Update main.yml 2025-08-25 14:13:00 +02:00
Roberto Viola
87c0e95b01 Update main.yml 2025-08-25 14:10:59 +02:00
Roberto Viola
174da2ac14 Update main.yml 2025-08-25 14:05:45 +02:00
Roberto Viola
b61ba37b8f Update main.yml 2025-08-25 14:05:07 +02:00
Roberto Viola
27333e7836 Constant low wattage regardless of resistance #3641 2025-08-25 10:48:32 +02:00
Roberto Viola
58a9e81bd8 peloton bike setting removed 2025-08-25 10:10:38 +02:00
Roberto Viola
d78e92f42f Connected JTX Fitness elliptical trainer but no data in QZ fitness panel (Issue #3638) 2025-08-23 16:18:15 +02:00
Roberto Viola
2a5eb7b057 Connected JTX Fitness elliptical trainer but no data in QZ fitness panel (Issue #3638) 2025-08-23 14:58:48 +02:00
Roberto Viola
ae5f70645a Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-08-23 14:48:33 +02:00
Roberto Viola
d26b14276e How to Make 10s Intervals Work with Virtual Shifting (Discussion #3603) 2025-08-23 14:47:42 +02:00
Roberto Viola
9166ce7218 removing tester android 14 2025-08-23 14:39:10 +02:00
Roberto Viola
5f0ec98b0c Update main.yml 2025-08-23 12:17:15 +02:00
Roberto Viola
1bc7af0a88 fix ios github actions (#3637) 2025-08-23 09:25:42 +02:00
Roberto Viola
df75d33ca6 Fix SQL linking in GitHub Actions by adding sql module to defaults.pri (#3635) 2025-08-22 15:20:51 +02:00
Roberto Viola
34f7df6bfb Kettler HOI Frame Connectivity (Issue #3636) 2025-08-22 15:06:48 +02:00
Roberto Viola
1208b439fa Concept2 RowERG PM5 and QZ not getting metrocs (Issue #3625) (#3626) 2025-08-21 06:58:33 +02:00
Roberto Viola
14a9faa2ee apex bike cadence updated 2025-08-20 15:47:34 +02:00
Roberto Viola
ca4fb0b35e technogym trainer 2025-08-19 15:25:29 +02:00
Roberto Viola
6ea6e6d9b2 Update project.pbxproj 2025-08-18 16:03:25 +02:00
Roberto Viola
2e17aa40ec apex bike table updated 2025-08-18 15:14:59 +02:00
Roberto Viola
098392684f 2.20.8 2025-08-17 15:28:24 +02:00
Roberto Viola
6678e225c5 Fixing Trainprogram Timer Jitter (#1849)
* fixing

* Update trainprogram.cpp

* Update trainprogram.cpp

* Update trainprogram.cpp
2025-08-17 15:17:24 +02:00
Roberto Viola
ca0bd15e69 virtual rower on nordictrackifitadbrower 2025-08-17 06:23:11 +02:00
Roberto Viola
1675240f13 fix wrong wattage for proform_bike_PFEVEX71316_0 2025-08-16 16:37:57 +02:00
Roberto Viola
b21c6325bb rebook bike fix for treadmill 2025-08-16 16:03:41 +02:00
Roberto Viola
b2f9e3d754 Update project.pbxproj 2025-08-15 16:33:48 +02:00
Roberto Viola
6dc5d74de3 proform_bike_PFEVEX71316_0 (Issue #3448)
mail QZ control of Proform TDF 1.0 with Zwift
from steve b. 12/08/2025
2025-08-15 16:06:10 +02:00
Roberto Viola
be560aae89 apex bike watt table improved 2025-08-15 15:52:24 +02:00
Roberto Viola
37858ca972 Removing Huge font from android (#3616)
* removing font

* fixing

* Update fontmanager.h

* fixing
2025-08-14 16:15:17 +02:00
Roberto Viola
d3a1a2aafb QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-14 12:01:45 +02:00
Roberto Viola
49b890715e Update project.pbxproj 2025-08-13 16:28:22 +02:00
Roberto Viola
f19449107b fixing inclinationResistanceTable with gears 2025-08-13 16:25:14 +02:00
Roberto Viola
8bbed4fa76 Update project.pbxproj 2025-08-13 15:26:11 +02:00
Roberto Viola
efc4950f92 QZ not working with Taurus FX9.9 elliptical (Issue #3618) 2025-08-13 15:12:19 +02:00
Roberto Viola
23fd13ad0c Matrix A50 XR elliptical 2025-08-13 14:56:31 +02:00
Roberto Viola
64cd90dfaa let's push to the release even if the linux builds are not ok 2025-08-12 16:38:44 +02:00
Roberto Viola
ec5919d67f Update main.yml 2025-08-12 06:40:15 +02:00
Roberto Viola
0fc9d7fb40 apex bike watt table improved 2025-08-12 06:35:38 +02:00
Roberto Viola
4f03554fbb fixing crash on mac 2025-08-11 07:07:13 +02:00
Roberto Viola
4a16605f43 auto start peloton now starts the QZ session too if in pause mode 2025-08-10 17:47:09 +02:00
Roberto Viola
3ae60e1c41 Adding libqt5sql5-sqlite to github actions 2025-08-10 07:17:15 +02:00
Roberto Viola
edab888e31 fixing sql github actions for linux? 2025-08-10 06:31:21 +02:00
Roberto Viola
2eefcee9b7 fixing negative calories on apple health without apple watch 2025-08-10 06:23:49 +02:00
Roberto Viola
c1db263dcf Sole F63 Cannot get stable connection or auto incline (Issue #3606) 2025-08-09 06:52:17 +02:00
Roberto Viola
cdf0d34b86 fixing crash pressing start when a device is not connected 2025-08-08 10:55:39 +02:00
Roberto Viola
eb0528215b Update project.pbxproj 2025-08-08 08:51:53 +02:00
Roberto Viola
30d0940359 2.20.7 2025-08-08 08:48:05 +02:00
Roberto Viola
9f7cdd8b42 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-08-08 08:47:06 +02:00
Roberto Viola
af00334455 Handle negative resistance in forceResistance
Adds a check for negative resistance values in forceResistance. If a negative value is detected, it logs a debug message and sets the resistance to a fallback value of 1 to prevent invalid input.
2025-08-08 08:40:10 +02:00
Roberto Viola
4e8af61539 Workout history and start of previous trainings #2383 2025-08-07 12:31:18 +02:00
Roberto Viola
a17b78c56b Revert "Update WorkoutsHistory.qml"
This reverts commit d59eabc9b3.
2025-08-07 12:20:28 +02:00
Roberto Viola
8f536f487e Update project.pbxproj 2025-08-07 12:11:27 +02:00
Roberto Viola
82cad601bf Update project.pbxproj 2025-08-07 11:47:27 +02:00
Roberto Viola
a3579c42fa fixing crash without apple watch 2025-08-07 11:46:55 +02:00
Roberto Viola
9af0046554 Nordictrack RW900 rower v1 2025-08-07 11:31:16 +02:00
Roberto Viola
d59eabc9b3 Update WorkoutsHistory.qml 2025-08-07 09:34:19 +02:00
Roberto Viola
d8d55cfbf8 fixing linux builds 2025-08-07 09:07:08 +02:00
Roberto Viola
bce3f3cef3 adding sql dependencies 2025-08-06 16:13:21 +02:00
Roberto Viola
e2d5e602e1 saving training session even outside peloton 2025-08-06 15:35:03 +02:00
Roberto Viola
054087a3bf Update main.yml 2025-08-06 14:11:30 +02:00
Roberto Viola
123d1f9634 Update 10_Installation.md 2025-08-06 14:10:25 +02:00
Roberto Viola
9130cabc65 adding sql for linux in the github actions 2025-08-06 14:09:27 +02:00
Roberto Viola
3c893444e6 Update project.pbxproj 2025-08-06 13:45:21 +02:00
Roberto Viola
24935046e9 added cruise, sprint and climb profile for automatic shifting 2025-08-06 13:41:30 +02:00
Roberto Viola
ecf596623e Workout history and healthkit without apple watch (#3594)
* preparing form...

* workout history works with a bluetooth device connected

* using a different template for the  preview charts

* sport type added to preview function

* build fixed

* added target cadence, watt and resistance to fit file along with user info

* Update WorkoutTracking.swift

* building

* Update WorkoutTracking.swift

* Update lockscreen.mm

* doing

* Update lockscreen.mm

* Update WorkoutTracking.swift

* Update homeform.cpp

* Update WorkoutTracking.swift

* Update WorkoutTracking.swift

* seems working

* Update project.pbxproj

* Update project.pbxproj

* fixing speed

* adding metrics also when the virtualbike is not the zwift interface

* adding device type

* fix build

* let's work on build up the list

* emitting signal not tested

* connection works

* Update project.pbxproj

* fix build issue, forcing bike

* adding kcal

* fix build

* Update project.pbxproj

* fix build

* fake bike to test

* fixing crash and metrics

* Update WorkoutTracking.swift

* Update project.pbxproj

* adding logs

* improving logs

* Update project.pbxproj

* fixing

* adding fit file processor

* the workout history works with the db!

* kind of works on ios

* data fixed

* removed workoutdetails because db would be too heavy. let's open the fit files

* preview of the fit file is almost ready

* details start to work!

* adding kcal on the summary

* Update bluetooth.cpp

* adding check that apple watch is available

* Update homeform.cpp

* fixing build and tested

* Update project.pbxproj

* fixing crash?

* fake treadmill simulatoion on the simulator

* Update homeform.cpp

* Update project.pbxproj

* Update lockscreen.mm

* Update project.pbxproj

* BT Log share for LifeSpan-TM-2000 #3021

* adding steps for treadmills

* NOT TESTED handling device type

* fixing whitespaces

* fixing build

* fixing build on xcode

* fixed distance issue and steps

* Update project.pbxproj

* fixing high steps

https://github.com/cagnulein/qdomyos-zwift/discussions/3277#discussioncomment-12425461

* Update project.pbxproj

* fix build

* fix build

* build fix

* build fix

* claude fixes

* it kind of works

* improving

* fixing summary

* optimized!

* rogue bike fix

* Update project.pbxproj

* Update qfit.cpp

* Update qfit.cpp

* Update project.pbxproj

* Update qdomyos-zwift-tests.pro

* fix build

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update virtualrower.cpp

* restoring changes

* Update lockscreen.mm

* fixing build

* Update project.pbxproj

* removing save from the dochart in the preview

* Update dochartliveheart.js

* Update project.pbxproj

* reducing logging

* Update Server.swift

* Update WorkoutsHistory.qml

* Update project.pbxproj

* adding fit file processor right after the workout stopped

* streak message

* Update bluetooth.cpp

* Update fitdatabaseprocessor.cpp

* Update WorkoutsHistory.qml

* 2.20.6

* adding font for emoji on android

* Update settings.qml

* Update WorkoutsHistory.qml

* html android emoji font

* workout calendar

* calendar with points work!

* peloton link and download from the workout history

* fix point in the calendar

* Update project.pbxproj

* fixing

* fixing

* fixing

* fixing and debug

* Update qfit.cpp

* Update WorkoutsHistory.qml

* Update WorkoutsHistory.qml

* Update WorkoutsHistory.qml

* Update project.pbxproj
2025-08-06 11:26:56 +02:00
Roberto Viola
620be36635 first version of automatic virtual shifting 2025-08-04 14:48:35 +02:00
Roberto Viola
3c98edfb6d Start the activity from the treadmill's start button #3590 2025-08-04 08:59:46 +02:00
Roberto Viola
b0c4690489 Start the activity from the treadmill's start button (Issue #3590) 2025-08-04 08:58:18 +02:00
Roberto Viola
64f1fce8c8 Tunturi T80 QZ doesn't start when I start via the treadmill start button (Issue #3568) 2025-08-04 08:39:35 +02:00
Roberto Viola
f2df53b94b 2.20.5 2025-08-01 08:11:03 +02:00
Roberto Viola
ae4aec68c6 Peloton Walking Pace Targets #3550 2025-08-01 08:10:07 +02:00
Roberto Viola
68696a585a Peloton Walking Pace Targets #3550 2025-07-31 08:43:11 +02:00
Roberto Viola
ee0279186a Improve gear boundary handling with smart clamping
Refines the logic for setting gears to allow clamping to valid ranges when starting from invalid states, preventing the system from getting stuck below minimum gears due to fractional gains. Maintains normal rejection behavior when already at valid gear boundaries, and adds detailed debug output for each case.

Wahoo kickr core and Zwift Play And Fulgaz #3575
2025-07-29 13:57:32 +02:00
Roberto Viola
60c4747a0e Tunturi T80 QZ doesn't start when I start via the treadmill start button (Issue #3568) (#3569) 2025-07-27 21:08:26 +02:00
Roberto Viola
23e2202bc0 Update project.pbxproj 2025-07-27 14:26:34 +02:00
Roberto Viola
e9c2ed8a76 VANRYSEL_HT Kcal issue fixed
mail from Sina M. 27/7/2025
2025-07-27 14:12:36 +02:00
Roberto Viola
9b9174b45a fixing crash
mail from Barry W. 27/7/2025
2025-07-27 14:10:44 +02:00
Roberto Viola
e9451c1c76 build 1126 was already submitted 2025-07-25 00:11:41 +02:00
Roberto Viola
28bd6423b7 PELOTON: removing frequent /me calling 2025-07-25 00:03:48 +02:00
Roberto Viola
083fe13ce3 adding watt step for pid hr for bikes 2025-07-24 23:07:59 +02:00
Roberto Viola
574a78ba0b ApexBike: resistance and wattage fixed 2025-07-23 22:42:30 +02:00
Roberto Viola
54177f927e ApexBike: resistance and wattage fixed 2025-07-23 16:17:27 +02:00
Roberto Viola
a9c0a23f0a Peloton Walking Pace Targets (Issue #3550) 2025-07-23 08:52:16 +02:00
Roberto Viola
5f92401c98 ANDROID: fix crash on exit 2025-07-22 18:36:50 +02:00
Roberto Viola
2d959a580f ignoring frames for solebikes 2025-07-22 09:02:08 +02:00
Roberto Viola
cc046278fd Techogym group cycle (Issue #3479) (#3497)
* Update BikeChannelController.java

* Update BikeChannelController.java

* Update BikeChannelController.java

* Update bluetooth.cpp

* let's commenting the other profiles for now. then i will need to add a settings for them

* finalazing

* Add ANT+ bike device number configuration support

Introduces a new setting for specifying the ANT+ bike device number, allowing users to select a specific device or use auto-detection (0). Updates Java, C++, and QML code to pass and handle this parameter throughout the ANT+ bike connection workflow, and adds the setting to the UI and settings management.

* fixint UI and antstart

* ANT Heart Device ID

* wizard fixed
2025-07-22 08:55:58 +02:00
Roberto Viola
af82f731cf 2.20.3
#3543
2025-07-21 13:23:41 +02:00
Roberto Viola
a9ff106e54 android: fixing toast and left padding on landscape 2025-07-21 12:51:58 +02:00
Roberto Viola
8e2cf858b9 Wahoo bike: setGears in the init is not required and it also could lead to misalignments
mail from D. Wickham on 18/07/2025
2025-07-19 16:47:36 +02:00
Roberto Viola
d19eee81b3 Peloton Walking Pace Targets (Issue #3550) (#3551)
* Peloton Walking Pace Targets (Issue #3550)

* adding min speed, 0 can't be a right speed
2025-07-18 11:42:35 +02:00
Roberto Viola
9f5a2ae120 DeerRun Treadmill integration #2621 (#3547) 2025-07-17 20:37:17 +02:00
Roberto Viola
6bb520a0a9 2.20.2 2025-07-17 11:55:10 +02:00
Roberto Viola
5031e01e00 Horizontal floating bar issues (Issue #3513) (#3515)
* to test

* Add dynamic floating window resizing and drag timeout

Introduces a JavaScript interface to allow the floating window to expand or restore its height from the HTML UI, enabling panels to request more space as needed. Adds a temporary drag mode with a 5-second timeout for improved touch interaction, and updates the HTML to coordinate window resizing and visual feedback with the Android service.

* margin fixed

* fixing margin
2025-07-17 11:28:45 +02:00
Roberto Viola
4ae0c5c638 Peloton vs QZ Rower Pace Targets #3533 2025-07-17 09:34:24 +02:00
Roberto Viola
fb45b52341 Rename nordictrack APK in build workflow
After building the APK, the workflow now renames android-debug.apk to android-debug-nordictrack.apk. This helps distinguish the NordicTrack build artifact in the output directory.
2025-07-17 09:21:27 +02:00
Roberto Viola
156ea9e7ae Add software check for ERG mode support in bike classes
Email Lower target-resistance values from 15/07/2025

Introduces ergModeSupportedAvailableBySoftware() to the bike base class and overrides it in ftmsbike to always return true. Updates homeform.cpp to use the new software-based check instead of the hardware-based one for ERG mode support logic.
2025-07-16 12:02:34 +02:00
Roberto Viola
1b7e86481b Revert "Improve resistance estimation logic for inclinations"
This reverts commit 122ff3e25f.
2025-07-16 10:48:46 +02:00
Roberto Viola
e11d6d7f6a Refactor resistanceFromPowerRequest to use ergTable
Unified the resistanceFromPowerRequest logic across multiple bike device classes by delegating to ergTable::resistanceFromPowerRequest. This reduces code duplication and centralizes the resistance calculation based on power, cadence, and max resistance. Device-specific logic is preserved where necessary, such as in proformbike.

ASCEND S2 BIKE + QDOYMOS / Virtual machine (Issue #3419)
2025-07-16 09:00:00 +02:00
Roberto Viola
c72759c70a Improved followPowerBySpeed (#3506) 2025-07-15 16:42:39 +02:00
Roberto Viola
38570d855e Update project.pbxproj 2025-07-15 14:04:35 +02:00
Roberto Viola
122ff3e25f Improve resistance estimation logic for inclinations
Mail: Lower target-resistance values 15/07/2025

Refactored estimateResistance to sort data points, handle edge cases for inclinations below minimum and above maximum, and ensure interpolation uses sorted data. The method now returns the lowest or highest resistance for out-of-range inclinations and improves clarity and robustness of the estimation process.
2025-07-15 12:39:40 +02:00
Roberto Viola
1d48c42aa4 Update trxappgateusbbike.cpp 2025-07-15 11:45:12 +02:00
Roberto Viola
daae5659cf TRXAPPGATEUSBBIKE: Apply gain and offset to cadence calculation
Added retrieval of cadence_gain and cadence_offset from settings and applied them to the cadence value in GetCadenceFromPacket. This allows dynamic adjustment of cadence readings based on user or device configuration.
2025-07-15 11:04:12 +02:00
Roberto Viola
7c11ff324f Update project.pbxproj 2025-07-14 12:16:03 +02:00
Roberto Viola
e4beee9baf ASCEND S2 BIKE + QDOYMOS / Virtual machine (Issue #3419) 2025-07-14 11:31:54 +02:00
Roberto Viola
815d8758b0 Fix Android header positioning under status bar (#3540)
* Fix Android header positioning under status bar

- Remove fullscreen flags from CustomQtActivity to allow normal window mode
- Add dynamic top padding to main.qml header toolbar for Android
- Use Screen.height - Screen.desktopAvailableHeight for proper status bar compensation
- Maintains fullscreen QML visibility while preventing header overlap

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* seems ok

* creating nomedia file for the gallery

* Update Android emulator permissions for comprehensive app testing

- Added comprehensive permission grants for all Android API levels (24-36)
- Includes Bluetooth permissions for modern Android versions (12+)
- Added storage, camera, audio, and network permissions
- Configured app ops for special permissions (MANAGE_EXTERNAL_STORAGE, SYSTEM_ALERT_WINDOW)
- All permissions use || true to handle API compatibility gracefully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* trying to reduce the gap

* could be ok?

* fixed orientation

* 2.20.1

* Update main.yml

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-14 10:05:28 +02:00
Roberto Viola
43fc6f795d Update project.pbxproj 2025-07-12 14:12:18 +02:00
Roberto Viola
075c316bfa fixing gears immediately in the ftms bike (Issue #3511) 2025-07-12 14:02:16 +02:00
Roberto Viola
1ff42c9658 PELOTON: ignoring time diff in case of bootcamps 2025-07-12 08:14:58 +02:00
Roberto Viola
2add1a9425 Update project.pbxproj 2025-07-11 15:15:00 +02:00
Roberto Viola
0fd7f40412 Feierdun elliptical 2025-07-11 15:09:04 +02:00
Roberto Viola
7e0604032a APEX BIKE Fix distance parsing and add speed/cadence timeout reset
Mail from Paul E. from 10/07/2025

Corrects the distance data extraction in
characteristicChanged by using the correct byte indices and value check. Adds logic to reset speed and cadence to zero if no new data is received within 2 seconds, improving data accuracy during communication timeouts.
2025-07-11 10:07:38 +02:00
Roberto Viola
265275d8aa SOLE LCR Bike #3226 2025-07-11 09:23:01 +02:00
Roberto Viola
705eb57414 SOLE LCR Bike #3226 2025-07-10 08:27:32 +02:00
Roberto Viola
9c446bcaf6 fixing CI 2025-07-10 06:46:20 +02:00
Roberto Viola
86118c04e2 2.20.0 2025-07-09 15:17:26 +02:00
Roberto Viola
081d9d4e24 Peloton vs QZ Rower Pace Targets (Issue #3533) 2025-07-09 11:24:18 +02:00
Roberto Viola
4ffc0867e3 fixing CI 2025-07-09 06:31:57 +02:00
Roberto Viola
3bfecadd1f fixing CI 2025-07-09 06:21:34 +02:00
Roberto Viola
06aa01d755 Update project.pbxproj 2025-07-08 15:38:50 +02:00
Roberto Viola
e432df9f6b Add nordictrack-build CI target (#3531)
* Add nordictrack-build CI target

Added new CI job 'nordictrack-build' that builds Android APK from refs/pull/3478/head branch.
This target uses the same build structure as the existing android-build job but checks out
the Nordic Track gRPC implementation PR instead of master branch.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update main.yml

* Update main.yml

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-08 12:21:22 +02:00
Roberto Viola
e3f4384014 Unify inclination step setting for treadmill and bike
Updated the inclination step adjustment in homeform.cpp to use the treadmill_step_incline setting for both treadmills and bikes. Moved the inclination step setting UI in settings.qml to a more general location and clarified its effect on both device types.
2025-07-08 09:42:40 +02:00
Roberto Viola
563ced3de1 2.19.3 2025-07-08 06:06:34 +02:00
Roberto Viola
e48c6525ea Update project.pbxproj 2025-07-08 05:04:28 +02:00
Roberto Viola
ca34e99277 PELOTON fixing pop classes 2025-07-08 05:03:56 +02:00
Roberto Viola
446f5200ba ASCEND S2 BIKE + QDOYMOS / Virtual machine (Issue #3419) 2025-07-06 15:53:11 +02:00
Roberto Viola
edcb7ab359 SPEEDMAGPRO distance fix
Email from Patrick L. 5/7/2025
2025-07-06 15:46:07 +02:00
Roberto Viola
3844808b60 adding SPEEDMAGPRO 2025-07-06 15:31:08 +02:00
Roberto Viola
8e1ddc502f bike losing connection #3528 2025-07-06 15:29:14 +02:00
Roberto Viola
e633f0f671 Nautilus 616
Mail from Leanne 5/7/2025
2025-07-05 21:59:28 +02:00
Roberto Viola
93a38a7b79 Improve token debug messages for Strava, Peloton, Zwift
Replaced raw token output in debug logs with clearer, non-sensitive success messages for Strava, Peloton, and Zwift authentication flows. This enhances log readability and security by avoiding direct token exposure in debug output.
2025-07-04 10:34:18 +02:00
Roberto Viola
d2f8ed8c01 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-07-04 09:49:36 +02:00
Roberto Viola
60a9d7cb0f fixing description in the stagesbike log 2025-07-04 09:49:10 +02:00
Roberto Viola
4c0793c785 Reverting wahoo protocol to 2.17, creating a setting to revert this (#3489)
* reverting to eb540dc579/src/devices/wahookickrsnapbike/wahookickrsnapbike.cpp

* Update wahookickrsnapbike.h

* Update homeform.cpp

* fixing build

* trying to get the right issue

* trying to restore thing

* Update project.pbxproj

* adding the settngs, but need to use the new setting in the wahookickrsnapbike.cpp

* watt gain issue!

* Update wahookickrsnapbike.h

* Update project.pbxproj

* using the new settings (not tested, just to compare on github web)

* trying to improve readability

* cleaning

* splitting the 2 logic in the update. not tested yet

* trying to align the logic

* fixing description

* Update project.pbxproj
2025-07-04 09:39:55 +02:00
Roberto Viola
5fc377f648 Update main.yml 2025-07-03 15:28:29 +02:00
Roberto Viola
0d6f207991 Update main.yml 2025-07-03 14:35:35 +02:00
Roberto Viola
051f296913 Unify app startup wait time in CI workflow
Replaces conditional sleep based on Android API level with a fixed 60-second wait after starting the app. Simplifies the workflow and ensures consistent wait time across all API levels.
2025-07-03 13:02:45 +02:00
Roberto Viola
45a4d6d0b1 Fix shell script syntax in workflow app start step
Replaces multi-line if-else block with single-line commands using backslashes to ensure correct execution in the GitHub Actions workflow when waiting for the app to start based on Android API level.
2025-07-03 12:28:33 +02:00
Roberto Viola
d2612ad03f Improve Android CI app launch and debugging steps
Enhanced the workflow to use a longer wait time for older Android API levels, added more robust process detection for the app, and included additional debugging output such as logcat and package info. Also, logcat outputs are now saved as artifacts for easier analysis.
2025-07-03 11:51:20 +02:00
Roberto Viola
6bb4d99f29 Improve app process check for Android versions
Updated the workflow to use a fallback ps command for compatibility with different Android versions when verifying if the app is running.
2025-07-03 10:15:50 +02:00
Roberto Viola
c3dbce9ea8 Add matrix strategy for Android emulator tests
Introduces a matrix build to run emulator tests across multiple Android API levels and architectures. Updates emulator configuration and artifact naming to reflect the tested Android version, improving test coverage and traceability.
2025-07-03 09:02:40 +02:00
Roberto Viola
989315fb5e fixing android emulator test 2025-07-03 08:59:09 +02:00
Roberto Viola
ce3782f80b Elite Rampa + MyWoosh compatibility
email from M.Carter from 02/07/2025
2025-07-03 08:51:02 +02:00
Roberto Viola
4ee77b392e Update AndroidManifest.xml 2025-07-02 22:01:28 +02:00
Roberto Viola
03896d7384 Update InAppPurchase.java (#3523) 2025-07-02 22:00:23 +02:00
Roberto Viola
9258bf6af2 Update AndroidManifest.xml 2025-07-02 20:45:26 +02:00
Roberto Viola
7a0a990eb8 Add Android 16 API 36 compatibility with WindowInsetsController
- Create CustomQtActivity extending QtActivity for Android 16 support
- Replace deprecated setSystemUiVisibility with WindowInsetsController
- Maintain backward compatibility with older Android versions
- Fix header toolbar visibility issues on Android 16

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-02 20:44:17 +02:00
Roberto Viola
aecb0c97df Add individual mode for HR time-in-zone tiles
Introduces a new setting to toggle between cumulative and individual time display for heart rate zone tiles. Updates the UI and logic in homeform.cpp to reflect the selected mode, adds the setting to QZSettings and QML, and documents the change.
2025-07-02 14:37:35 +02:00
Roberto Viola
eae3f59e4a build fix 2025-07-02 09:55:04 +02:00
Roberto Viola
9ad0137190 build fix 2025-07-02 09:52:06 +02:00
Roberto Viola
f62548ac60 Kinetic trainer (T-6200) resistance and inclination fix standalone 2025-07-02 09:22:57 +02:00
Roberto Viola
986bc2252e Elite Rampa + MyWoosh compatibility
email from M.Carter from 02/07/2025
2025-07-02 09:17:35 +02:00
Roberto Viola
7d744ee874 Update InAppPurchase.java 2025-07-02 08:45:11 +02:00
Roberto Viola
8f87074e69 targetSdkVersion 36 2025-07-02 08:19:10 +02:00
Roberto Viola
acd141d32b 2.19.2 2025-07-02 08:02:42 +02:00
Roberto Viola
b4fb3e339a fixing linux build 2025-07-01 10:39:16 +02:00
Roberto Viola
1336460297 added setting for the garmin fit file 2025-07-01 09:22:21 +02:00
Roberto Viola
3a45b64d51 FITSDK 21.171.00 2025-07-01 08:07:56 +02:00
Roberto Viola
49be559ae8 Update eslinkertreadmill.cpp 2025-06-30 13:51:06 +02:00
Roberto Viola
e3e15bf24d MacOs closes unexpectedly when treadmill Bluetooth connects (Issue #3518) 2025-06-30 13:19:46 +02:00
Roberto Viola
b9a7ddcaa0 rogue bike fix 2025-06-29 20:41:24 +02:00
Roberto Viola
bfd6de1d49 rogue echo bike
mail from a. morgan on 28/06/2025
2025-06-29 20:23:36 +02:00
Roberto Viola
447cb04376 Update project.pbxproj 2025-06-29 08:27:26 +02:00
Roberto Viola
29dd4cf10a kinetic handling erg and inclination and resistance (not tested) 2025-06-29 08:26:36 +02:00
Roberto Viola
c4ea190370 The Runna App are not able to controll my Kingsmith Treadmill (Issue #3519) 2025-06-29 07:45:29 +02:00
Roberto Viola
7e51db80e6 fixing crash on watchos 2025-06-28 08:34:49 +02:00
Roberto Viola
d475e50489 runna compatibility with kingsmith treadmills 2025-06-28 07:13:21 +02:00
Roberto Viola
1c4a22041d bowflex integration not quite right #3421 2025-06-27 15:17:55 +02:00
Roberto Viola
b07ffac325 Update project.pbxproj 2025-06-26 15:23:43 +02:00
Roberto Viola
d1dab0cd79 training effect in the fit file fixed
thanks to https://github.com/jat255/Fit-File-Faker
2025-06-26 15:16:12 +02:00
Roberto Viola
f5a55a253e Support for ProForm 995i #482 2025-06-26 12:58:16 +02:00
Roberto Viola
8f5b5bd5b7 Tacx neo new FW virtual shifting test (Issue #3511) 2025-06-25 12:53:00 +02:00
Roberto Viola
9d946dd1c5 Update homeform.cpp 2025-06-25 12:47:20 +02:00
Roberto Viola
d6c65dd7d8 Estimated FTP -1W (Issue #3510) 2025-06-25 12:07:09 +02:00
Roberto Viola
8d607ca0ba T900A settings renamed to T900 2025-06-25 11:49:56 +02:00
Roberto Viola
253c00f014 Create CLAUDE.md 2025-06-24 15:40:19 +02:00
Roberto Viola
a032a5d51c fixing build 2025-06-24 15:26:17 +02:00
Roberto Viola
b0c2fa5b17 Update project.pbxproj 2025-06-24 14:51:35 +02:00
Roberto Viola
7cf05276e9 BODY BIKE Smart+ integration 2025-06-24 11:32:41 +02:00
Roberto Viola
708f28fffb 2.19.1 2025-06-24 10:38:20 +02:00
Roberto Viola
c50b7655ba Heart Rate from Apple Watch not flowing to iPad #3498 2025-06-24 09:13:08 +02:00
Roberto Viola
9db2b8c235 Concept2 Rowers connecting but tiles do not update. #3503 2025-06-24 08:16:27 +02:00
Roberto Viola
134a228473 Revert "fixing github msv2019 build?"
This reverts commit c28a16d8d2.
2025-06-23 14:44:34 +02:00
Roberto Viola
f1ad62ce4a Update main.yml 2025-06-23 14:44:25 +02:00
Roberto Viola
c28a16d8d2 fixing github msv2019 build? 2025-06-23 14:18:31 +02:00
Roberto Viola
83e229e55f Update project.pbxproj 2025-06-23 12:21:12 +02:00
Roberto Viola
bd9bbdb236 3D maps start and stop points (#3502)
* Update maps.htm

* Update maps.htm
2025-06-23 10:53:47 +02:00
Roberto Viola
24095fc8cc Mqtt control (#3501)
* mqtt control

* mqtt discovery

* removed file
2025-06-23 10:44:39 +02:00
Roberto Viola
a199ba3c2b Update nordictrackifitadbbike.cpp 2025-06-19 11:23:34 +02:00
Roberto Viola
bf07764bca Proform TDF 10.0 adb resistance
mail from M B of 18/06/2025
2025-06-18 15:35:14 +02:00
Roberto Viola
1f7ce9b724 fixing watt gain for wahoo bikes 2025-06-18 13:44:48 +02:00
Roberto Viola
51ea12782d ADB Android Log verbose (#3486)
* first commit

* adding more logs

* Update QZAdbRemote.java

* trying a patch

* removing crypto thread

* adding logs
2025-06-18 10:36:35 +02:00
Roberto Viola
d7c2339783 bowflex integration not quite right #3421 2025-06-18 09:34:44 +02:00
Adam Sharpe
0bed0ca76c feat: Align FTMS elapsed time and fix cadence/resistance mapping (Swift & C++) (#3493)
This commit introduces elapsed time transmission for the virtual treadmill's FTMS characteristic in the Swift implementation, aligning it with the recent C++ changes.

Additionally, it refines the C++ to Swift updateFTMS call to ensure arguments align with the Swift function's expected parameters, including a noted discrepancy around cadence/resistance/wattage mapping.

**Important Note:**
The Swift changes () could not be compiled or fully tested with an iOS device or Zwift due to the lack of a macOS development environment (Xcode). Community assistance in validating the Swift FTMS broadcast is greatly appreciated.
2025-06-18 08:55:39 +02:00
Roberto Viola
eb4ae28fa7 Elite Rampa
mail 17/06/2025 from Matt C.
2025-06-17 05:35:27 +02:00
Roberto Viola
d1827a48ee version 2.19.0 2025-06-17 05:21:55 +02:00
Roberto Viola
f5c1b175a5 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-06-17 03:15:55 +00:00
Roberto Viola
76b14cccb4 Nordictrack Elite 800 not accepting speed/incline changes from QZ (Issue #3393) 2025-06-17 03:15:45 +00:00
Adam Sharpe
19efaf6878 feat: Add elapsed time to FTMS virtual treadmill characteristic (#3491) 2025-06-17 04:59:05 +02:00
Roberto Viola
61a96dbc63 Update proformtreadmill.cpp 2025-06-16 15:23:27 +02:00
Roberto Viola
656f2b366b Nordictrack Elite 800 not accepting speed/incline changes from QZ (Issue #3393) 2025-06-16 15:03:15 +02:00
Roberto Viola
ee336436e7 Help with a Expert SX9 #3436 2025-06-16 12:28:58 +02:00
Roberto Viola
739270b944 Help with a Expert SX9 #3436 2025-06-16 11:55:59 +02:00
Roberto Viola
bcaf466fa1 Mobvoi Treadmill Plus 2025-06-16 10:50:04 +02:00
Roberto Viola
196f77d22a Think Rider X5 compability (Issue #3487) 2025-06-13 11:26:17 +02:00
Roberto Viola
077c995a08 Update project.pbxproj 2025-06-13 10:36:56 +02:00
Roberto Viola
6db0aba44d Proform Treadmill Carbon TLS
Mail 13/6/2025 from Sonny
2025-06-13 10:23:38 +02:00
Roberto Viola
80fc8b8d46 Core temperature sensor tiles (#3484) 2025-06-12 08:02:37 +02:00
Roberto Viola
fb2676ef37 Update project.pbxproj 2025-06-11 19:32:41 +02:00
Roberto Viola
9281e91f67 Update project.pbxproj 2025-06-11 10:38:30 +02:00
Roberto Viola
540108a207 Core temperature sensor tiles (#3484)
* first commit

* adding settings

* ready to deploy

* Update homeform.cpp
2025-06-11 10:25:46 +02:00
Roberto Viola
27299a7805 Adding compensation when there is a power meter (Issue #3483) 2025-06-11 09:26:01 +02:00
Roberto Viola
52957c61a4 Connecting a NordicTrack Ultra LE treadmill to Zwift
mail from 7/6/2025
2025-06-11 08:22:09 +02:00
Roberto Viola
b06ac89f6e Sperax Walking Pad treadmill #3480 2025-06-10 09:17:06 +02:00
Roberto Viola
55921ed367 Help with a Expert SX9 (Issue #3436) 2025-06-10 08:53:00 +02:00
Roberto Viola
e89c668a96 adding device info mesg 2025-06-10 08:13:15 +02:00
Roberto Viola
43ca65baf2 Help with a Expert SX9 (Issue #3436) 2025-06-09 14:39:58 +02:00
Roberto Viola
eaba07cafd reverting Connection #3466 2025-06-09 13:11:27 +02:00
Roberto Viola
5b57f2c8aa Help with a Expert SX9 (Issue #3436) 2025-06-09 10:39:08 +02:00
Roberto Viola
5fea12e6bc Merach S26B2 2025-06-09 08:55:33 +02:00
Roberto Viola
dcdd4fdbb6 Update speraxtreadmill.cpp 2025-06-07 16:03:40 +02:00
Roberto Viola
aac9f7a20e Update speraxtreadmill.cpp 2025-06-07 15:35:33 +02:00
Roberto Viola
5146352494 FTMS Bike Ant Sender (#3467) 2025-06-07 15:15:48 +02:00
Roberto Viola
f666c4cc55 fixing drive letter in the github actions? 2025-06-07 06:13:07 +02:00
Roberto Viola
882778b9ff Update project.pbxproj 2025-06-06 18:17:31 +02:00
Roberto Viola
783b832805 Core Sensor Support #3347 2025-06-06 18:16:26 +02:00
Roberto Viola
defb177f53 Update project.pbxproj 2025-06-06 09:43:48 +02:00
Roberto Viola
d511df4186 Sperax Treadmill 2025-06-06 09:43:13 +02:00
Roberto Viola
ffe79b434a Core Sensor Support #3347 2025-06-06 09:30:50 +02:00
Roberto Viola
9050be6063 reverting Connection #3466 2025-06-06 08:45:44 +02:00
Roberto Viola
744d2d138f Sperax Treadmill 2025-06-06 08:25:50 +02:00
Roberto Viola
612acf3610 Connection (Issue #3466) 2025-06-05 15:00:58 +02:00
Roberto Viola
a84e4ca84d Update project.pbxproj 2025-06-05 09:14:31 +02:00
Roberto Viola
e4b4dd943e Losing Connection #3439 2025-06-05 09:13:40 +02:00
Roberto Viola
121a046bb8 DKN EnduRun data not showing in QZ #3468 2025-06-05 09:05:17 +02:00
Roberto Viola
21e0a7edc8 Sperax Treadmill
Sperax treadmill compatibility email from 21/05/2025 and QZ Fitness support for Sperax Walking Pad treadmill email from 4/06/2025
2025-06-05 09:01:56 +02:00
Roberto Viola
83e1c136e4 Update project.pbxproj 2025-06-04 08:16:02 +02:00
Roberto Viola
9a19956b1c Magene Gravat2 bike trainer compatibility #3460 2025-06-04 08:03:55 +02:00
Roberto Viola
18571131ca Update qdomyos-zwift.pri 2025-06-03 11:01:05 +02:00
Roberto Viola
eba9a2c8d5 Update speraxtreadmill.cpp 2025-06-03 11:00:54 +02:00
Roberto Viola
dbf5b7005d Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-06-03 10:17:42 +02:00
Roberto Viola
64476f7e61 Sperax Treadmill 2025-06-03 10:17:35 +02:00
Roberto Viola
f111e9c4e4 Nordictrack Elite 800 not accepting speed/incline changes from QZ #3393 2025-06-03 07:13:25 +00:00
Roberto Viola
0f7b240f4a Mobvoi Treadmill Plus Elapsed Time / Moving Time #3404 (#3425) 2025-05-30 21:25:52 +02:00
Roberto Viola
63ee0f6d71 Update project.pbxproj 2025-05-30 16:00:39 +02:00
Roberto Viola
e38b00b735 Update ftmsbike.cpp 2025-05-30 15:58:09 +02:00
Roberto Viola
97a5de93d8 Help with a Expert SX9 (Issue #3436) 2025-05-30 15:40:37 +02:00
Roberto Viola
9aabaddf6e Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-05-30 14:13:26 +02:00
Roberto Viola
2fb9d6043a Core Sensor Support #3347 2025-05-30 14:13:21 +02:00
Roberto Viola
d1afc5c6b3 Adding Tunturi T80 2025-05-29 10:04:25 +02:00
Roberto Viola
2270d93419 Update project.pbxproj 2025-05-28 10:43:58 +02:00
Roberto Viola
4e3e6de6c1 2.18 (1087) causes my treadmill not to function properly #3456 2025-05-28 08:50:07 +02:00
Roberto Viola
201877f214 version 2.18.25 2025-05-27 13:50:27 +02:00
Roberto Viola
0941d3f218 Floating Window display (Discussion #3402) (#3426)
* Floating Window display (Discussion #3402)

* adding setting

* Update homeform.cpp

* verify jni

* Update FloatingHandler.java

* Update main.yml

* Update main.yml
2025-05-24 06:59:17 +02:00
Roberto Viola
7f8876d021 Update project.pbxproj 2025-05-23 09:24:48 +02:00
Roberto Viola
62c7e2125a PELOTON: cool down classes fix #2606
email from aaron 22/05/2025
2025-05-23 09:17:57 +02:00
Roberto Viola
13b2d6a18b Update project.pbxproj 2025-05-22 16:33:29 +02:00
Roberto Viola
2e854d8f1f PELOTON: cool down classes fix #2606
email from aaron 21/05/2025
2025-05-22 08:42:04 +02:00
Roberto Viola
093f5cbe33 Update project.pbxproj 2025-05-21 14:12:58 +02:00
Roberto Viola
b9da86d1ce 3G ELITE treadmill added 2025-05-21 08:39:48 +02:00
Roberto Viola
5ac449a178 PELOTON: skipping intro for warmup and cooldown rides 2025-05-21 08:37:26 +02:00
Roberto Viola
179e60b40b Help with a Expert SX9 #3436 2025-05-19 13:16:01 +02:00
Roberto Viola
5603dc4259 Help with a Expert SX9 #3436 2025-05-19 13:10:26 +02:00
Roberto Viola
b8d703d94f fixing build 2025-05-19 12:26:24 +02:00
Roberto Viola
8ce49beefa Help with a Expert SX9 #3436 2025-05-19 12:25:08 +02:00
Roberto Viola
2437c4c30c Echelon swift plus victory dircon (#3442)
* starting

* builds

* works with the simulator

* Update echelonconnectsport.cpp

* crash fixed

* fixing crash?

* fixing crash!

* Update echelonconnectsport.cpp

* build fix

* starting

* it's working for asking the UUID!

* i'm getting the 0003 but i need to notify the 0002

it doesn't enter into the sendCharacteristicNotification loop

* adding 0004 notifier

* kind of works (no unhandled frames)

* it works!

* wahoo rgt setting is not useful anymore

* dircon works perfectly on ios!

* improving wattage also for all bluetooth, but it's not perfect yet

* Horizon 5.0 Bike Compatibility #3001

* Update characteristicwriteprocessor0003.h

* Update dirconmanager.cpp

* Update fakebike.cpp

* simulating a fake cadence randomly

* handling unhandled case

* Log on Thread

* Update project.pbxproj

* fixing gears on startup alinged with zwift

* Update dirconmanager.cpp

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2666126808

* Gears don't work for mid-work free ride segment (Issue #2897)

* Update project.pbxproj

* fixing bluetooth on ios with get gears from zwift enabled

* fixing bluetooth with get gears on on android? not tested

* fixing build

* Update project.pbxproj

* Update settings.qml

* Gears don't work for mid-work free ride segment (Issue #2897)

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2692178928

* Gears don't work for mid-work free ride segment (Issue #2897)

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2692370530

* Update project.pbxproj

* fixing memory leak

* Update project.pbxproj

* Update project.pbxproj

* build 1043

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* added gears UI from zwift directly if received

* fixing build

* fixing build

* Update project.pbxproj

* fixing zwift gears in the UI of qz

* always enabling 50ms on dircon

* Update project.pbxproj

* wahookickrsnapbike as well

* adding also zwiftclickremote

* fixing crash

* fixing crash

* Update project.pbxproj

* gear alignment between zwift and qz under a new setting

* Update project.pbxproj

* fixing wahoo swift implementation

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update ios_wahookickrsnapbike.mm

* Update project.pbxproj

* adding compensation when there is a power sensor and an ergModeSuppported bike

* Update project.pbxproj

* adding compensation when there is a power sensor and an ergModeSuppported bike

* Update project.pbxproj

* Update project.pbxproj

* Elite Drivio II

* rower distance on apple health?

* Update project.pbxproj

* avoiding crash

* Update project.pbxproj

* Update project.pbxproj

* Bluetooth issues (Issue #3420)

* fixing build #3420

* Update project.pbxproj

* Bluetooth issues (Issue #3420)

* Bluetooth issues #3420

* Revert "Bluetooth issues #3420"

This reverts commit f20f55c0f1.

* Revert "Bluetooth issues (Issue #3420)"

This reverts commit 74c15befaf.

* Revert "fixing build #3420"

This reverts commit 416d10698d.

* Revert "Bluetooth issues (Issue #3420)"

This reverts commit 5cd3efe559.

* merge

* Update echelonconnectsport.h

* Update project.pbxproj

* iOS v2.18 (1061) zwift play controllers disconnecting all the time (Issue #3378)

https://github.com/cagnulein/qdomyos-zwift/issues/3378#issuecomment-2859933867

* Update project.pbxproj

* Bluetooth issues (Issue #3420)

* Update project.pbxproj

* zwift custom characteristic only if get gears from zwift is enabled

https://github.com/cagnulein/qdomyos-zwift/issues/3419#issuecomment-2860215362

* adding max resistance for SCHWINN 190U

* Update qdomyos-zwift.pri

* Update project.pbxproj

* Bluetooth issues (Issue #3420)

* Update project.pbxproj
2025-05-19 11:40:28 +02:00
Roberto Viola
0029258fa5 Echelon Bike ObjectiveC for iOS Crashes (#1898)
* starting

* builds

* works with the simulator

* Update echelonconnectsport.cpp

* crash fixed

* fixing crash?

* fixing crash!

* Update echelonconnectsport.cpp

* build fix

* Update project.pbxproj

* Update project.pbxproj

* wahookickrsnapbike as well

* adding also zwiftclickremote

* fixing wahoo swift implementation

* added wahoo simulator for macos

* Update ios_wahookickrsnapbike.mm

* Bluetooth issues (Issue #3420)

* fixing build #3420

* Bluetooth issues (Issue #3420)

* merge

* Revert "merge"

This reverts commit 3946715856.

* Revert "Bluetooth issues (Issue #3420)"

This reverts commit e98152d9ec.

* Revert "fixing build #3420"

This reverts commit d19982f9df.

* Revert "Bluetooth issues (Issue #3420)"

This reverts commit 67318f1bc2.

* adding ios_btdevice_native

* Update echelonconnectsport.h

* iOS v2.18 (1061) zwift play controllers disconnecting all the time (Issue #3378)

https://github.com/cagnulein/qdomyos-zwift/issues/3378#issuecomment-2859933867

* Bluetooth issues (Issue #3420)

* Bluetooth issues (Issue #3420)
2025-05-19 11:37:25 +02:00
Roberto Viola
8541ec0242 Dircon doesn't work on android 13 and 14 (Issue #3325) (#3332)
* trying a fix

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update .gitmodules

* Update .gitmodules

* Update main.yml

* Revert "Update main.yml"

This reverts commit 034d6f2852.

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update .gitmodules

* Update main.yml
2025-05-16 15:26:12 +02:00
Roberto Viola
0c138d2c07 Help with a Expert SX9 (Issue #3436) 2025-05-16 03:59:45 +00:00
Roberto Viola
4f70b5d160 Help with a Expert SX9 (Issue #3436) 2025-05-16 03:44:04 +00:00
Roberto Viola
e0bcafa804 H9115 Lyon ftms bike 2025-05-15 06:04:29 +02:00
Roberto Viola
330e0b3725 Victory Dircon (#2961)
* starting

* it's working for asking the UUID!

* i'm getting the 0003 but i need to notify the 0002

it doesn't enter into the sendCharacteristicNotification loop

* adding 0004 notifier

* kind of works (no unhandled frames)

* it works!

* wahoo rgt setting is not useful anymore

* dircon works perfectly on ios!

* improving wattage also for all bluetooth, but it's not perfect yet

* Horizon 5.0 Bike Compatibility #3001

* Update characteristicwriteprocessor0003.h

* Update dirconmanager.cpp

* Update fakebike.cpp

* simulating a fake cadence randomly

* handling unhandled case

* Log on Thread

* Update project.pbxproj

* fixing gears on startup alinged with zwift

* Update dirconmanager.cpp

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2666126808

* Gears don't work for mid-work free ride segment (Issue #2897)

* Update project.pbxproj

* fixing bluetooth on ios with get gears from zwift enabled

* fixing bluetooth with get gears on on android? not tested

* fixing build

* Update project.pbxproj

* Update settings.qml

* Gears don't work for mid-work free ride segment (Issue #2897)

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2692178928

* Gears don't work for mid-work free ride segment (Issue #2897)

https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2692370530

* Update project.pbxproj

* fixing memory leak

* Update project.pbxproj

* Update project.pbxproj

* build 1043

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* added gears UI from zwift directly if received

* fixing build

* fixing zwift gears in the UI of qz

* always enabling 50ms on dircon

* fixing crash

* gear alignment between zwift and qz under a new setting

* avoiding crash

* zwift custom characteristic only if get gears from zwift is enabled

https://github.com/cagnulein/qdomyos-zwift/issues/3419#issuecomment-2860215362
2025-05-14 16:02:37 +02:00
Roberto Viola
46c12af44d fixing build 2025-05-14 09:56:39 +00:00
Roberto Viola
74db47ba16 Update qdomyos-zwift.pri 2025-05-14 08:11:41 +00:00
Roberto Viola
3bc848cdf4 adding inclinationresistancetable.h 2025-05-14 08:00:45 +00:00
Roberto Viola
a8d58a733e adding max resistance for SCHWINN 190U 2025-05-14 07:59:49 +00:00
Roberto Viola
37c6c03ada adding inclinationResistanceTable for the ftmsbike without an erg mode 2025-05-14 07:32:33 +00:00
Roberto Viola
f258b9e0ae Losing Connection 2025-05-14 06:53:05 +00:00
Roberto Viola
6ec3936bf1 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-05-14 06:39:31 +00:00
Roberto Viola
0f0991f956 peloton: handling delta metrics of only 10 seconds 2025-05-14 06:39:23 +00:00
Roberto Viola
4649744cb4 NordicTrack T6.5S Speed not matching in app and switching treadmill to metric #3417 2025-05-12 09:26:09 +02:00
Roberto Viola
755c1765b4 bowflex integration not quite right #3421 2025-05-12 09:23:19 +02:00
Roberto Viola
6df9fe6acb NordicTrack T6.5S Speed not matching in app and switching treadmill to metric (Issue #3417) 2025-05-09 09:35:01 +02:00
Roberto Viola
32180bf1bd Peloton Resistance not matching Yesoul GS1M #3430 2025-05-08 16:12:06 +02:00
Roberto Viola
a373f41ee0 NordicTrack T6.5S Speed not matching in app and switching treadmill to metric (Issue #3417) 2025-05-08 09:21:18 +02:00
Roberto Viola
bb63e0c3cf Peloton Resistance not matching Yesoul GS1M #3430 2025-05-08 08:41:21 +02:00
Roberto Viola
e84f6d0468 Sportstech sBike Lite 2025-05-08 08:31:39 +02:00
Roberto Viola
b08cf90bdb fixing tests 2025-05-07 10:48:45 +02:00
Roberto Viola
9939056115 Hammer Speedbike S 2025-05-07 08:53:44 +02:00
Roberto Viola
9ea09aca32 Hammer Speedbike S 2025-05-06 08:35:32 +02:00
Roberto Viola
65e15ab29b NordicTrack T6.5S Speed not matching in app and switching treadmill to metric (Issue #3417) 2025-05-05 11:16:10 +02:00
Roberto Viola
1d1e63c40d Nordictrack Elite 800 not accepting speed/incline changes from QZ (Issue #3393) 2025-05-02 13:59:07 +02:00
Roberto Viola
7e854f5bb1 NordicTrack T6.5S Speed not matching in app and switching treadmill to metric #3417 2025-05-02 13:26:09 +02:00
Roberto Viola
fa42eadf43 adding SPERAX_RM-01 2025-05-01 09:35:30 +02:00
Roberto Viola
7ee4f85f67 Mobvoi Treadmill Plus Elapsed Time / Moving Time #3404 2025-04-29 13:15:39 +02:00
Roberto Viola
afa02fab3f Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-04-29 09:41:03 +00:00
Roberto Viola
c10703316c merge 2025-04-29 09:40:57 +00:00
Roberto Viola
93b09d64b0 Core Sensor Support (Issue #3347) 2025-04-29 11:27:10 +02:00
Roberto Viola
12663907d2 merge 2025-04-29 06:07:15 +00:00
Roberto Viola
f72717d440 merge 2025-04-29 06:05:48 +00:00
Roberto Viola
c94174a994 No metrics showing on Apex Rides bike #2459 2025-04-28 14:59:22 +02:00
Roberto Viola
2789c2bf0f No data from my CycleOps Magnus smart trainer and the QZ application. (Issue #3410) 2025-04-28 08:30:06 +02:00
Roberto Viola
0c69226747 Update main.yml 2025-04-27 06:59:04 +02:00
Roberto Viola
9dc65861cc Neo Bike Plus added 2025-04-26 14:24:15 +02:00
Roberto Viola
b14d917f3d Mobvoi Treadmill Plus Elapsed Time / Moving Time (Issue #3404) 2025-04-25 13:56:59 +02:00
Roberto Viola
23fb91b4d2 Update horizontreadmill.cpp 2025-04-25 12:20:16 +02:00
Roberto Viola
110eea144b Mobvoi Treadmill Plus Elapsed Time / Moving Time (Issue #3404) 2025-04-25 12:00:45 +02:00
Roberto Viola
f413068074 Mobvoi Treadmill Plus Elapsed Time / Moving Time #3404 2025-04-24 16:41:11 +02:00
Roberto Viola
917d559ebf fixing CI for linux #2818 2025-04-24 14:00:40 +02:00
Roberto Viola
8d52455574 Sportstech sBike Lite fix 2025-04-24 11:40:42 +02:00
Roberto Viola
3602fa566c Please implement ability for QZ to receive data via ant+ from ant+ bike/ftms (Issue #3257) (#3266)
* i need to add the new bike class

* Update bluetooth.cpp

* Update BikeChannelController.java

* Update BikeChannelController.java

* Update bluetooth.cpp

* class added

* settings aligned

* Update android_antbike.cpp

* Update BikeChannelController.java
2025-04-21 06:46:29 +02:00
Roberto Viola
a53239df97 Powermeter pédale and ERG #2818 (#2880)
* Powermeter pédale and ERG #2818

* Update ergtable_test.h

* Update qdomyos-zwift.pro

* Update main.cpp

* Delete src/ergtable_test.h

* handling TITAN_7000 case

* Update project.pbxproj

* handling TITAN_7000 case

* Update ergtable.h

* Update project.pbxproj
2025-04-21 06:37:37 +02:00
Roberto Viola
6154158254 Elite Drivio II 2025-04-18 17:38:20 +00:00
Roberto Viola
f91b25a177 rower distance on apple health? 2025-04-18 17:38:04 +00:00
octera
650a74dd8c feat: add Proform performance 300i (#3398) 2025-04-18 13:53:11 +02:00
Roberto Viola
d44f57285f Inclination overide not working for Domyos T900C (Issue #3267) (#3270) 2025-04-18 12:37:20 +02:00
Roberto Viola
33b1dcf0f8 Android emulator actions (#3372)
* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Create android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update main.yml

* Update android_test.yml

* Update android_test.yml

* Update android_test.yml

* Update main.yml

* Update android_test.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Delete .github/workflows/android_test.yml
2025-04-17 06:56:34 +02:00
Roberto Viola
e914be7ee0 3G Cardio Pro Runner X cannot change incline nor speed (Issue #3382) 2025-04-17 06:15:09 +02:00
Roberto Viola
b2ea3b0525 3G Cardio Pro Runner X cannot change incline nor speed (Issue #3382) 2025-04-17 05:08:08 +02:00
Roberto Viola
3c5c0518b4 too many KM with BikeERG #3376 2025-04-16 14:26:10 +02:00
Roberto Viola
2b1e11d2e0 [BUG] 3G Cardio Pro Runner X cannot change incline nor speed #3382 2025-04-14 10:37:13 +02:00
Roberto Viola
b3eab44f50 Life Fitness T5 treadmill not connecting to QZ #3381 2025-04-14 10:07:37 +02:00
Roberto Viola
bec8776c63 fixing Align Gear Value on Both Zwift and QZ setting 2025-04-13 07:03:41 +02:00
Roberto Viola
519e39d54b power sensor also for cadence on wahoo bike 2025-04-12 16:32:22 +02:00
Roberto Viola
8e4ab441c0 power sensor also for cadence on wahoo bike 2025-04-12 16:04:12 +02:00
Roberto Viola
6522baccd6 build issue 2025-04-12 15:56:17 +02:00
Roberto Viola
be851955b6 fixing tacx settings 2025-04-12 15:55:08 +02:00
Roberto Viola
4083059155 Life Fitness Treadmill (model 95T with Discover SE console) #3374 2025-04-12 13:18:05 +02:00
Roberto Viola
9ace6dd570 tacxneo2: handling negative inclination with gears due to the flywheel 2025-04-12 11:16:05 +02:00
Roberto Viola
b0677a768d adding setting for the gear alignment between zwift and qz 2025-04-12 06:17:56 +02:00
Roberto Viola
dad99fe6bf [BUG] 3G Cardio Pro Runner X cannot change incline nor speed #3382 2025-04-12 06:03:17 +02:00
Roberto Viola
b5c48bd9f7 Matrix bike not sending data after successful connection #3383 2025-04-12 05:57:50 +02:00
Roberto Viola
8e73dd7a7c Life Fitness T5 treadmill not connecting to QZ (Issue #3381) 2025-04-11 16:16:40 +02:00
Roberto Viola
905c06771b Life Fitness T5 treadmill not connecting to QZ #3381 2025-04-11 09:13:15 +02:00
Roberto Viola
255dbde832 Android Log in QDebug (#3370)
* let's see if it compiles

* fixing cases?

* fixing

* Update Log.java

* fixing

* Update WearableMessageListenerService.java

* fixing

* Update androidqlog.cpp

* restoring patch
2025-04-11 08:30:01 +02:00
Roberto Viola
eaaaee2b4b Life Fitness T5 treadmill not connecting to QZ #3381 2025-04-11 08:25:24 +02:00
Roberto Viola
7227d32c3b 77a361905b (r155155285) 2025-04-11 07:58:31 +02:00
Roberto Viola
988419b7e2 Sessions with negative calories (Issue #3345) 2025-04-09 12:28:11 +02:00
Roberto Viola
1d1401b1d6 Life Fitness Treadmill (model 95T with Discover SE console) #3374 2025-04-09 09:00:39 +02:00
Roberto Viola
282667c6e3 jdpurcell/install-qt-action@v5 (#3373)
* Update main.yml

* Update main.yml
2025-04-09 08:38:03 +02:00
Roberto Viola
fa13ba1d72 Update main.yml (#3371) 2025-04-08 18:12:13 +02:00
Roberto Viola
a2ad67fbac adding restore buttons for wheeldiameter in the wahoo options 2025-04-08 15:33:35 +02:00
Roberto Viola
5e42345889 tacxneo2: handling negative inclination with gears due to the flywheel 2025-04-08 13:26:29 +02:00
Roberto Viola
684ed7d7e9 QZ app with NordicTrack Elliptical FS10i 2025-04-08 10:55:11 +02:00
Roberto Viola
2ff3c1d3b4 QZ app with NordicTrack Elliptical FS10i 2025-04-08 09:41:35 +02:00
Roberto Viola
e0ea3b2fe0 New peloton Login issues #3323 2025-04-08 09:31:01 +02:00
Roberto Viola
35fe2c3fd3 Echelon Sport StairClimber (Issue #3336) 2025-04-07 15:52:42 +02:00
Roberto Viola
0ec6f99429 QZ app with NordicTrack Elliptical FS10i 2025-04-07 15:02:28 +02:00
Roberto Viola
dbe407e784 Update main.yml 2025-04-07 13:05:37 +02:00
Roberto Viola
93f0c714fc fixing build 2025-04-07 12:09:44 +02:00
Roberto Viola
a1b57654c6 Installing on raspberry pi zero w2 from source or download from nightly (Issue #3361) 2025-04-07 11:05:39 +02:00
Roberto Viola
624234dc92 Update project.pbxproj 2025-04-07 10:19:18 +02:00
Roberto Viola
cdda64575a proformwifibike: gpx changes both resistance and inclination 2025-04-07 09:23:54 +02:00
Roberto Viola
483a31d984 adding the fitness equipment in the fit file for the elliptical 2025-04-07 08:56:43 +02:00
Roberto Viola
6d88e7e831 Update settings.qml 2025-04-07 08:54:44 +02:00
Roberto Viola
bb97e49982 Elite Square compatibility (Issue #3354) (#3356)
* Elite Square compatibility (Issue #3354)

* fixing

* fixing

* fixing
2025-04-07 08:52:16 +02:00
Roberto Viola
4f8090e5bf cycplus t2 trainer and cycplus bc2 virtual shift controller. (Issue #3359) 2025-04-04 13:50:40 +02:00
Roberto Viola
8c18d6f179 cycplus t2 trainer and cycplus bc2 virtual shift controller. #3359 2025-04-04 10:02:38 +02:00
Roberto Viola
7d615b4e65 version 2.18.24 2025-04-03 16:32:21 +02:00
Roberto Viola
e264a4c887 Multiple Peloton account with the new login system (#3355)
* trying to fix it. not tested

* Update peloton.cpp

* adding version into the agent

* Update peloton.cpp

* Update peloton.cpp

* Update peloton.cpp

* Update project.pbxproj
2025-04-03 16:14:49 +02:00
Roberto Viola
0991495f51 Echelon Sport StairClimber #3336 2025-04-03 16:06:57 +02:00
Roberto Viola
94c19d70eb QZ App will connect to but not report data for Nautilus E618 Elliptical #2188 2025-04-02 11:44:02 +02:00
Roberto Viola
805639bbfa NordicTrack Elliptical FS10i 2025-04-02 08:45:00 +02:00
Roberto Viola
a900ab939d NordicTrack Elliptical FS10i 2025-04-01 13:20:02 +02:00
Roberto Viola
34881df30a Update project.pbxproj 2025-04-01 09:04:49 +00:00
Roberto Viola
b35995a925 Update project.pbxproj 2025-04-01 09:00:42 +00:00
Roberto Viola
ea9a7170ca NordicTrack Elliptical FS10i 2025-04-01 11:00:10 +02:00
Roberto Viola
4e41a8aaac Revert "NordicTrack Elliptical FS10i"
This reverts commit 8b03718422.
2025-04-01 10:58:40 +02:00
Roberto Viola
b718eb3f4c Not following class callouts (Issue #3350) 2025-04-01 10:01:23 +02:00
Roberto Viola
8b03718422 NordicTrack Elliptical FS10i 2025-03-31 15:13:04 +02:00
Roberto Viola
e0bb6f3c95 Echelon Sport StairClimber #3336 2025-03-31 14:51:11 +02:00
Roberto Viola
4b1649b26a NordicTrack Elliptical FS10i 2025-03-31 13:37:20 +02:00
Roberto Viola
20bd6dbdc4 QZ App will connect to but not report data for Nautilus E618 Elliptical (Issue #2188) 2025-03-31 08:42:31 +02:00
Roberto Viola
2c6088e96c NordicTrack Elliptical FS10i 2025-03-30 16:20:20 +02:00
Roberto Viola
db3961443c QZ App will connect to but not report data for Nautilus E618 Elliptical (Issue #2188) 2025-03-30 15:59:08 +02:00
Roberto Viola
83c3cea88f QZ App will connect to but not report data for Nautilus E618 Elliptical #2188 2025-03-30 08:22:55 +02:00
Roberto Viola
850f680e32 New peloton Login issues (Issue #3323) 2025-03-28 15:59:15 +01:00
Roberto Viola
dcc0b3cbd8 lap distance added to the lap elapsed tile 2025-03-27 09:40:41 +01:00
Roberto Viola
fb372cee89 Using Speed Gain causes treadmill to change speed on inclination change from Zwift (Issue #3334) 2025-03-27 09:30:32 +01:00
Roberto Viola
916af395b6 Proform 225 csx on Mywhoosh, no auto resistance or tile control, manual only (Issue #3230) 2025-03-25 17:19:23 +01:00
Roberto Viola
27b9ef9216 2.18.23 2025-03-25 17:01:15 +01:00
Roberto Viola
c85463b728 REEBOK ftms bike with 32 resistance levels 2025-03-25 11:51:47 +01:00
Roberto Viola
9561cc0269 Update nordictrackifitadbtreadmill.cpp 2025-03-25 11:42:36 +01:00
Roberto Viola
e69c1689ec Dircon doesn't work on android 13 and 14 #3325 2025-03-24 09:51:12 +01:00
Roberto Viola
18497e92fd Skandika Abisko / ERG support #3326 2025-03-24 09:39:50 +01:00
Roberto Viola
f692621565 Proform 225 csx on Mywhoosh, no auto resistance or tile control, manual only #3230 2025-03-24 08:36:41 +01:00
Roberto Viola
934a1089db Add Support for SmO2 NIRS Moxy Sensor (Issue #3250) 2025-03-21 15:13:29 +01:00
Roberto Viola
b0dfeb6e5f Proform 225 csx on Mywhoosh, no auto resistance or tile control, manual only #3230 2025-03-21 14:46:50 +01:00
Roberto Viola
448702b081 Skandika Abisko Support (Issue #3313) 2025-03-21 11:45:27 +01:00
Roberto Viola
8ed9117bee Automatic resistance for Peloton classes not applying correctly for BH Fitness Osaka bike (Issue #3322) 2025-03-21 09:53:14 +01:00
Roberto Viola
439bb30bbd New peloton Login issues (Issue #3323) 2025-03-21 08:34:17 +01:00
Roberto Viola
fc29cd7051 Rower Found but stops getting values (Issue #3320) 2025-03-20 15:10:11 +01:00
Roberto Viola
51aca98536 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-03-20 14:07:57 +01:00
Roberto Viola
2ab3f0b442 Thinkrider #3321 2025-03-20 14:01:36 +01:00
Roberto Viola
cb9105682e Skandika Abisko Support #3313 2025-03-20 13:54:14 +01:00
Roberto Viola
84d46e3aee fixing profile other folders button for all the archs except android
https://github.com/cagnulein/qdomyos-zwift/issues/3251#issuecomment-2737517104
2025-03-20 11:25:10 +01:00
Roberto Viola
9a97dc5221 Rower Found but stops getting values (Issue #3320) 2025-03-20 09:39:07 +01:00
Roberto Viola
ee810b9e0c fixing speed numbers without the comma for nordictrack adb treadmills 2025-03-20 09:34:56 +01:00
Roberto Viola
516a96a4a8 trying to increase strongness of the ios osx bt patch
https://github.com/cagnulein/qdomyos-zwift/issues/3313#issuecomment-2739527022
2025-03-20 09:27:29 +01:00
Roberto Viola
506a9c0896 Skandika Abisko Support #3313 2025-03-20 09:08:49 +01:00
Roberto Viola
71196983ca Update main.yml 2025-03-19 14:58:28 +01:00
Roberto Viola
fc600873b4 Update main.yml 2025-03-19 13:40:08 +01:00
Roberto Viola
49e588e60e Robx e1 bike 2025-03-19 12:55:34 +01:00
Roberto Viola
dc5beebb24 Skandika Abisko Support (Issue #3313) 2025-03-19 09:08:34 +01:00
Roberto Viola
58d4e8b456 Open Resistance does not change when using virtual shifting from Zwift to Kickr Snap #3301 2025-03-18 12:10:16 +01:00
Roberto Viola
ca89072273 Pro-Form, model PFTL99015.0 #3209 2025-03-16 18:53:31 +01:00
Roberto Viola
ff5d8baa1a Data not correctly going to strava (Issue #3298) 2025-03-14 10:59:50 +01:00
Roberto Viola
9ac09db4c3 Update main.yml 2025-03-14 10:14:48 +01:00
Roberto Viola
18e845f99f QT6 on Nigthly (#3293)
* Update main.yml

* Update main.yml
2025-03-14 09:42:16 +01:00
Roberto Viola
e6307dec97 Bcube SP303 2025-03-14 08:16:34 +01:00
Roberto Viola
d2941d94bc Mywhoosh ERG resistance drops (Issue #3300) 2025-03-14 08:05:32 +01:00
Roberto Viola
ba132a0546 removing msvc2022 for the moment 2025-03-11 06:39:57 +01:00
Roberto Viola
d3bbd836f6 Update main.yml 2025-03-09 13:14:49 +01:00
Roberto Viola
8777c2df64 Update main.yml 2025-03-09 10:31:43 +01:00
Roberto Viola
e123c94e8a Body worx JTX3.00 #3288 2025-03-09 10:22:15 +01:00
Roberto Viola
7b3af6ac90 2.18.22 2025-03-08 09:23:47 +01:00
Roberto Viola
ce522a75b5 Update main.yml 2025-03-08 09:19:14 +01:00
Roberto Viola
24720e02f0 QZ app bluetooth keeps disconnecting from bike #3199 2025-03-07 08:55:40 +01:00
Roberto Viola
f34430348a getting QT6 binary from the PR 2025-03-07 03:31:24 +01:00
Roberto Viola
667cdb1520 Proform XBike #3214 2025-03-07 03:02:31 +01:00
Roberto Viola
966bcfadab fixing bootcamp treadmill peloton classes and also fixing void login_onfinish results 2025-03-07 02:54:32 +01:00
Roberto Viola
3c13f211f2 windows 11 builds 2025-03-06 13:34:24 +01:00
Roberto Viola
0033d261d3 adding button on the debug log to show the current folder on macos 2025-03-05 07:57:39 +01:00
Roberto Viola
e1ed32af92 reverting Rouvy: Virtual shifting with Zwift gearing, noticeably harder than physical gearing #3031 (#3268) 2025-03-04 20:11:27 +01:00
Roberto Viola
0d51f4c1d4 Heart Rate Zone Minutes Tracker #3259 2025-03-04 15:35:10 +01:00
Roberto Viola
4c0ffd483e Proform XBike #3214 2025-03-04 10:22:58 +01:00
Roberto Viola
3e4751070f Tunturi F40 Bike #3265 2025-03-03 08:23:21 +01:00
Roberto Viola
4b6611ae2b Don't adjust speed by inclination when using PID (Issue #3254) 2025-02-28 09:13:37 +01:00
Roberto Viola
1a58636cd4 DIRETO XR limited at 600W #3193 2025-02-28 09:06:05 +01:00
Roberto Viola
11dc65bdf1 Fixing raspberry 64bit? 2025-02-28 07:16:02 +01:00
Roberto Viola
387a8f0efe fixing crash build 64bit raspberry? 2025-02-27 14:17:04 +01:00
Roberto Viola
0847f9237f improving crash handling on ios 2025-02-27 12:27:25 +01:00
Roberto Viola
2f5818ba5a Proform 225 csx on Mywhoosh, no auto resistance or tile control, manual only (Issue #3230) 2025-02-26 15:01:44 +01:00
Roberto Viola
d502f983c0 QZ app bluetooth keeps disconnecting from bike (Issue #3199) 2025-02-26 14:15:48 +01:00
Roberto Viola
af79605268 2.18.21 2025-02-26 11:27:54 +01:00
Roberto Viola
0192da5a92 Peloton API Login Issues (Issue #3217) (#3240)
* Peloton API Login Issues (Issue #3217)

* Update peloton.cpp

* fixing variant

* Update peloton.cpp

* improving api stability with the retry mechanism

* Revert "improving api stability with the retry mechanism"

This reverts commit b319f84252.

* Update homeform.cpp

* starting peloton engine after the first login

* check for user id
2025-02-26 11:24:37 +01:00
Roberto Viola
e563a9dc21 Proform 225 csx on Mywhoosh, no auto resistance or tile control, manual only (Issue #3230) 2025-02-26 09:31:15 +01:00
Roberto Viola
8f5d969f61 Yosuda spin bike #3246 2025-02-26 08:06:16 +01:00
Roberto Viola
3a8fb33dd6 Rogue Echo Rower #3241 2025-02-25 11:13:46 +01:00
Roberto Viola
0bc2d74dcc Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-02-24 14:56:57 +01:00
Roberto Viola
13da5056be improving peloton auth dialog 2025-02-24 14:56:50 +01:00
Roberto Viola
ecb2d98ad7 fixing strava secrets on github actions 2025-02-24 14:23:43 +01:00
Roberto Viola
e88811c1fd peloton connect on the wizard 2025-02-24 08:08:34 +01:00
Roberto Viola
56c3ab74cb Peloton API Login Issues (Issue #3217)
https://github.com/cagnulein/qdomyos-zwift/issues/3217#issuecomment-2676048595
2025-02-23 18:05:57 +01:00
Roberto Viola
ae280e170a SOLE LCR Bike #3226 2025-02-22 07:08:53 +01:00
Roberto Viola
d2dfb16033 Cyclotronics Smart Trainer #3223 2025-02-21 15:58:11 +01:00
Roberto Viola
64d99748c7 Proform XBike #3214 2025-02-21 14:16:51 +01:00
Roberto Viola
16d90a010b Proform XBike #3214 2025-02-21 13:02:36 +01:00
Roberto Viola
32baab9072 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-02-21 08:25:31 +01:00
Roberto Viola
31dd125263 Peloton API Login Issues (Issue #3217) 2025-02-21 08:25:24 +01:00
Roberto Viola
483fd87ee5 Update main.cpp 2025-02-20 20:03:09 +01:00
Roberto Viola
254786ea5d Gears don't work for mid-work free ride segment (Issue #2897)
https://github.com/cagnulein/qdomyos-zwift/issues/2897#issuecomment-2671383599
2025-02-20 14:52:59 +01:00
Roberto Viola
c06a439c0c Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-02-20 11:48:20 +01:00
Roberto Viola
7b76999c0d Fixing ios bluetooth crash (#3213)
* adding files

* fixing build

* Update project.pbxproj
2025-02-20 11:48:06 +01:00
Roberto Viola
5c0190dffe Titan 7000 #3218 2025-02-20 11:47:29 +01:00
Roberto Viola
aabd2824d3 “Lydsto S1” spinning bike 2025-02-20 10:11:03 +01:00
Roberto Viola
2f7033cd6d Support device JTX Cyclo 5 (FAL-SPORTS0234) (Issue #3208) 2025-02-20 08:24:59 +01:00
Roberto Viola
756fe823f8 “Lydsto S1” spinning bike 2025-02-20 08:16:35 +01:00
Roberto Viola
ed0d163944 Proform XBike #3214 2025-02-19 15:35:29 +01:00
Roberto Viola
b7ee025a6f SPAX-BK ERG not working #3200 2025-02-19 10:44:48 +01:00
Roberto Viola
23dca8ec93 added PELOTON_SECRET_KEY on github secrets 2025-02-19 09:07:33 +01:00
Roberto Viola
fe05cb613f Peloton oauth (#2632)
* starting

* builds?

* Update peloton.cpp

* Update settings.qml

* Update peloton.cpp

* Update peloton.cpp

* trying to login

* Update peloton.cpp

* Update peloton.cpp

* Update peloton.cpp

* workout api returns always void

* fixing auth header on workout

* Update peloton.cpp

* handling new cases

* Update peloton.cpp

* Update peloton.cpp

* Update peloton.cpp

* Update qzsettings.cpp

* adding the peloton connect button

* adding popup to switch to the new api and removed credentials from the settings

* fixing peloton popup

* Update main.qml

* everything should be fine now

* added peloton button on the settings page too

* Update project.pbxproj

* new kingsmith variant treadmill

* Cannot set Virtufit Etappe 2 auto resistance (Issue #3130)

* CycleOps Phantom 5 (Issue #3004)

* Nordictrack commercial 1750 incline calibration incorrect (Issue #3118)

* Update qzsettings.cpp

* airdate and current_pedaling_duration fixed

* fixing spinups in powerzone classes

* Update project.pbxproj

* Update project.pbxproj

* getting wattage and cadence directly from the zwift hub riding data if available

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* 2.18.19

* Update project.pbxproj

* Update project.pbxproj

* Update project.pbxproj

* Update peloton.cpp

* Update project.pbxproj

* Row and Tread Target Pace Issues from 2.18.19 Update #3206
2025-02-19 09:03:02 +01:00
Roberto Viola
c56c6fe5e4 Issue with Elite Direto XR, zwift cog, zwift play, mywhoosh and zwift combo #3191 2025-02-19 08:54:03 +01:00
Roberto Viola
8f7fafa4f2 DIRETO XR limited at 600W #3193 2025-02-19 08:48:08 +01:00
Roberto Viola
ef9ca0bfc8 DIRETO XR limited at 600W #3193 2025-02-19 08:46:34 +01:00
Roberto Viola
34635114df QZ CRUSH AT CONNECTION INITIAL 100 DOMYOS (Issue #3197) 2025-02-19 08:30:07 +01:00
Roberto Viola
3e29dd63df Update proformbike.cpp 2025-02-18 21:21:15 +01:00
Roberto Viola
c575159616 Pro-Form, model PFTL99015.0 #3209 2025-02-18 16:52:35 +01:00
Roberto Viola
ddebfc7e75 Support device JTX Cyclo 5 (FAL-SPORTS0234) #3208 2025-02-18 15:47:41 +01:00
Roberto Viola
2b51e5982a Kettler tour 600 #3207 2025-02-18 14:47:36 +01:00
Roberto Viola
00b616f4f8 QZ Companion on NordicTrack T8.5S is unable to communicate with QZ Fitness #3187 2025-02-18 08:26:59 +01:00
Roberto Viola
38274e1056 QZ CRUSH AT CONNECTION INITIAL 100 DOMYOS (Issue #3197) 2025-02-18 08:16:18 +01:00
Roberto Viola
cf1397cb81 Connecting to Horizon 7.0 #3201 2025-02-17 15:25:40 +01:00
Roberto Viola
b23c1b46ab Log on Thread (#3189) 2025-02-17 15:11:21 +01:00
Roberto Viola
4750ee9214 No heart rate and negative calories when using Apple Watch & Elliptical Skandika Carbon P23 #3198 2025-02-17 12:14:33 +01:00
Roberto Viola
05b39acb3e Christopeit TM3000S treadmill 2025-02-17 10:47:42 +01:00
Roberto Viola
26d2a59ad5 QZ Connects to Merach R11 rower on iOS but no metrics/data are being captured (Issue #3190) 2025-02-17 10:22:47 +01:00
Roberto Viola
1ed382faef QZ CRUSH AT CONNECTION INITIAL 100 DOMYOS (Issue #3197) 2025-02-17 10:06:28 +01:00
Roberto Viola
ebbbd4febb Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-02-17 08:53:31 +01:00
Roberto Viola
95014c3863 No heart rate and negative calories when using Apple Watch & Elliptical Skandika Carbon P23 (Issue #3198) 2025-02-17 08:53:25 +01:00
Roberto Viola
b61f5752d2 Smart bike BH BR9110 #3192 2025-02-16 15:52:44 +01:00
Roberto Viola
4b7533d721 VANRYSEL-HT ftms bike 2025-02-16 15:49:23 +01:00
Roberto Viola
6519e9ae86 avoiding crash on tacxneo2 2025-02-16 09:21:48 +01:00
Roberto Viola
cbc3b9d292 MSVC Print Stack Trace (#3185) 2025-02-15 19:32:00 +01:00
Roberto Viola
1dde627a4c Sportstech sBike Lite 2025-02-14 17:34:16 +01:00
Roberto Viola
06727f23e4 Proform Bike PFEVEX71316.0 #3157 2025-02-14 14:30:55 +01:00
Roberto Viola
1c8279d2fc Treadmill and Power Sensor Speed Forcing (Issue #3152) 2025-02-13 10:19:24 +01:00
Roberto Viola
aa0193b41e Pafer treadmill #2985 2025-02-13 10:01:26 +01:00
Roberto Viola
fcf6a8b586 fixing 0 metrics to apple watch to ipad bridge 2025-02-13 08:55:33 +01:00
Roberto Viola
574c51bcec Does it support Crosstrainer Skandika Carbon P23? #3175 2025-02-13 08:03:07 +01:00
Roberto Viola
01fa8602a0 Trying to fix android crash 2025-02-12 20:44:19 +01:00
Roberto Viola
b006e8cc2b Update proformbike.cpp 2025-02-12 13:36:20 +01:00
Roberto Viola
e8486364a3 adding help to CLI 2025-02-12 12:15:02 +01:00
sirfergy
f72b6b04ce Enable setting power sensor via command line (#3106)
* Enable setting power sensor via command line

* Remove weird whitespace

* Update main.cpp

---------

Co-authored-by: Roberto Viola <Cagnulein@gmail.com>
2025-02-12 12:05:17 +01:00
Roberto Viola
1152b4d9b2 Proform Bike PFEVEX71316.0 #3157 2025-02-12 09:46:29 +01:00
Roberto Viola
219c4e2491 Treadmill and Power Sensor Speed Forcing (Issue #3152) 2025-02-12 08:39:41 +01:00
Roberto Viola
47d78f4464 Yesoul Treadmill support #3174 2025-02-12 08:33:12 +01:00
Roberto Viola
bebfd03ae9 Treadmill and Power Sensor Speed Forcing (Issue #3152) 2025-02-11 15:20:31 +01:00
Roberto Viola
0bf98491cb getting wattage and cadence directly from the zwift hub riding data if available 2025-02-11 15:05:28 +01:00
Roberto Viola
63e4c627b3 Proform Bike PFEVEX71316.0 #3157 2025-02-11 14:54:49 +01:00
Roberto Viola
a37e3c8287 getting wattage and cadence directly from the zwift hub riding data if available 2025-02-11 09:09:27 +00:00
Roberto Viola
45ab560d08 adding more info about upload on strava failed 2025-02-11 09:01:12 +01:00
Roberto Viola
3d1846cbe8 Proform Bike PFEVEX71316.0 #3157 2025-02-11 08:52:18 +01:00
Roberto Viola
936bbe2372 Treadmill and Power Sensor Speed Forcing #3152 2025-02-10 17:09:33 +01:00
Tomáš Janoušek
963a3fbb97 skillbike: allow 3-digit bikes (#3165)
My TechnoGym Skillbike is called "BIKE 861" and QZ wouldn't detect it
previously because it assumed all such bikes have 4-digit names.

The fix is to relax requirement and detect any /BIKE \d+/ as
technogymBike.
2025-02-10 16:39:28 +01:00
Roberto Viola
b4161da81a Run Elevation Written By Zwift Elevation Data Instead Of Treadmill Data #3160 2025-02-10 16:33:58 +01:00
Roberto Viola
be65d915e3 Proform Bike PFEVEX71316.0 #3157 2025-02-10 10:08:00 +01:00
Roberto Viola
22fb9df723 Treadmill and Power Sensor Usage #3152 2025-02-10 09:28:28 +01:00
Roberto Viola
8709f81b16 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-02-09 18:28:46 +01:00
Roberto Viola
347ede62b2 adding debug on the ipad bridge 2025-02-09 18:28:25 +01:00
Roberto Viola
c4a913d317 Yoroto rower 2025-02-09 15:42:56 +01:00
Roberto Viola
1706fde7ab No power when pedalling with Van Rysel D500 turbo trainer. #3065 (#3083) 2025-02-08 17:54:21 +01:00
Roberto Viola
60e8d37624 fixing-raspberry-64bit-segfault-build (#3084)
* Update main.yml

* Update main.yml

* Update main.yml

https://github.com/docker/setup-qemu-action/issues/188

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml
2025-02-08 11:33:05 +01:00
Roberto Viola
519bc38fb6 sole f85 doesn't handle 0.5 inclination step 2025-02-07 21:22:08 +01:00
Roberto Viola
375d223f66 fixed domyos bike settings 2025-02-07 20:37:33 +01:00
Roberto Viola
f16e0649cb added a setting to enable the ignore ftms setting for domyos bikes 2025-02-07 18:47:47 +01:00
Roberto Viola
9e685cde37 Proform Bike PFEVEX71316.0 #3157 2025-02-07 10:31:48 +01:00
Roberto Viola
d32d7cd802 Rouvy: Virtual shifting with Zwift gearing, noticeably harder than physical gearing #3031
https://github.com/cagnulein/qdomyos-zwift/issues/3031#issuecomment-2642230942
2025-02-07 09:24:29 +01:00
Roberto Viola
8961ca860a adding preset buttons for power zones 2025-02-06 09:55:07 +01:00
Roberto Viola
9a3fa7c82f fix crash on iOS 2025-02-05 15:44:46 +01:00
Roberto Viola
183f36bf40 Polar OH1 not connecting consistently with Android tablet / Qdomyos-swift app #3139 (#3144) 2025-02-05 13:08:23 +01:00
Roberto Viola
bac91d14c6 YESOUL G1M Max bike #3149 2025-02-05 10:27:09 +01:00
Roberto Viola
7455729225 Elite Drivo II 2025-02-05 08:56:44 +01:00
Roberto Viola
223b6b7a0e manually adjusting the resistance, incorrect behavior! (Issue #3145) 2025-02-04 16:35:47 +01:00
Roberto Viola
825555a34f Upload Strava from WIndows crash (#3143)
* Update homeform.cpp

* aggiunta /RTC1

* Update qdomyos-zwift.pri
2025-02-04 12:47:28 +01:00
Roberto Viola
aeead83510 Nordictrack commercial 1750 incline calibration incorrect (Issue #3118) 2025-02-04 08:34:25 +00:00
Roberto Viola
78a8981006 CycleOps Phantom 5 (Issue #3004) 2025-02-04 07:29:54 +00:00
Roberto Viola
e9bb6bc73b Cannot set Virtufit Etappe 2 auto resistance (Issue #3130) 2025-02-04 07:23:49 +00:00
Roberto Viola
d2354074f8 new kingsmith variant treadmill 2025-02-04 07:21:02 +00:00
Roberto Viola
78ee43cb7d commenting 64bit build image for now 2025-02-03 08:37:11 +01:00
Roberto Viola
952fc914fb QZ crushes right after connection to MERACH S01 (Issue #3136) 2025-02-03 08:35:01 +01:00
Roberto Viola
bc54203cdf Elito Avanti added 2025-02-02 16:01:53 +01:00
Gerd Naschenweng
854846585a Update 10_Installation.md (#3129) 2025-02-01 09:38:38 +01:00
Roberto Viola
309bfb623b preparing for #2632 2025-01-31 16:35:31 +01:00
Roberto Viola
9a99740701 BT Log share for LifeSpan-TM-2000 #3021 2025-01-31 10:47:54 +01:00
Roberto Viola
1f299a1ff1 BT Log share for LifeSpan-TM-2000 #3021 2025-01-31 10:33:52 +01:00
Roberto Viola
8bce3d0541 version 2.18.18 2025-01-31 09:36:34 +01:00
Roberto Viola
06d033d13c adding debug to connection to apple watch 2025-01-31 07:41:05 +01:00
Roberto Viola
654b070c7e Update ftmsbike.cpp
clean time in case for a long period we don't receive values
2025-01-30 16:04:27 +01:00
Roberto Viola
a159c8f072 Technogym Elliptical #3121 2025-01-30 14:54:52 +01:00
Roberto Viola
3846d974af Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) (Issue #2992) 2025-01-30 11:27:09 +01:00
Roberto Viola
7e5fcfb881 adding some logs on the homeform update to understand the lag on some androids 2025-01-30 10:46:54 +01:00
Roberto Viola
4e9cafcd5e Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-01-29 21:18:13 +01:00
Roberto Viola
15f4fc51ce adding watchos symbols 2025-01-29 21:17:55 +01:00
Roberto Viola
d343c1c98c Tacx Neo 3M #3062 2025-01-29 11:34:23 +01:00
Roberto Viola
4a17a8474a CycleOps Phantom 5 #3004 2025-01-29 06:40:31 +01:00
Roberto Viola
2bb1ff0b09 BT Log share for LifeSpan-TM-2000 #3021 2025-01-28 16:39:21 +01:00
Roberto Viola
dec5bd6603 Update bluetooth.cpp 2025-01-28 16:00:18 +01:00
Roberto Viola
282f01b55d Possible bug with NT C2950 IP UDP metrics? (Issue #3079) 2025-01-28 14:42:03 +01:00
Roberto Viola
349be00771 BT Log share for LifeSpan-TM-2000 (Issue #3021) 2025-01-28 11:06:45 +01:00
Roberto Viola
adc47fd19c Update project.pbxproj 2025-01-28 08:45:09 +01:00
Roberto Viola
e876ef97cd CycleOps Phantom 5 #3004 2025-01-28 08:36:28 +01:00
Roberto Viola
903409d962 Senator iPlus treadmill (Issue #3114) 2025-01-28 08:28:08 +01:00
Roberto Viola
9295554195 Tunturi E60 Signature bike #3115 2025-01-28 08:25:59 +01:00
Roberto Viola
8d6cfe03ac Virtufit etappe setting restored 2025-01-27 20:30:42 +01:00
Roberto Viola
70d5051a6f Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-01-26 16:42:36 +01:00
Roberto Viola
124e4ec561 adding in also on WIN32 on qfit 2025-01-26 16:42:34 +01:00
Roberto Viola
036db83321 Fixing crash on windows about fit file writing (#3095)
* Update qfit.cpp

* Update qfit.cpp
2025-01-26 06:15:48 +01:00
Roberto Viola
23dfa67fe5 On iOS devices, the Domyos elliptical bike reads astronomical values above 11km/h. (Issue #3099) 2025-01-25 20:12:09 +01:00
Roberto Viola
79d7a09203 Technogym Skillrun #3097 2025-01-25 14:59:59 +01:00
Roberto Viola
96d9fb485b Create qdomyos-zwift.code-workspace 2025-01-24 13:30:52 +01:00
Roberto Viola
68c4d954ef Create launch.json 2025-01-24 13:28:49 +01:00
Roberto Viola
ef7bedacb8 adding the pdb to win msvc 2025-01-24 12:33:30 +01:00
Roberto Viola
e7a1373305 Update proformtreadmill.cpp 2025-01-24 10:58:28 +01:00
Roberto Viola
cfd06df25e Solution to get Octane Zero Runner ZR8 Elliptical working with Zwift #1338 2025-01-24 08:28:56 +01:00
Roberto Viola
89bc6d0529 Support for Proform 705 CST treadmill (Issue #3072) 2025-01-23 14:49:34 +01:00
Roberto Viola
0446000270 BT Log share for LifeSpan-TM-2000 (Issue #3021) 2025-01-23 14:09:30 +01:00
Roberto Viola
9908e8ca98 Update project.pbxproj 2025-01-23 09:23:11 +01:00
Roberto Viola
326f09c903 BT Log share for LifeSpan-TM-2000 (Issue #3021) 2025-01-22 17:00:07 +01:00
Roberto Viola
2b52206795 improving training effect on garmin
https://github.com/dvmarinoff/Auuki/issues/231#issuecomment-2606479981
2025-01-22 12:07:46 +01:00
Roberto Viola
4cadcddac1 Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) #2992 2025-01-22 11:52:55 +01:00
Roberto Viola
8910b8bf28 Update main.yml 2025-01-22 10:58:07 +01:00
Roberto Viola
fc3287758e Please add Treadmill: LifeSmart TM4500 #3074 2025-01-22 09:30:36 +01:00
Roberto Viola
c94a03bb23 Update main.yml 2025-01-22 09:24:55 +01:00
Roberto Viola
2c5ba21b99 Update main.yml 2025-01-21 14:14:15 +01:00
Roberto Viola
4f00550400 Update cycleopsphantombike.cpp 2025-01-21 10:56:47 +01:00
Roberto Viola
dfd622c948 Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) #2992 2025-01-21 08:39:57 +01:00
Roberto Viola
a7d66727f3 Update project.pbxproj 2025-01-20 15:19:39 +01:00
Roberto Viola
06a5c412bd XT385: giving the possibility to use FTMS 2025-01-20 15:14:22 +01:00
Roberto Viola
0a3616ec0e Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) (Issue #2992) 2025-01-20 09:50:08 +01:00
Roberto Viola
b4226306b0 Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2025-01-20 09:21:14 +01:00
Roberto Viola
4f3353303a Tacx Neo 3M #3062 2025-01-19 16:31:05 +01:00
Roberto Viola
81b832071a Recent compile on master broadcasts device on RaspberryPI as "Pixel 6a" (Issue #3063) 2025-01-19 10:51:49 +01:00
Roberto Viola
d1966df73c Tacx Neo 3m #3062 2025-01-18 21:03:12 +01:00
Roberto Viola
e194291efb Lifespan Fitness SM-720i #3061 2025-01-18 16:23:14 +01:00
Roberto Viola
af88f6cd0d Update project.pbxproj 2025-01-18 08:24:55 +01:00
Roberto Viola
62838da761 Update cycleopsphantombike.cpp 2025-01-18 08:18:58 +01:00
David Mason
7236608f59 Tests for Cyclops Phantom and Pitpat Bikes (#3056) 2025-01-18 08:01:36 +01:00
David Mason
2570f2843c Test timeout exploration (#3048) 2025-01-18 08:00:53 +01:00
Roberto Viola
a9fe9bebaf Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2025-01-17 13:57:21 +01:00
Roberto Viola
15a7c3abd0 BT Log share for LifeSpan-TM-2000 #3021 2025-01-17 13:57:15 +01:00
Roberto Viola
7872950f65 Update project.pbxproj 2025-01-17 12:00:59 +01:00
Roberto Viola
4a711368e3 Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) (Issue #2992) 2025-01-17 11:51:45 +01:00
Roberto Viola
fbcc7e4478 BT Log share for LifeSpan-TM-2000 #3021 2025-01-17 09:12:03 +01:00
Roberto Viola
e23af2e5f5 Windows: FIT FILE Save Issue (#3053)
* trying fix

* useless?

* temp file?

* Update qfit.cpp

* Update qfit.cpp

* Revert "trying fix"

This reverts commit 82c752d26f.

* Update qfit.cpp
2025-01-16 10:24:42 +01:00
Roberto Viola
9c6fed4d48 Update project.pbxproj 2025-01-15 22:50:03 +01:00
Roberto Viola
26ac25d3ba Read cadence from Garmin when in -run-cadence-sensor mode for FTMS treadmills (Issue #3042) 2025-01-15 22:49:04 +01:00
Roberto Viola
19beae66bb Update project.pbxproj 2025-01-15 08:38:09 +01:00
Roberto Viola
037f660825 Virtual shifting overshoots/undershoots target resistance, then bounces to expected resistance (Issue #3051) #3031 2025-01-15 08:08:52 +01:00
Roberto Viola
47e719bff0 Commenting temporary Linux tests 2025-01-15 06:25:05 +01:00
Roberto Viola
020f30d8df Option to swap the virtual gear shift buttons in the UI #3049 2025-01-14 13:01:34 +01:00
Roberto Viola
7078508ba9 2.18.17 2025-01-14 10:42:30 +01:00
Roberto Viola
eb002332ed Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2025-01-14 10:28:46 +01:00
Roberto Viola
ea1da07e71 Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2025-01-14 10:06:14 +01:00
Roberto Viola
e1d32cd747 Profiles can't be selected (Issue #3045) 2025-01-14 08:20:42 +01:00
Roberto Viola
1bb3450512 2.18.16 2025-01-13 14:22:55 +01:00
Roberto Viola
ce1a78156e QZ iOS beta app closes and shuts down (Issue #3013) 2025-01-13 11:23:14 +01:00
Roberto Viola
9d95e52d12 Garmin discovers but can't connect to cadence sensor (Issue #3023) (#3038) 2025-01-12 19:40:29 +01:00
Roberto Viola
73c072583a fixing build 2025-01-12 18:12:25 +01:00
Roberto Viola
253e2b7eab Update project.pbxproj 2025-01-12 18:07:38 +01:00
Roberto Viola
650c6de692 Rouvy: Virtual shifting with Zwift gearing, noticeably harder than physical gearing (Issue #3031) 2025-01-12 18:04:51 +01:00
Roberto Viola
1ac4e20efb Update project.pbxproj 2025-01-12 17:58:11 +01:00
Roberto Viola
f08ea4346e BT Log share for LifeSpan-TM-2000 #3021 2025-01-12 16:13:14 +01:00
Roberto Viola
c206886639 BT Log share for LifeSpan-TM-2000 (Issue #3021) 2025-01-12 16:11:25 +01:00
Roberto Viola
61bf953b1a Update project.pbxproj 2025-01-12 14:55:14 +01:00
Roberto Viola
1dcd35e825 Watts Stuck at Max…not going down to 0 (Issue #3025) 2025-01-12 14:46:13 +01:00
Roberto Viola
5a7bb8b103 Horizon cycle 7.0IC-02 no resistance adjustment in Kinomap via QZ app #3035 2025-01-12 14:43:40 +01:00
Roberto Viola
c4be4f068f fixing virtual device menu not loaded 2025-01-12 14:42:23 +01:00
Roberto Viola
4534c334bc Create build-qrc-qml.sh 2025-01-12 09:07:08 +01:00
Roberto Viola
9fa6d6d8b1 auto set speed to 3km/h when using auto inclination (Issue #3034) 2025-01-11 19:24:47 +01:00
sirfergy
a5b34161c1 Missed a character! (#3027) 2025-01-10 22:41:53 +01:00
sirfergy
bf2c6929e1 Add two options to set horizon treadmill settings (#3026) 2025-01-10 21:35:49 +01:00
Roberto Viola
2a451c3120 Proform Trainer 8.0 No Bluetooth control (Issue #3017) 2025-01-10 19:30:22 +01:00
Roberto Viola
1169714908 Resistance scaling kickr core 4303 (Peloton App) (Issue #3020) 2025-01-10 19:03:35 +01:00
Roberto Viola
14de4e4760 Proform Trainer 8.0 No Bluetooth control (Issue #3017) 2025-01-10 13:47:12 +01:00
Roberto Viola
712f527ce0 Update project.pbxproj 2025-01-09 12:40:56 +01:00
Roberto Viola
0631c64ba5 Update bluetooth.cpp 2025-01-09 12:37:32 +01:00
Roberto Viola
85c43db53e cscbike: speed based on power setting enable 2025-01-09 12:37:03 +01:00
Roberto Viola
8394bf3f19 Yesoul v1 FMTS bike #2186 2025-01-09 12:21:37 +01:00
Roberto Viola
bd1f25f016 2.18.15 2025-01-08 14:25:13 +01:00
Roberto Viola
95f340063a Cant control ProForm 505 CST through QZ app or Zwift #3005 2025-01-08 11:11:37 +01:00
Roberto Viola
2be1d82e8d Update project.pbxproj 2025-01-08 09:58:16 +01:00
Roberto Viola
501af18298 CycleOps Phantom 5 #3004 2025-01-08 08:30:25 +01:00
Roberto Viola
724292bd34 Hammer Speed Race X resistance change not working correctly #3002 2025-01-08 08:10:27 +01:00
Roberto Viola
cbbdebdf84 Inclination stops updating in app after about 30 minutes (but treadmill adjustment still works) #2992 2025-01-08 08:01:13 +01:00
Roberto Viola
02c17dcf55 starting CycleOps Phantom 5 #3004 2025-01-07 17:41:22 +01:00
Roberto Viola
23d1f9d8c0 No data from Domyos Training Bike 900 #2973 2025-01-07 15:03:26 +01:00
Roberto Viola
f4e0d3596d Horizon 5.0 Bike Compatibility #3001 2025-01-07 11:20:25 +01:00
Roberto Viola
3b012bc946 Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2025-01-07 09:21:23 +01:00
Roberto Viola
33a5a2c80f Horizon 5.0 Bike Compatibility #3001 2025-01-07 09:06:53 +01:00
Roberto Viola
e8b481d517 S22i connects and reports info to QZ, but Auto-Resistance is not being controlled by QZ App (Issue #2909) 2025-01-05 09:21:19 +01:00
Roberto Viola
dcfa58b3a9 Horizon 5.0u bike #2984 2025-01-04 20:04:24 +01:00
Roberto Viola
fd4106cf00 No data from Domyos Training Bike 900 #2973 2025-01-04 05:43:31 +01:00
Roberto Viola
87dddac5f4 added garmin_bluetooth_compatibility for treadmills 2025-01-04 05:26:51 +01:00
Roberto Viola
5488af7e35 DeerRun S500 Bike Integration #2932 2025-01-02 14:48:03 +01:00
Roberto Viola
0a3bd56f15 Care Fitness Rowing no data in QZ (Issue #2874) 2025-01-02 14:37:21 +01:00
Roberto Viola
a5ae8f994b Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2025-01-02 14:32:12 +01:00
Roberto Viola
6a0b3e7fc4 DeerRun S500 Bike Integration #2932 2025-01-01 14:32:15 +01:00
Gerd Naschenweng
a7620c38d0 Included QZ service monitoring (#2960) 2024-12-30 11:23:09 +01:00
Roberto Viola
0060e316dc Update project.pbxproj 2024-12-29 10:59:31 +01:00
Roberto Viola
b71321f301 Treadmill Live Charts #2955 2024-12-29 10:57:20 +01:00
Roberto Viola
c99ef80d78 Speed up Settings page (#2951)
* it works, but i need to check all the accordionelement

* fixing layouts

* Update settings.qml
2024-12-28 22:17:49 +01:00
Roberto Viola
2adf3fe27b SwitchDeletages in the settings now are changing only if the user clicks on the indicator (ios default behaviour) 2024-12-28 18:51:24 +01:00
Roberto Viola
ade033eb59 Tactile Feedback for Zwift Play controllers (and Ride?) #2752 2024-12-28 18:22:11 +01:00
Roberto Viola
42666cf1e9 Update project.pbxproj 2024-12-28 14:39:17 +01:00
Roberto Viola
530f11f67c Tactile Feedback for Zwift Play controllers (and Ride?) (Issue #2752) 2024-12-28 13:48:57 +01:00
Roberto Viola
0391db60aa Raspberry kickr run (#2941) 2024-12-28 13:03:57 +01:00
Roberto Viola
486c90a112 Tactile Feedback for Zwift Play controllers (and Ride?) (Issue #2752) (#2753)
* Tactile Feedback for Zwift Play controllers (and Ride?) (Issue #2752)

* it works!

* vibrate on the right controller
2024-12-28 11:45:13 +01:00
Roberto Viola
d1767797d7 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2024-12-27 17:41:25 +01:00
Roberto Viola
fbe03d23f3 Smart Trainer Magene T200 #2947 2024-12-27 17:39:53 +01:00
Roberto Viola
361280c131 Issue with QZ 2.18 (982) and Zwift Play in SIM Mode (Issue #2944) 2024-12-27 17:35:43 +01:00
Roberto Viola
04e0fc6e7c Update README.md 2024-12-27 14:25:24 +01:00
Roberto Viola
ab52eee127 Issue with QZ 2.18 (982) and Zwift Play in SIM Mode #2944 2024-12-27 13:50:15 +01:00
Roberto Viola
94825252f7 Proform 1500 Pro Treadmill #2943 2024-12-27 10:23:14 +01:00
Roberto Viola
93f13817be Proform 1500 Pro Treadmill #2943 2024-12-27 10:14:41 +01:00
Roberto Viola
739ea4e841 Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541) 2024-12-26 14:44:12 +01:00
Roberto Viola
fe3ad9ffb4 Open Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2024-12-26 14:25:58 +01:00
Roberto Viola
8fce809ee9 Update project.pbxproj 2024-12-26 14:10:21 +01:00
Roberto Viola
c156cbff99 DeerRun S500 Bike Integration (Issue #2932) 2024-12-26 14:01:39 +01:00
Roberto Viola
268be8e0f5 Delay in Strava Upload and Treadmill Pace Coloring Off #2933 2024-12-26 13:11:32 +01:00
Roberto Viola
5581e1c0e1 Update project.pbxproj 2024-12-25 11:19:23 +01:00
Roberto Viola
7fea2d442f Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541) 2024-12-25 11:17:52 +01:00
Roberto Viola
74276764a6 2.18.12 2024-12-25 10:45:10 +01:00
Roberto Viola
a3e54782bb Peloton Treadmill Pace Levels #2469 2024-12-25 10:41:11 +01:00
Roberto Viola
b7bc80b2a3 Update project.pbxproj 2024-12-25 10:34:45 +01:00
Roberto Viola
b869a41f3d fixing build 2024-12-25 10:28:52 +01:00
Roberto Viola
9c7954945f Update kineticinroadbike.cpp 2024-12-24 12:30:50 +01:00
Roberto Viola
13cd666718 fixing msvc 2024-12-24 12:23:59 +01:00
Roberto Viola
c3e627e85b Update SmartControl.cpp 2024-12-24 12:02:13 +01:00
Roberto Viola
f23c24ae9b fixing build 2024-12-24 11:53:47 +01:00
Roberto Viola
d27da35beb fixing build 2024-12-24 11:49:40 +01:00
Roberto Viola
6457b205e4 fixing build 2024-12-24 11:42:56 +01:00
Roberto Viola
bea7b61dcc adding the original kineticinroad bike sdk 2024-12-24 11:16:38 +01:00
Roberto Viola
2cc8d51a6c Update project.pbxproj 2024-12-24 10:19:26 +01:00
Roberto Viola
5410b806bb Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541) 2024-12-24 10:16:15 +01:00
Roberto Viola
b937d8bd71 Pooboo Bike #2935 2024-12-24 09:50:50 +01:00
Roberto Viola
cd25cfab8e 2.18.11 2024-12-23 18:54:53 +01:00
Roberto Viola
229e6ad461 Fixing build 2024-12-23 11:02:33 +01:00
Roberto Viola
977cae1cbd Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541) 2024-12-23 10:09:49 +01:00
Roberto Viola
c8a9be2ca6 Revert "using variables instead of timer"
This reverts commit 445646fe02.
2024-12-23 10:04:05 +01:00
Roberto Viola
c3acf82a9b Revert "everal Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541)"
This reverts commit ddfc60bbf5.
2024-12-23 10:03:57 +01:00
Roberto Viola
ddfc60bbf5 everal Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541)
https://github.com/cagnulein/qdomyos-zwift/issues/2541#issuecomment-2557707654
2024-12-21 16:24:52 +01:00
Roberto Viola
445646fe02 using variables instead of timer
Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541)
2024-12-21 16:09:48 +01:00
Roberto Viola
3dd3c8fb40 Update project.pbxproj 2024-12-21 16:00:45 +01:00
Roberto Viola
fb390b3618 Revert "Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541)"
This reverts commit f6f9a95f06.
2024-12-21 15:12:59 +01:00
Roberto Viola
ca5fb75f3a Revert "handling ERG mode for VFSPINBIKE"
This reverts commit e881ce5f0f.
2024-12-20 14:30:26 +01:00
Roberto Viola
e881ce5f0f handling ERG mode for VFSPINBIKE 2024-12-20 12:21:22 +01:00
Roberto Viola
8002e47551 VFSPINBIKE model workaround for ERG mode started 2024-12-20 08:43:53 +01:00
Roberto Viola
5b66b5705d Support for iConsole based rowing machines, e.g. the "Baltic Rower Pro" (Issue #2901) 2024-12-19 15:17:43 +01:00
Roberto Viola
d1c5521d2a setting to disable the treadmill tag to have the inclination on strava 2024-12-19 10:14:29 +01:00
Roberto Viola
74151edfb3 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2024-12-19 10:00:10 +01:00
Roberto Viola
00f6747d7d Toputure TP1 treadmill #2918 2024-12-19 10:00:05 +01:00
Roberto Viola
0101955ad3 updating usb serial for android
first build on mac pro for android
2024-12-19 09:58:34 +01:00
Roberto Viola
f6f9a95f06 Several Issues Using QZ with Rouvy and Zwift Play Controllers (Issue #2541)
https://github.com/cagnulein/qdomyos-zwift/issues/2541#issuecomment-2551961488
2024-12-18 21:39:29 +01:00
Roberto Viola
3d82b89db0 Sole S77 Support #1283 2024-12-18 21:04:54 +01:00
Roberto Viola
8c7b549a45 Sole S77 Support #1283 2024-12-18 19:02:56 +01:00
Roberto Viola
3ad4dc1cfe Sole S77 Support #1283 2024-12-18 18:59:42 +01:00
Roberto Viola
7524314f74 version 2.18.10 2024-12-18 15:17:29 +01:00
Roberto Viola
94545e8958 Update project.pbxproj 2024-12-18 15:15:29 +01:00
Roberto Viola
2c74b2d2e2 nextrow for power training
https://github.com/cagnulein/qdomyos-zwift/issues/2915#issuecomment-2551377819
2024-12-18 14:59:01 +01:00
Roberto Viola
108c190254 S22i connects and reports info to QZ, but Auto-Resistance is not being controlled by QZ App (Issue #2909) 2024-12-18 14:55:26 +01:00
Roberto Viola
466209307e heart rate and wahoo kickr fan toast when connected 2024-12-18 14:34:33 +01:00
Roberto Viola
acccba59dc fixed overlapping lines in the nextrow
https://github.com/cagnulein/qdomyos-zwift/issues/2915#issuecomment-2551013411
2024-12-18 12:12:07 +01:00
Roberto Viola
9325e2f9d1 handling distance for next rows
https://github.com/cagnulein/qdomyos-zwift/issues/2915#issuecomment-2550839841
2024-12-18 10:42:48 +01:00
Roberto Viola
36ebff2667 handling repeat tag in the xml
tunturi t90 inclination not working
#2915
2024-12-18 10:04:26 +01:00
Roberto Viola
6d0d08b5fb OSC: Open Sound Control (#2449)
* starting

* hardcoding ip

* adding fields

* adding setting

* added /QZ/Resistance on write

* finalizing!

* Update osc.cpp

* Update homeform.h

* Update osc.h

* fixing settings

* port added

* Update osc.cpp
2024-12-18 08:41:27 +01:00
Roberto Viola
e695a1e291 tunturi t90 inclination not working #2915 2024-12-17 19:00:59 +01:00
Roberto Viola
133488221b Update kineticinroadbike.cpp 2024-12-17 09:48:57 +01:00
Roberto Viola
b186b672ea kineticinroadbike 2024-12-14 14:04:19 +01:00
Roberto Viola
2badef3daf YPOO-mini pro treadmill #2905 2024-12-14 09:11:27 +01:00
Roberto Viola
f8700296fb Update kineticinroadbike.cpp 2024-12-13 21:32:41 +01:00
Roberto Viola
0f79fb56c7 Peloton Treadmill Pace Levels #2469 2024-12-13 20:44:22 +01:00
Roberto Viola
d8412c95d4 only if a resistance value is greater than 0 will set the resistance received in the ftms bike 2024-12-13 17:23:44 +01:00
Roberto Viola
469c239eed typo on the settings 2024-12-13 17:12:56 +01:00
Roberto Viola
7fad542553 YPOO-mini pro treadmill #2905 2024-12-13 15:21:03 +01:00
Roberto Viola
d0c0aeab84 Update project.pbxproj 2024-12-13 14:55:01 +01:00
Roberto Viola
9fd7123649 Peloton Treadmill Pace Levels #2469 2024-12-13 14:28:32 +01:00
Roberto Viola
5b922043ec YPOO-mini pro treadmill #2905 2024-12-13 13:36:09 +01:00
Roberto Viola
2953589ece fixing build 2024-12-13 12:02:39 +01:00
Roberto Viola
5836990903 Update kineticinroadbike.cpp 2024-12-13 10:44:50 +01:00
Roberto Viola
acd7e24382 kinetic inroad bike
https://github.com/kinetic-fit/kinetic-sdk-java/blob/master/com/kinetic/sdk/inride/InRide.java
2024-12-13 10:11:57 +01:00
Roberto Viola
71827e0546 Update project.pbxproj 2024-12-11 12:11:44 +01:00
Roberto Viola
7e8139e5a5 Treadmill incline multiplied on QZ output [BUG] #2511
ProAction Nydo (BH Fitness) threadmill doesent incline
2024-12-11 09:54:26 +01:00
Roberto Viola
20d2b6ec9e Zycle ZPro #2899 2024-12-11 09:30:32 +01:00
Roberto Viola
be7d0e58a7 Care Fitness Rowing no data in QZ (Issue #2874) 2024-12-11 08:49:23 +01:00
nix155
f20c449279 Fixed VNC server functionality (#2898)
Co-authored-by: Andrey Zotov <azotov@teko.io>
2024-12-10 17:04:08 +01:00
Roberto Viola
bf059715ec Care Fitness Rowing no data in QZ (Issue #2874) 2024-12-10 11:17:53 +01:00
Roberto Viola
98cd3f22a2 unable to connect to NordicTrack 7i #2838 2024-12-09 10:32:51 +01:00
Roberto Viola
bad290d104 Data fields not updating Trojan Pro Spin Bike 2.0, iConsole #2884 2024-12-09 10:24:04 +01:00
Roberto Viola
3c55d025ce Update ftmsbike.cpp (#2888) 2024-12-09 07:32:03 +01:00
nix155
5c775ac5b4 Added build with qtwebglplugin (#2879)
Co-authored-by: Andrey Zotov <azotov@teko.io>
2024-12-05 12:26:56 +01:00
Roberto Viola
9295aa58a7 Care Fitness Rowing no data in QZ #2874 2024-12-05 12:20:58 +01:00
Roberto Viola
96d68bbd39 Update project.pbxproj 2024-12-05 10:29:00 +01:00
Roberto Viola
7ddb6bc1ca Bowflex T9 Not Starting When Connected #2866 2024-12-05 08:56:24 +01:00
Roberto Viola
a0145793a2 Question about treadmill powerzones (Discussion #2873) 2024-12-04 15:45:16 +01:00
Roberto Viola
ecb37d67cc Revert "Question about treadmill powerzones (Discussion #2873)"
This reverts commit 3ae203d7ad.
2024-12-04 14:33:31 +01:00
Roberto Viola
969476f368 Merge branch 'master' of https://github.com/cagnulein/qdomyos-zwift 2024-12-04 13:32:17 +01:00
Roberto Viola
3ae203d7ad Question about treadmill powerzones (Discussion #2873) 2024-12-04 13:32:12 +01:00
Roberto Viola
e979b5aebe Update project.pbxproj 2024-12-04 09:01:46 +01:00
Roberto Viola
d568bccc28 Bowflex T9 Not Starting When Connected #2866 2024-12-04 08:59:51 +01:00
nix155
301429182d Added multi-stage build, unnecessary files removed from the image (#2870) 2024-12-04 06:39:18 +01:00
nix155
8df78b9387 Added files for building and running in Docker with GUI (#2868)
Co-authored-by: Andrey Zotov <azotov@teko.io>
2024-12-03 18:19:55 +01:00
Roberto Viola
ba57309bcd Bowflex T9 Not Starting When Connected #2866 2024-12-03 18:12:54 +01:00
Roberto Viola
8d573b3ee6 Incline from GPX will be rounded to inclination step
Fitness Master T25 incline doesn't work [BUG] #2820
2024-12-03 17:09:23 +01:00
Marcel
ba43ba8c21 Add Life Fitness 95 CSAFE Ellipical (#2863)
* Add Life Fitness 95 CSAFE Ellipical

* Change bautrate type

* Fix data baudrate once more

* alternative way of setting level

* fix windows serial

* fix u_int16_t

* reorder header files

* Fix header setup

* multiple command refresh

* increment allSettingsCount

* Fix android build

* update kalman filter parameters

* formatting fixes

* More formatting fixes

* add setting version
2024-12-03 14:48:28 +01:00
Roberto Viola
47a3c24b03 2.18.9 2024-12-03 14:23:06 +01:00
Roberto Viola
40579fd376 improving safety on mediabuttonreceiver 2024-12-03 14:22:11 +01:00
Roberto Viola
bb17c1cc1a Inclination Gain implementation in QZ for Elite Suito/Rouvy #2850 (#2858) 2024-12-03 11:21:51 +01:00
Roberto Viola
1cc8862a04 proform carbon TL PFTL59722c.0 (Issue #2806) 2024-12-03 10:32:23 +01:00
Roberto Viola
ff4606caa4 Yosuda RC-Max #2861 2024-12-03 08:58:37 +01:00
Roberto Viola
aff12a0462 Bowflex T9 #2860 2024-12-03 08:56:55 +01:00
Roberto Viola
3c5054acbd App not displaying metrics #2835 2024-12-02 14:37:18 +01:00
Roberto Viola
9a854f7810 Buggy behaviour on Raspberry pi 4 and Zwift #2810 2024-12-02 11:39:04 +01:00
Roberto Viola
1e731f7cbe Zwo warmup not fully elapsed in terms of time in running workouts #2847 2024-12-02 08:36:23 +01:00
745 changed files with 73179 additions and 13228 deletions

File diff suppressed because it is too large Load Diff

3
.gitignore vendored
View File

@@ -1,3 +1,5 @@
src/qdomyos-zwift.pro.user
.idea/
src/Makefile
@@ -50,3 +52,4 @@ src/inner_templates/googlemaps/cesium-key.js
.vscode/settings.json
/tst/Devices/.vs
src/inner_templates/googlemaps/cesium-key.js
src/qdomyos-zwift.pro.user.49de507

2
.gitmodules vendored
View File

@@ -12,7 +12,7 @@
[submodule "tst/googletest"]
path = tst/googletest
url = https://github.com/google/googletest.git
branch = tags/release-1.12.1
tag = release-1.12.1
[submodule "src/qthttpserver"]
path = src/qthttpserver
url = https://github.com/qt-labs/qthttpserver

16
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "C://Users//violarob//Downloads//windows-msvc2019-binary-no-python (1)//output/qdomyos-zwift.exe",
"symbolSearchPath": "C://Users//violarob//Downloads//windows-msvc2019-binary-no-python (1)//output/qdomyos-zwift.pdb",
"sourceFileMap": {
"d:/a/qdomyos-zwift/qdomyos-zwift": "c:/work/qdomyos-zwift/",
"compiled_source_path": "C://Users//violarob//Downloads//windows-msvc2019-binary-no-python (1)//output/"
}
}
]
}

374
CLAUDE.md Normal file
View File

@@ -0,0 +1,374 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
QDomyos-Zwift is a Qt-based application that bridges fitness equipment (treadmills, bikes, ellipticals, rowers) with virtual training platforms like Zwift. It acts as a Bluetooth intermediary, connecting physical equipment to fitness apps while providing enhanced features like Peloton integration, power zone training, and workout programs.
## Build System & Commands
### Build Commands
```bash
# Build entire project (use subdirs TEMPLATE)
qmake
make
# Build specific configurations
qmake -r # Recursive build
make debug # Debug build
make release # Release build
# Clean build
make clean
make distclean
```
### Platform-Specific Builds
```bash
# Android
qmake -spec android-clang
make
# iOS
qmake -spec macx-ios-clang
make
# Windows (MinGW)
qmake -spec win32-g++
make
```
### Testing
```bash
# Build and run tests (requires main app built first)
cd tst
qmake
make
./qdomyos-zwift-tests
# Run with XML output for CI
GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ./qdomyos-zwift-tests
```
### No-GUI Mode
```bash
# Run application without GUI
sudo ./qdomyos-zwift -no-gui
```
## Architecture Overview
### Device Architecture
The application follows a hierarchical device architecture:
1. **Base Class**: `bluetoothdevice` - Abstract base for all fitness devices
- Manages Bluetooth connectivity via Qt's QLowEnergyController
- Defines common metrics (speed, cadence, heart rate, power, distance)
- Integrates with virtual devices for app connectivity
2. **Device Type Classes**: Inherit from `bluetoothdevice`
- `bike` - Bike-specific features (resistance, gears, power zones)
- `treadmill` - Treadmill features (speed control, inclination, pace)
- `elliptical` - Combined bike/treadmill features
- `rower` - Rowing metrics (stroke count, 500m pace)
- `stairclimber` - Step counting and climbing metrics
- `jumprope` - Jump sequence tracking
3. **Concrete Implementations**: Inherit from device type classes
- Located in `src/devices/[devicename]/` folders
- Examples: `domyosbike`, `pelotonbike`, `ftmsbike`
### Virtual Device System
- `virtualdevice` - Abstract base for virtual representations
- `virtualbike`, `virtualtreadmill`, etc. - Advertise to external apps
- Enables bidirectional communication between physical and virtual devices
### Bluetooth Management
- `bluetooth` class acts as device factory and connection manager
- `discoveryoptions` configures device discovery process
- Supports multiple connection types (Bluetooth LE, TCP, UDP)
## Key Development Areas
### Adding New Device Support
1. Create device folder in `src/devices/[devicename]/`
2. Implement device class inheriting from appropriate base type
3. Add device detection logic to `bluetooth.cpp`
4. Update `qdomyos-zwift.pri` with new source files
5. Add tests in `tst/Devices/` following existing patterns
### Characteristics & Protocols
- Bluetooth characteristics handlers in `src/characteristics/`
- FTMS (Fitness Machine Service) protocol support
- ANT+ integration for sensors
- Custom protocol implementations for specific brands
### UI & QML
- QML-based UI with Qt Quick Controls 2
- Main QML files in `src/` (main.qml, settings.qml, etc.)
- Platform-specific UI adaptations (iOS, Android, desktop)
### Integration Features
- Peloton workout/resistance integration (`peloton.cpp`)
- Zwift workout parsing (`zwiftworkout.cpp`)
- GPX file support for route following (`gpx.cpp`)
- Training program support (ZWO, XML formats)
## Platform-Specific Notes
### iOS
- Swift bridge files in `src/ios/`
- Apple Watch integration via `WatchKitConnection.swift`
- HealthKit integration for fitness data
- ConnectIQ SDK for Garmin devices
### Android
- Java bridge files in `src/android/src/`
- ANT+ integration via Android ANT SDK
- Foreground service for background operation
- USB serial support for wired connections
### Windows
- ADB integration for Nordic Track iFit devices
- PaddleOCR integration for Zwift workout detection
- Windows-specific networking features
## File Structure Patterns
### Device Files
```
src/devices/[devicename]/
├── [devicename].h # Header file
├── [devicename].cpp # Implementation
└── README.md # Device-specific documentation (optional)
```
### Test Files
```
tst/Devices/
├── DeviceTestData.h # Test data definitions
├── Test[DeviceName].h # Device-specific test cases
└── TestBluetooth.cpp # Main device detection test suite
```
## Testing Framework
- Uses Google Test (gtest) with Google Mock
- Comprehensive device detection testing
- Configuration-based test scenarios
- XML output support for CI/CD integration
- Tests must be built after main application (links against libqdomyos-zwift.a)
## Configuration & Settings
- Settings managed via `qzsettings.cpp` (QSettings wrapper)
- Platform-specific configuration paths
- Profile system for multiple users/devices
- Extensive customization options for device behavior
## External Dependencies
- Qt 5.15.2+ (Bluetooth, WebSockets, Charts, Quick, etc.)
- Google Test (submodule for testing)
- Platform SDKs (Android ANT+, iOS HealthKit, Windows ADB)
- Protocol Buffers for Zwift API integration
- MQTT client for IoT integration
- Various fitness platform APIs (Strava, Garmin Connect, etc.)
## Adding New ProForm Treadmill Models
This section provides a complete guide for adding new ProForm treadmill models to the codebase, based on the ProForm 995i implementation.
### Prerequisites
1. **Bluetooth Frame Capture File**: A file containing raw Bluetooth frames from the target treadmill
2. **Frame Analysis**: Understanding of which frames are initialization vs. sendPoll frames
3. **BLE Header Knowledge**: Each frame has an 11-byte BLE header that must be removed
### Step-by-Step Implementation Process
#### 1. Process Bluetooth Frames
First, process the raw Bluetooth frames by removing the first 11 bytes (BLE header) from each frame:
```bash
# Example: if you have "proform_model.c" with raw frames
# Process each frame by removing first 11 bytes
# Separate initialization frames from sendPoll frames
```
**Key Requirements:**
- Remove exactly 11 bytes from each frame (BLE header)
- Identify the boundary between initialization and sendPoll frames
- Initialization frames come first, sendPoll frames follow
- Document which packet number starts the sendPoll sequence
#### 2. Add Boolean Flag to Header File
Add the new model flag to `src/devices/proformtreadmill/proformtreadmill.h`:
```cpp
// Add before #ifdef Q_OS_IOS section
bool proform_treadmill_newmodel = false;
```
#### 3. Add Settings Support
Update the following files for settings integration:
**In `src/qzsettings.h`:**
```cpp
static const QString proform_treadmill_newmodel;
static constexpr bool default_proform_treadmill_newmodel = false;
```
**In `src/qzsettings.cpp`:**
```cpp
const QString QZSettings::proform_treadmill_newmodel = QStringLiteral("proform_treadmill_newmodel");
```
* Update the `allSettingsCount` in `qzsettings.cpp`
#### 4. Update QML Settings UI
**In `src/settings.qml`:**
1. Add property at the END of properties list:
```qml
property bool proform_treadmill_newmodel: false
```
2. Update ComboBox model array:
```qml
model: ["Disabled", "Proform New Model", ...]
```
3. Add case selection logic (find next available case number):
```qml
currentIndex: settings.proform_treadmill_newmodel ? XX : 0;
```
4. Add reset logic:
```qml
settings.proform_treadmill_newmodel = false;
```
5. Add switch case:
```qml
case XX: settings.proform_treadmill_newmodel = true; break;
```
#### 5. Implement Device Logic
**In `src/devices/proformtreadmill/proformtreadmill.cpp`:**
1. **Load Settings** (in constructor):
```cpp
proform_treadmill_newmodel = settings.value(QZSettings::proform_treadmill_newmodel, QZSettings::default_proform_treadmill_newmodel).toBool();
```
2. **Add Initialization Case** (in `btinit()` method):
```cpp
} else if (proform_treadmill_newmodel) {
// ALL initialization frames go here
uint8_t initData1[] = {0x00, 0xfe, 0x02, 0x08, 0x02};
writeCharacteristic(initData1, sizeof(initData1), QStringLiteral("init"), false, true);
// ... continue with ALL init frames from capture file
// Use frames from beginning until sendPoll boundary
}
```
3. **Add SendPoll Case** (in `sendPoll()` method):
```cpp
} else if (proform_treadmill_newmodel) {
switch (counterPoll) {
case 0:
// First sendPoll frame
break;
case 1:
// Second sendPoll frame
break;
// ... continue with pattern from sendPoll frames
default:
// Reset counter and cycle
counterPoll = -1;
break;
}
}
```
4. **Update Force Functions** - Add flag to conditional checks in `forceIncline()` and `forceSpeed()`:
```cpp
} else if (proform_treadmill_8_0 || ... || proform_treadmill_newmodel) {
write[14] = write[11] + write[12] + 0x12;
}
```
### Implementation Requirements
#### Frame Processing Rules
- **Exactly 11 bytes** must be removed from each frame (BLE header)
- **All initialization frames** must be included in the btinit() case
- **All sendPoll frames** must be included in the sendPoll() switch statement
- **Frame order** must be preserved exactly as captured
#### Settings Integration Rules
- **Property placement**: Always add new properties at the END of the properties list in settings.qml
- **Case numbering**: Find the next available case number in the ComboBox switch statement
- **Naming convention**: Use descriptive names following existing patterns
#### Code Organization Rules
- **Initialization**: All init frames go in btinit() method
- **Communication**: All sendPoll frames go in sendPoll() method with switch/case structure
- **Force functions**: Add new model flag to existing conditional chains
### Common Pitfalls and Solutions
#### Incorrect Byte Removal
- **Problem**: Removing wrong number of bytes (12 instead of 11)
- **Solution**: Always remove exactly 11 bytes (BLE header)
#### Wrong SendPoll Boundary
- **Problem**: Using initialization frames in sendPoll logic
- **Solution**: Identify exact packet number where sendPoll starts
#### Incomplete Initialization
- **Problem**: Missing initialization frames
- **Solution**: Include ALL frames from start until sendPoll boundary
#### Settings Placement
- **Problem**: Adding property in wrong location in settings.qml
- **Solution**: Always add at END of properties list
### Verification Checklist
- [ ] All 11 bytes removed from each frame
- [ ] Initialization frames correctly identified and included
- [ ] SendPoll frames correctly identified and implemented
- [ ] Settings properly integrated in all required files
- [ ] ComboBox updated with new model option
- [ ] Force functions updated with new model flag
- [ ] Property added at END of settings.qml properties list
### Example Reference
The ProForm 995i implementation serves as the reference example:
- 25 initialization frames (pkt4658-pkt4756)
- 33 sendPoll frames (pkt4761-pkt4897)
- 6-case sendPoll switch statement with cycling logic
- Complete settings integration across all required files
## Development Tips
- Use Qt Creator for development with proper project file support
- The project uses Qt's signal/slot mechanism extensively
- Device implementations should follow existing patterns for consistency
- Add comprehensive logging using the project's logging framework
- Test device detection thoroughly using the existing test infrastructure
- Consider platform differences when adding new features
## Additional Memories
- When adding a new setting in QML (setting-tiles.qml), you must:
* Add the property at the END of the properties list

View File

@@ -96,6 +96,9 @@ Zwift bridge for Treadmills and Bike!
|:---|:---:|:---:|:---:|:---:|---:|
|Resistance shifting with bluetooth remote|X||X|||
|TTS support|X|X|X|X||
|Zwift Play & Click support|X|||||
|MQTT integration|X|X|X|X||
|OpenSoundControl integration|X|X|X|X||
### Installation

View File

@@ -0,0 +1,84 @@
//
// QZWidget.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import WidgetKit
import SwiftUI
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), emoji: "😀")
}
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), emoji: "😀")
completion(entry)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
var entries: [SimpleEntry] = []
// Generate a timeline consisting of five entries an hour apart, starting from the current date.
let currentDate = Date()
for hourOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
let entry = SimpleEntry(date: entryDate, emoji: "😀")
entries.append(entry)
}
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
}
// func relevances() async -> WidgetRelevances<Void> {
// // Generate a list containing the contexts this widget is relevant in.
// }
}
struct SimpleEntry: TimelineEntry {
let date: Date
let emoji: String
}
struct QZWidgetEntryView : View {
var entry: Provider.Entry
var body: some View {
VStack {
Text("Time:")
Text(entry.date, style: .time)
Text("Emoji:")
Text(entry.emoji)
}
}
}
struct QZWidget: Widget {
let kind: String = "QZWidget"
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: Provider()) { entry in
if #available(iOS 17.0, *) {
QZWidgetEntryView(entry: entry)
.containerBackground(.fill.tertiary, for: .widget)
} else {
QZWidgetEntryView(entry: entry)
.padding()
.background()
}
}
.configurationDisplayName("My Widget")
.description("This is an example widget.")
}
}
#Preview(as: .systemSmall) {
QZWidget()
} timeline: {
SimpleEntry(date: .now, emoji: "😀")
SimpleEntry(date: .now, emoji: "🤩")
}

View File

@@ -0,0 +1,18 @@
//
// QZWidgetBundle.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import WidgetKit
import SwiftUI
@main
struct QZWidgetBundle: WidgetBundle {
var body: some Widget {
QZWidget()
QZWidgetControl()
QZWidgetLiveActivity()
}
}

View File

@@ -0,0 +1,54 @@
//
// QZWidgetControl.swift
// QZWidget
//
// Created by Roberto Viola on 04/10/25.
//
import AppIntents
import SwiftUI
import WidgetKit
struct QZWidgetControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(
kind: "org.cagnulein.qdomyoszwift.QZWidget",
provider: Provider()
) { value in
ControlWidgetToggle(
"Start Timer",
isOn: value,
action: StartTimerIntent()
) { isRunning in
Label(isRunning ? "On" : "Off", systemImage: "timer")
}
}
.displayName("Timer")
.description("A an example control that runs a timer.")
}
}
extension QZWidgetControl {
struct Provider: ControlValueProvider {
var previewValue: Bool {
false
}
func currentValue() async throws -> Bool {
let isRunning = true // Check if the timer is running
return isRunning
}
}
}
struct StartTimerIntent: SetValueIntent {
static let title: LocalizedStringResource = "Start a timer"
@Parameter(title: "Timer is running")
var value: Bool
func perform() async throws -> some IntentResult {
// Start / stop the timer based on `value`.
return .result()
}
}

View File

@@ -0,0 +1,174 @@
//
// QZWidgetLiveActivity.swift
// QDomyos-Zwift Live Activity Widget
//
// Displays workout metrics on Dynamic Island and Lock Screen
//
import ActivityKit
import WidgetKit
import SwiftUI
// QZWorkoutAttributes is defined in QZWorkoutAttributes.swift (shared file)
// MARK: - Live Activity Widget
@available(iOS 16.1, *)
struct QZWidgetLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: QZWorkoutAttributes.self) { context in
// Lock screen/banner UI
LockScreenLiveActivityView(context: context)
} dynamicIsland: { context in
DynamicIsland {
// Expanded UI
DynamicIslandExpandedRegion(.leading) {
VStack(alignment: .leading, spacing: 4) {
let speed = context.attributes.useMiles ? context.state.speed * 0.621371 : context.state.speed
let speedUnit = context.attributes.useMiles ? "mph" : "km/h"
Label("\(Int(speed)) \(speedUnit)", systemImage: "speedometer")
.font(.caption)
Label("\(context.state.heartRate) bpm", systemImage: "heart.fill")
.font(.caption)
.foregroundColor(.red)
}
}
DynamicIslandExpandedRegion(.trailing) {
VStack(alignment: .trailing, spacing: 4) {
Label("\(Int(context.state.power)) W", systemImage: "bolt.fill")
.font(.caption)
.foregroundColor(.yellow)
Label("\(Int(context.state.cadence)) rpm", systemImage: "arrow.clockwise")
.font(.caption)
}
}
DynamicIslandExpandedRegion(.center) {
// Empty or can add more info
}
DynamicIslandExpandedRegion(.bottom) {
HStack {
let distanceKm = context.state.distance / 1000.0
let distance = context.attributes.useMiles ? distanceKm * 0.621371 : distanceKm
let distanceUnit = context.attributes.useMiles ? "mi" : "km"
Label(String(format: "%.2f \(distanceUnit)", distance), systemImage: "map")
Spacer()
Label("\(Int(context.state.kcal)) kcal", systemImage: "flame.fill")
.foregroundColor(.orange)
}
.font(.caption)
.padding(.horizontal)
}
} compactLeading: {
// Compact leading (left side of Dynamic Island)
HStack(spacing: 2) {
Image(systemName: "heart.fill")
.foregroundColor(.red)
Text("\(context.state.heartRate)")
.font(.caption2)
}
} compactTrailing: {
// Compact trailing (right side of Dynamic Island)
HStack(spacing: 2) {
Image(systemName: "bolt.fill")
.foregroundColor(.yellow)
Text("\(Int(context.state.power))")
.font(.caption2)
}
} minimal: {
// Minimal view (when multiple activities)
Image(systemName: "figure.run")
}
}
}
}
// MARK: - Lock Screen View
@available(iOS 16.1, *)
struct LockScreenLiveActivityView: View {
let context: ActivityViewContext<QZWorkoutAttributes>
var body: some View {
VStack(alignment: .leading, spacing: 8) {
HStack {
Image(systemName: "figure.indoor.cycle")
.foregroundColor(.blue)
Text(context.attributes.deviceName)
.font(.headline)
Spacer()
}
HStack(spacing: 16) {
let speed = context.attributes.useMiles ? context.state.speed * 0.621371 : context.state.speed
let speedUnit = context.attributes.useMiles ? "mph" : "km/h"
MetricView(icon: "speedometer", value: String(format: "%.1f", speed), unit: speedUnit)
MetricView(icon: "heart.fill", value: "\(context.state.heartRate)", unit: "bpm", color: .red)
MetricView(icon: "bolt.fill", value: "\(Int(context.state.power))", unit: "W", color: .yellow)
}
HStack(spacing: 16) {
let distanceKm = context.state.distance / 1000.0
let distance = context.attributes.useMiles ? distanceKm * 0.621371 : distanceKm
let distanceUnit = context.attributes.useMiles ? "mi" : "km"
MetricView(icon: "arrow.clockwise", value: "\(Int(context.state.cadence))", unit: "rpm")
MetricView(icon: "map", value: String(format: "%.2f", distance), unit: distanceUnit)
MetricView(icon: "flame.fill", value: "\(Int(context.state.kcal))", unit: "kcal", color: .orange)
}
}
.padding()
}
}
// MARK: - Metric View Component
struct MetricView: View {
let icon: String
let value: String
let unit: String
var color: Color = .primary
var body: some View {
VStack(spacing: 2) {
Image(systemName: icon)
.foregroundColor(color)
.font(.caption)
Text(value)
.font(.system(.body, design: .rounded))
.fontWeight(.semibold)
Text(unit)
.font(.caption2)
.foregroundColor(.secondary)
}
.frame(maxWidth: .infinity)
}
}
// MARK: - Preview
@available(iOS 16.1, *)
struct QZWidgetLiveActivity_Previews: PreviewProvider {
static let attributes = QZWorkoutAttributes(deviceName: "QZ Bike", useMiles: false)
static let contentState = QZWorkoutAttributes.ContentState(
speed: 25.5,
cadence: 85,
power: 200,
heartRate: 145,
distance: 12500, // meters (will be displayed as 12.50 km or 7.77 mi)
kcal: 320,
useMiles: false
)
static var previews: some View {
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.compact))
.previewDisplayName("Island Compact")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.expanded))
.previewDisplayName("Island Expanded")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.minimal))
.previewDisplayName("Minimal")
attributes
.previewContext(contentState, viewKind: .content)
.previewDisplayName("Lock Screen")
}
}

View File

@@ -0,0 +1,41 @@
//
// QZWorkoutAttributes.swift
// QDomyos-Zwift
//
// Shared attributes for Live Activities
// MUST be included in both qdomyoszwift and QZWidget targets
//
import Foundation
import ActivityKit
@available(iOS 16.1, *)
public struct QZWorkoutAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
public var speed: Double
public var cadence: Double
public var power: Double
public var heartRate: Int
public var distance: Double
public var kcal: Double
public var useMiles: Bool
public init(speed: Double, cadence: Double, power: Double, heartRate: Int, distance: Double, kcal: Double, useMiles: Bool) {
self.speed = speed
self.cadence = cadence
self.power = power
self.heartRate = heartRate
self.distance = distance
self.kcal = kcal
self.useMiles = useMiles
}
}
public var deviceName: String
public var useMiles: Bool
public init(deviceName: String, useMiles: Bool) {
self.deviceName = deviceName
self.useMiles = useMiles
}
}

View File

@@ -107,6 +107,7 @@ extension MainController: WorkoutTrackingDelegate {
WorkoutTracking.speed = WatchKitConnection.speed
WorkoutTracking.power = WatchKitConnection.power
WorkoutTracking.cadence = WatchKitConnection.cadence
WorkoutTracking.steps = WatchKitConnection.steps
if Locale.current.measurementSystem != "Metric" {
self.distanceLabel.setText("Distance \(String(format:"%.2f", WorkoutTracking.distance))")

View File

@@ -23,10 +23,12 @@ class WatchKitConnection: NSObject {
static let shared = WatchKitConnection()
public static var distance = 0.0
public static var kcal = 0.0
public static var totalKcal = 0.0
public static var stepCadence = 0
public static var speed = 0.0
public static var cadence = 0.0
public static var power = 0.0
public static var steps = 0
weak var delegate: WatchKitConnectionDelegate?
private override init() {
@@ -69,6 +71,9 @@ extension WatchKitConnection: WatchKitConnectionProtocol {
WatchKitConnection.distance = dDistance
let dKcal = Double(result["kcal"] as! Double)
WatchKitConnection.kcal = dKcal
if let totalKcalDouble = result["totalKcal"] as? Double {
WatchKitConnection.totalKcal = totalKcalDouble
}
let dSpeed = Double(result["speed"] as! Double)
WatchKitConnection.speed = dSpeed
@@ -76,6 +81,10 @@ extension WatchKitConnection: WatchKitConnectionProtocol {
WatchKitConnection.power = dPower
let dCadence = Double(result["cadence"] as! Double)
WatchKitConnection.cadence = dCadence
if let stepsDouble = result["steps"] as? Double {
let iSteps = Int(stepsDouble)
WatchKitConnection.steps = iSteps
}
}, errorHandler: { (error) in
print(error)
})

View File

@@ -28,11 +28,13 @@ class WorkoutTracking: NSObject {
static let shared = WorkoutTracking()
public static var distance = Double()
public static var kcal = Double()
public static var totalKcal = Double()
public static var cadenceTimeStamp = NSDate().timeIntervalSince1970
public static var cadenceLastSteps = Double()
public static var cadenceSteps = 0
public static var speed = Double()
public static var power = Double()
public static var steps = Int()
public static var cadence = Double()
public static var lastDateMetric = Date()
var sport: Int = 0
@@ -53,20 +55,26 @@ extension WorkoutTracking {
switch statistics.quantityType {
case HKQuantityType.quantityType(forIdentifier: .distanceCycling):
let distanceUnit = HKUnit.mile()
let value = statistics.mostRecentQuantity()?.doubleValue(for: distanceUnit)
let roundedValue = Double( round( 1 * value! ) / 1 )
guard let value = statistics.mostRecentQuantity()?.doubleValue(for: distanceUnit) else {
return
}
let roundedValue = Double( round( 1 * value ) / 1 )
delegate?.didReceiveHealthKitDistanceCycling(roundedValue)
case HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned):
let energyUnit = HKUnit.kilocalorie()
let value = statistics.mostRecentQuantity()?.doubleValue(for: energyUnit)
let roundedValue = Double( round( 1 * value! ) / 1 )
guard let value = statistics.mostRecentQuantity()?.doubleValue(for: energyUnit) else {
return
}
let roundedValue = Double( round( 1 * value ) / 1 )
delegate?.didReceiveHealthKitActiveEnergyBurned(roundedValue)
case HKQuantityType.quantityType(forIdentifier: .heartRate):
let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute())
let value = statistics.mostRecentQuantity()?.doubleValue(for: heartRateUnit)
let roundedValue = Double( round( 1 * value! ) / 1 )
guard let value = statistics.mostRecentQuantity()?.doubleValue(for: heartRateUnit) else {
return
}
let roundedValue = Double( round( 1 * value ) / 1 )
delegate?.didReceiveHealthKitHeartRate(roundedValue)
case HKQuantityType.quantityType(forIdentifier: .stepCount):
@@ -159,6 +167,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .basalEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .cyclingPower)!,
HKSampleType.quantityType(forIdentifier: .cyclingSpeed)!,
HKSampleType.quantityType(forIdentifier: .cyclingCadence)!,
@@ -178,6 +187,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .basalEnergyBurned)!,
HKSampleType.workoutType()
])
}
@@ -216,23 +226,30 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
workoutSession.stopActivity(with: Date())
workoutSession.end()
guard let quantityType = HKQuantityType.quantityType(
// Write active calories
guard let activeQuantityType = HKQuantityType.quantityType(
forIdentifier: .activeEnergyBurned) else {
return
}
let unit = HKUnit.kilocalorie()
let totalEnergyBurned = WorkoutTracking.kcal
let quantity = HKQuantity(unit: unit,
doubleValue: totalEnergyBurned)
let activeEnergyBurned = WorkoutTracking.kcal
let activeQuantity = HKQuantity(unit: unit,
doubleValue: activeEnergyBurned)
let sample = HKCumulativeQuantitySeriesSample(type: quantityType,
quantity: quantity,
start: workoutSession.startDate!,
end: Date())
let startDate = workoutSession.startDate ?? WorkoutTracking.lastDateMetric
workoutBuilder.add([sample]) {(success, error) in}
let activeSample = HKCumulativeQuantitySeriesSample(type: activeQuantityType,
quantity: activeQuantity,
start: startDate,
end: Date())
workoutBuilder.add([activeSample]) {(success, error) in
if let error = error {
print("WatchWorkoutTracking active calories: \(error.localizedDescription)")
}
}
let unitDistance = HKUnit.mile()
let miles = WorkoutTracking.distance
let quantityMiles = HKQuantity(unit: unitDistance,
@@ -248,7 +265,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: workoutSession.startDate!,
start: startDate,
end: Date())
workoutBuilder.add([sampleDistance]) {(success, error) in
@@ -264,11 +281,117 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
}
}
}
} else if(sport == 4) { // Rowing
// Guard to check if steps quantity type is available
guard let quantityTypeSteps = HKQuantityType.quantityType(
forIdentifier: .stepCount) else {
return
}
let stepsQuantity = HKQuantity(unit: HKUnit.count(), doubleValue: Double(WorkoutTracking.steps))
// Create a sample for total steps
let sampleSteps = HKCumulativeQuantitySeriesSample(
type: quantityTypeSteps,
quantity: stepsQuantity,
start: startDate,
end: Date())
// Add the steps sample to workout builder
workoutBuilder.add([sampleSteps]) { (success, error) in
if let error = error {
print(error)
}
}
// Per il rowing, HealthKit utilizza un tipo specifico di distanza
// Se non esiste un tipo specifico per il rowing, possiamo usare un tipo generico di distanza
var quantityTypeDistance: HKQuantityType?
// In watchOS 10 e versioni successive, possiamo usare un tipo specifico se disponibile
if #available(watchOSApplicationExtension 10.0, *) {
// Verifica se esiste un tipo specifico per il rowing, altrimenti utilizza un tipo generico
quantityTypeDistance = HKQuantityType.quantityType(forIdentifier: .distanceSwimming)
} else {
// Nelle versioni precedenti, usa il tipo generico
quantityTypeDistance = HKQuantityType.quantityType(forIdentifier: .distanceWalkingRunning)
}
guard let typeDistance = quantityTypeDistance else {
return
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: typeDistance,
quantity: quantityMiles,
start: startDate,
end: Date())
workoutBuilder.add([sampleDistance]) {(success, error) in
if let error = error {
print(error)
}
self.workoutBuilder.endCollection(withEnd: Date()) { (success, error) in
if let error = error {
print(error)
}
self.workoutBuilder.finishWorkout{ (workout, error) in
if let error = error {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
}
}
}
} else {
// Guard to check if steps quantity type is available
guard let quantityTypeSteps = HKQuantityType.quantityType(
forIdentifier: .stepCount) else {
return
}
let stepsQuantity = HKQuantity(unit: HKUnit.count(), doubleValue: Double(WorkoutTracking.steps))
// Create a sample for total steps
let sampleSteps = HKCumulativeQuantitySeriesSample(
type: quantityTypeSteps,
quantity: stepsQuantity, // Use your steps quantity here
start: startDate,
end: Date())
// Add the steps sample to workout builder
workoutBuilder.add([sampleSteps]) { (success, error) in
if let error = error {
print(error)
}
// End the data collection
self.workoutBuilder.endCollection(withEnd: Date()) { (success, error) in
if let error = error {
print(error)
}
// Finish the workout and save total steps
self.workoutBuilder.finishWorkout { (workout, error) in
if let error = error {
print(error)
}
workout?.setValue(stepsQuantity, forKey: "totalSteps")
}
}
}
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceWalkingRunning) else {
return
@@ -276,7 +399,7 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: workoutSession.startDate!,
start: startDate,
end: Date())
workoutBuilder.add([sampleDistance]) {(success, error) in
@@ -292,6 +415,10 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
print(error)
}
workout?.setValue(quantityMiles, forKey: "totalDistance")
// Set total energy burned on the workout
let totalEnergy = WorkoutTracking.totalKcal > 0 ? WorkoutTracking.totalKcal : activeEnergyBurned
let totalEnergyQuantity = HKQuantity(unit: unit, doubleValue: totalEnergy)
workout?.setValue(totalEnergyQuantity, forKey: "totalEnergyBurned")
}
}
}
@@ -402,7 +529,7 @@ extension WorkoutTracking: HKLiveWorkoutBuilderDelegate {
// Fallback on earlier versions
}
} else if(sport == 1) {
if #available(watchOSApplicationExtension 10.0, *) {
if #available(watchOSApplicationExtension 10.0, *) {
let wattPerInterval = HKQuantity(unit: HKUnit.watt(),
doubleValue: WorkoutTracking.power)
@@ -445,7 +572,7 @@ extension WorkoutTracking: HKLiveWorkoutBuilderDelegate {
// Fallback on earlier versions
}
} else if(sport == 2) {
if #available(watchOSApplicationExtension 10.0, *) {
if #available(watchOSApplicationExtension 10.0, *) {
let speedPerInterval = HKQuantity(unit: HKUnit.meter().unitDivided(by: HKUnit.second()),
doubleValue: WorkoutTracking.speed * 0.277778)

View File

@@ -1,4 +1,4 @@
QT += gui bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia
QT += gui bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia sql
QTPLUGIN += qavfmediaplayer
QT+= charts

View File

@@ -0,0 +1,96 @@
# Define build image
FROM ubuntu:latest AS build
# Install essential build dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y \
&& apt install --no-install-recommends -y \
git \
ca-certificates \
qtquickcontrols2-5-dev \
qtconnectivity5-dev \
qtbase5-private-dev \
qtpositioning5-dev \
libqt5charts5-dev \
libqt5networkauth5-dev \
libqt5websockets5-dev \
qml-module* \
libqt5texttospeech5-dev \
qtlocation5-dev \
qtmultimedia5-dev \
g++ \
make \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Define runtime image
FROM ubuntu:latest AS runtime
# Install essential runtime dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y \
&& apt install --no-install-recommends -y \
libqt5bluetooth5 \
libqt5widgets5 \
libqt5positioning5 \
libqt5xml5 \
libqt5charts5 \
qt5-assistant \
libqt5networkauth5 \
libqt5websockets5 \
qml-module* \
libqt5texttospeech5 \
libqt5location5-plugins \
libqt5multimediawidgets5 \
libqt5multimedia5-plugins \
libqt5multimedia5 \
qml-module-qtquick-controls2 \
libqt5location5 \
bluez \
dbus \
tigervnc-standalone-server \
tigervnc-tools \
libgl1-mesa-dri \
xfonts-base \
x11-xserver-utils \
tigervnc-common \
net-tools \
&& rm -rf /var/lib/apt/lists/*
# Stage 1: Build
FROM build AS builder
# Clone the project and build it
WORKDIR /usr/local/src
RUN git clone --recursive https://github.com/cagnulein/qdomyos-zwift.git
WORKDIR /usr/local/src/qdomyos-zwift
RUN git submodule update --init src/smtpclient/ \
&& git submodule update --init src/qmdnsengine/ \
&& git submodule update --init tst/googletest/
WORKDIR /usr/local/src/qdomyos-zwift/src
RUN qmake qdomyos-zwift.pro \
&& make -j4
# Stage 2: Runtime
FROM runtime
# Copy the built binary to /usr/local/bin
COPY --from=builder /usr/local/src/qdomyos-zwift/src/qdomyos-zwift /usr/local/bin/qdomyos-zwift
# VNC configuration
RUN mkdir -p ~/.vnc && \
echo "securepassword" | vncpasswd -f > ~/.vnc/passwd && \
chmod 600 ~/.vnc/passwd
# .Xauthority configuration
RUN touch /root/.Xauthority
ENV DISPLAY=:99
# Start VNC server with authentication
CMD vncserver :99 -depth 24 -localhost no -xstartup qdomyos-zwift && \
sleep infinity

2
docker/linux_gui_vnc/build.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
docker build -t qdomyos-zwift-vnc .

View File

@@ -0,0 +1,10 @@
services:
qdomyos-zwift-vnc:
image: qdomyos-zwift-vnc
container_name: qdomyos-zwift-vnc
privileged: true # Required for Bluetooth functionality
network_mode: "host" # Used to access host Bluetooth and D-Bus
volumes:
- /dev:/dev # Forward host devices (for Bluetooth)
- /run/dbus:/run/dbus # Forward D-Bus for Bluetooth interaction
restart: "no" # Do not restart the container automatically

View File

@@ -0,0 +1,95 @@
# Define build image
FROM ubuntu:latest AS build
# Install essential build dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y \
&& apt install --no-install-recommends -y \
git \
ca-certificates \
qtquickcontrols2-5-dev \
qtconnectivity5-dev \
qtbase5-private-dev \
qtpositioning5-dev \
libqt5charts5-dev \
libqt5networkauth5-dev \
libqt5websockets5-dev \
qml-module* \
libqt5texttospeech5-dev \
qtlocation5-dev \
qtmultimedia5-dev \
g++ \
make \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Define runtime image
FROM ubuntu:latest AS runtime
# Install essential runtime dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y \
&& apt install --no-install-recommends -y \
libqt5bluetooth5 \
libqt5widgets5 \
libqt5positioning5 \
libqt5xml5 \
libqt5charts5 \
qt5-assistant \
libqt5networkauth5 \
libqt5websockets5 \
qml-module* \
libqt5texttospeech5 \
libqt5location5-plugins \
libqt5multimediawidgets5 \
libqt5multimedia5-plugins \
libqt5multimedia5 \
qml-module-qtquick-controls2 \
libqt5location5 \
bluez \
dbus \
&& rm -rf /var/lib/apt/lists/*
# Stage 1: Build
FROM build AS builder
# Define variables for Qt versions
ARG QT_VERSION=5.15
ARG QT_SUBVERSION=5.15.13
ARG QT_WEBPLUGIN_NAME=qtwebglplugin-everywhere-opensource-src
# Build WebGL plugin
WORKDIR /usr/local/src
RUN wget https://download.qt.io/official_releases/qt/${QT_VERSION}/${QT_SUBVERSION}/submodules/${QT_WEBPLUGIN_NAME}-${QT_SUBVERSION}.zip \
&& unzip ${QT_WEBPLUGIN_NAME}-${QT_SUBVERSION}.zip \
&& mv *-${QT_SUBVERSION} qtwebglplugin-everywhere \
&& cd qtwebglplugin-everywhere \
&& qmake \
&& make
# Clone the project and build it
WORKDIR /usr/local/src
RUN git clone --recursive https://github.com/cagnulein/qdomyos-zwift.git
WORKDIR /usr/local/src/qdomyos-zwift
RUN git submodule update --init src/smtpclient/ \
&& git submodule update --init src/qmdnsengine/ \
&& git submodule update --init tst/googletest/
WORKDIR /usr/local/src/qdomyos-zwift/src
RUN qmake qdomyos-zwift.pro \
&& make -j4
# Stage 2: Runtime
FROM runtime
# Copy the built binary to /usr/local/bin
COPY --from=builder /usr/local/src/qdomyos-zwift/src/qdomyos-zwift /usr/local/bin/qdomyos-zwift
# Copy WebGL plugin to the appropriate location
COPY --from=builder /usr/local/src/qtwebglplugin-everywhere/plugins/platforms/libqwebgl.so /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqwebgl.so
# Set the default command to run the application with WebGL
CMD ["qdomyos-zwift", "-qml", "-platform", "webgl:port=8080"]

2
docker/linux_webgl/build.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
docker build -t qdomyos-zwift-webgl .

View File

@@ -0,0 +1,19 @@
services:
qdomyos-zwift-webgl:
image: qdomyos-zwift-webgl
container_name: qdomyos-zwift-webgl
privileged: true
network_mode: "host"
environment:
- DISPLAY=${DISPLAY}
volumes:
- /dev:/dev
- /run/dbus:/run/dbus
- ./.config:/root/.config
- /tmp/.X11-unix:/tmp/.X11-unix
stdin_open: true
tty: true
restart: "no"
# command: qdomyos-zwift -qml -platform webgl:port=8080
# command: ["qdomyos-zwift", "-no-gui"]

View File

@@ -10,7 +10,7 @@ These instructions build the app itself, not the test project.
```buildoutcfg
$ sudo apt update && sudo apt upgrade # this is very important on raspberry pi: you need the bluetooth firmware updated!
$ sudo apt install git qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qml-module* libqt5texttospeech5-dev libqt5texttospeech5 libqt5location5-plugins qtlocation5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 g++ make
$ sudo apt install git qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qml-module* libqt5texttospeech5-dev libqt5texttospeech5 libqt5location5-plugins qtlocation5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 g++ make qtbase5-dev libqt5sql5 libqt5sql5-mysql libqt5sql5-psql
$ git clone https://github.com/cagnulein/qdomyos-zwift.git
$ cd qdomyos-zwift
$ git submodule update --init src/smtpclient/
@@ -106,7 +106,7 @@ This operation takes a moment to complete.
#### Install qdomyos-zwift from sources
```bash
sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 qtlocation5-dev qtquickcontrols2-5-dev libqt5texttospeech5-dev libqt5texttospeech5 g++ make
sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtbase5-private-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 qtlocation5-dev qtquickcontrols2-5-dev libqt5texttospeech5-dev libqt5texttospeech5 g++ make qtbase5-dev libqt5sql5 libqt5sql5-mysql libqt5sql5-psql
git clone https://github.com/cagnulein/qdomyos-zwift.git
cd qdomyos-zwift
git submodule update --init src/smtpclient/
@@ -177,6 +177,151 @@ If everything is working as expected, **enable your service at boot time** :
Then reboot to check operations (`sudo reboot`)
### (optional) Treadmill Auto-Detection and Service Management
This section provides a reliable way to manage the QZ service based on the treadmill's power state. Using a `bluetoothctl`-based Bash script, this solution ensures the QZ service starts when the treadmill is detected and stops when it is not.
- **Bluetooth Discovery**: Monitors treadmill availability via `bluetoothctl`.
- **Service Control**: Automatically starts and stops the QZ service.
- **Logging**: Tracks treadmill status and actions in a log file.
**Notes:**
- Ensure `bluetoothctl` is installed and working on your system.
- Replace `I_TL` in the script with your treadmill's Bluetooth name. You can find your device name via `bluetoothctl scan on`
- Adjust the sleep interval (`sleep 30`) in the script as needed for your use case.
Step 1: Save the following script as `/root/qz-treadmill-monitor.sh`:
```bash
#!/bin/bash
LOG_FILE="/var/log/qz-treadmill-monitor.log"
TARGET_DEVICE="I_TL"
SCAN_INTERVAL=30 # Time in seconds between checks
SERVICE_NAME="qz"
DEBUG_LOG_DIR="/var/log" # Directory where QZ debug logs are stored
ERROR_MESSAGE="BTLE stateChanged InvalidService"
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
}
is_service_running() {
systemctl is-active --quiet "$SERVICE_NAME"
return $?
}
scan_for_device() {
log "Starting Bluetooth scan for $TARGET_DEVICE..."
# Run bluetoothctl scan in the background and capture output
bluetoothctl scan on &>/dev/null &
SCAN_PID=$!
# Allow some time for devices to appear
sleep 5
# Check if the target device appears in the list
bluetoothctl devices | grep -q "$TARGET_DEVICE"
DEVICE_FOUND=$?
# Stop scanning
kill "$SCAN_PID"
bluetoothctl scan off &>/dev/null
if [ $DEVICE_FOUND -eq 0 ]; then
log "Device '$TARGET_DEVICE' found."
return 0
else
log "Device '$TARGET_DEVICE' not found."
return 1
fi
}
restart_qz_on_error() {
# Get the current date
CURRENT_DATE=$(date '+%a_%b_%d')
# Find the latest QZ debug log file for today
LATEST_LOG=$(ls -t "$DEBUG_LOG_DIR"/debug-"$CURRENT_DATE"_*.log 2>/dev/null | head -n 1)
if [ -z "$LATEST_LOG" ]; then
log "No QZ debug log found for today."
return 0
fi
log "Checking latest log file: $LATEST_LOG for errors..."
# Search the latest log for the error message
if grep -q "$ERROR_MESSAGE" "$LATEST_LOG"; then
log "***** Error detected in QZ log: $ERROR_MESSAGE *****"
log "Restarting QZ service..."
systemctl restart "$SERVICE_NAME"
else
log "No errors detected in $LATEST_LOG."
fi
}
manage_service() {
local device_found=$1
if $device_found; then
if ! is_service_running; then
log "***** Starting QZ service... *****"
systemctl start "$SERVICE_NAME"
else
log "QZ service is already running."
restart_qz_on_error # Check the log for errors when QZ is already running
fi
else
if is_service_running; then
log "***** Stopping QZ service... *****"
systemctl stop "$SERVICE_NAME"
else
log "QZ service is already stopped."
fi
fi
}
while true; do
log "Checking for treadmill status..."
if scan_for_device; then
manage_service true
else
manage_service false
fi
log "Waiting for $SCAN_INTERVAL seconds before next check..."
sleep "$SCAN_INTERVAL"
done
```
Step2: To ensure the script runs continuously, create a systemd service file at `/etc/systemd/system/qz-treadmill-monitor.service`
```bash
[Unit]
Description=QZ Treadmill Monitor Service
After=bluetooth.service
[Service]
Type=simple
ExecStart=/root/qz-treadmill-monitor.sh
Restart=always
RestartSec=10
User=root
[Install]
WantedBy=multi-user.target
```
Step 3: Enable and Start the Service
```bash
sudo systemctl daemon-reload
sudo systemctl enable qz-treadmill-monitor
sudo systemctl start qz-treadmill-monitor
```
Monitor logs are written to `/var/log/qz-treadmill-monitor.log`. Use the following command to check logs in real-time:
```bash
sudo tail -f /var/log/qz-treadmill-monitor.log
```
### (optional) Enable overlay FS

188
helpers/dircon-parser.py Normal file
View File

@@ -0,0 +1,188 @@
from dataclasses import dataclass
from typing import List, Optional, Tuple
import re
@dataclass
class HubRidingData:
power: Optional[int] = None
cadence: Optional[int] = None
speed_x100: Optional[int] = None
hr: Optional[int] = None
unknown1: Optional[int] = None
unknown2: Optional[int] = None
def __str__(self):
return (f"Power={self.power}W Cadence={self.cadence}rpm "
f"Speed={self.speed_x100/100 if self.speed_x100 else 0:.1f}km/h "
f"HR={self.hr}bpm Unknown1={self.unknown1} Unknown2={self.unknown2}")
def parse_protobuf_varint(data: bytes, offset: int = 0) -> Tuple[int, int]:
result = 0
shift = 0
while offset < len(data):
byte = data[offset]
result |= (byte & 0x7F) << shift
offset += 1
if not (byte & 0x80):
break
shift += 7
return result, offset
def parse_hub_riding_data(data: bytes) -> Optional[HubRidingData]:
try:
riding_data = HubRidingData()
offset = 0
while offset < len(data):
key, new_offset = parse_protobuf_varint(data, offset)
wire_type = key & 0x07
field_number = key >> 3
offset = new_offset
if wire_type == 0:
value, offset = parse_protobuf_varint(data, offset)
if field_number == 1:
riding_data.power = value
elif field_number == 2:
riding_data.cadence = value
elif field_number == 3:
riding_data.speed_x100 = value
elif field_number == 4:
riding_data.hr = value
elif field_number == 5:
riding_data.unknown1 = value
elif field_number == 6:
riding_data.unknown2 = value
return riding_data
except Exception as e:
print(f"Error parsing protobuf: {e}")
return None
@dataclass
class DirconPacket:
message_version: int = 1
identifier: int = 0xFF
sequence_number: int = 0
response_code: int = 0
length: int = 0
uuid: int = 0
uuids: List[int] = None
additional_data: bytes = b''
is_request: bool = False
riding_data: Optional[HubRidingData] = None
def __str__(self):
uuids_str = ','.join(f'{u:04x}' for u in (self.uuids or []))
base_str = (f"vers={self.message_version} Id={self.identifier} sn={self.sequence_number} "
f"resp={self.response_code} len={self.length} req?={self.is_request} "
f"uuid={self.uuid:04x} dat={self.additional_data.hex()} uuids=[{uuids_str}]")
if self.riding_data:
base_str += f"\nRiding Data: {self.riding_data}"
return base_str
def parse_dircon_packet(data: bytes, offset: int = 0) -> Tuple[Optional[DirconPacket], int]:
if len(data) - offset < 6:
return None, 0
packet = DirconPacket()
packet.message_version = data[offset]
packet.identifier = data[offset + 1]
packet.sequence_number = data[offset + 2]
packet.response_code = data[offset + 3]
packet.length = (data[offset + 4] << 8) | data[offset + 5]
total_length = 6 + packet.length
if len(data) - offset < total_length:
return None, 0
curr_offset = offset + 6
if packet.identifier == 0x01: # DPKT_MSGID_DISCOVER_SERVICES
if packet.length == 0:
packet.is_request = True
elif packet.length % 16 == 0:
packet.uuids = []
while curr_offset + 16 <= offset + total_length:
uuid = (data[curr_offset + 2] << 8) | data[curr_offset + 3]
packet.uuids.append(uuid)
curr_offset += 16
elif packet.identifier == 0x02: # DPKT_MSGID_DISCOVER_CHARACTERISTICS
if packet.length >= 16:
packet.uuid = (data[curr_offset + 2] << 8) | data[curr_offset + 3]
if packet.length == 16:
packet.is_request = True
elif (packet.length - 16) % 17 == 0:
curr_offset += 16
packet.uuids = []
packet.additional_data = b''
while curr_offset + 17 <= offset + total_length:
uuid = (data[curr_offset + 2] << 8) | data[curr_offset + 3]
packet.uuids.append(uuid)
packet.additional_data += bytes([data[curr_offset + 16]])
curr_offset += 17
elif packet.identifier in [0x03, 0x04, 0x05, 0x06]: # READ/WRITE/NOTIFY characteristics
if packet.length >= 16:
packet.uuid = (data[curr_offset + 2] << 8) | data[curr_offset + 3]
if packet.length > 16:
packet.additional_data = data[curr_offset + 16:offset + total_length]
if packet.uuid == 0x0002:
packet.riding_data = parse_hub_riding_data(packet.additional_data)
if packet.identifier != 0x06:
packet.is_request = True
return packet, total_length
def extract_bytes_from_c_array(content: str) -> List[Tuple[str, bytes]]:
packets = []
pattern = r'static const unsigned char (\w+)\[\d+\] = \{([^}]+)\};'
matches = re.finditer(pattern, content)
for match in matches:
name = match.group(1)
hex_str = match.group(2)
hex_values = []
for line in hex_str.split('\n'):
line = line.split('//')[0]
values = re.findall(r'0x[0-9a-fA-F]{2}', line)
hex_values.extend(values)
byte_data = bytes([int(x, 16) for x in hex_values])
packets.append((name, byte_data))
return packets
def get_tcp_payload(data: bytes) -> bytes:
ip_header_start = 14 # Skip Ethernet header
ip_header_len = (data[ip_header_start] & 0x0F) * 4
tcp_header_start = ip_header_start + ip_header_len
tcp_header_len = ((data[tcp_header_start + 12] >> 4) & 0x0F) * 4
payload_start = tcp_header_start + tcp_header_len
return data[payload_start:]
def parse_file(filename: str):
with open(filename, 'r') as f:
content = f.read()
packets = extract_bytes_from_c_array(content)
for name, data in packets:
print(f"\nPacket {name}:")
payload = get_tcp_payload(data)
print(f"Dircon payload: {payload.hex()}")
offset = 0
while offset < len(payload):
packet, consumed = parse_dircon_packet(payload, offset)
if packet is None or consumed == 0:
break
print(f"Frame: {packet}")
offset += consumed
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("Usage: python script.py <input_file>")
sys.exit(1)
parse_file(sys.argv[1])

331
helpers/wahoo-simulator.py Normal file
View File

@@ -0,0 +1,331 @@
import sys
import logging
import asyncio
import threading
import random
import struct
import binascii
import time
from typing import Any, Union
# Verificare che siamo su macOS
if sys.platform != 'darwin':
print("Questo script è progettato specificamente per macOS!")
sys.exit(1)
# Importare bless
try:
from bless import (
BlessServer,
BlessGATTCharacteristic,
GATTCharacteristicProperties,
GATTAttributePermissions,
)
except ImportError:
print("Errore: impossibile importare bless. Installarlo con: pip install bless")
sys.exit(1)
# Configurazione logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Trigger per eventi
trigger = threading.Event()
# Informazioni sul dispositivo
DEVICE_NAME = "Wahoo KICKR 51A6"
# UUID dei servizi standard
CYCLING_POWER_SERVICE = "00001818-0000-1000-8000-00805f9b34fb"
USER_DATA_SERVICE = "0000181c-0000-1000-8000-00805f9b34fb"
FITNESS_MACHINE_SERVICE = "00001826-0000-1000-8000-00805f9b34fb"
# UUID dei servizi Wahoo personalizzati
WAHOO_SERVICE_1 = "a026ee01-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_SERVICE_3 = "a026ee03-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_SERVICE_6 = "a026ee06-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_SERVICE_B = "a026ee0b-0a7d-4ab3-97fa-f1500f9feb8b"
# UUID delle caratteristiche standard
CYCLING_POWER_MEASUREMENT = "00002a63-0000-1000-8000-00805f9b34fb"
CYCLING_POWER_FEATURE = "00002a65-0000-1000-8000-00805f9b34fb"
SENSOR_LOCATION = "00002a5d-0000-1000-8000-00805f9b34fb"
CYCLING_POWER_CONTROL_POINT = "00002a66-0000-1000-8000-00805f9b34fb"
WEIGHT = "00002a98-0000-1000-8000-00805f9b34fb"
FITNESS_MACHINE_FEATURE = "00002acc-0000-1000-8000-00805f9b34fb"
TRAINING_STATUS = "00002ad3-0000-1000-8000-00805f9b34fb"
FITNESS_MACHINE_CONTROL_POINT = "00002ad9-0000-1000-8000-00805f9b34fb"
FITNESS_MACHINE_STATUS = "00002ada-0000-1000-8000-00805f9b34fb"
INDOOR_BIKE_DATA = "00002ad2-0000-1000-8000-00805f9b34fb"
# UUID delle caratteristiche Wahoo personalizzate
WAHOO_CUSTOM_CP_CHAR = "a026e005-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_CHAR_1 = "a026e002-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_CHAR_2 = "a026e004-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_CHAR_3 = "a026e00a-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_CHAR_4 = "a026e023-0a7d-4ab3-97fa-f1500f9feb8b"
WAHOO_CHAR_5 = "a026e037-0a7d-4ab3-97fa-f1500f9feb8b"
# Stato dispositivo - variabili globali
current_power = 120
current_cadence = 85
current_speed = 25.0
current_resistance = 5
# Funzioni di callback
def read_request(characteristic, **kwargs):
logger.debug(f"Lettura: {characteristic.value}")
return characteristic.value
def write_request(characteristic, value, **kwargs):
uuid_str = str(characteristic.uuid).lower()
logger.info(f"Scrittura su caratteristica: {uuid_str}, valore: {binascii.hexlify(value)}")
# Gestione delle richieste di scrittura
if uuid_str == FITNESS_MACHINE_CONTROL_POINT.lower():
handle_ftms_control_point(value)
elif uuid_str == CYCLING_POWER_CONTROL_POINT.lower():
handle_cp_control_point(value)
elif uuid_str in [WAHOO_CHAR_1.lower(), WAHOO_CHAR_3.lower(), WAHOO_CHAR_4.lower(), WAHOO_CHAR_5.lower()]:
handle_wahoo_char_write(uuid_str, value)
characteristic.value = value
# Gestori di richieste di scrittura
def handle_ftms_control_point(data):
global current_power, current_resistance
if not data:
return
op_code = data[0]
logger.info(f"Comando FTMS Control Point: {op_code:#x}")
if op_code == 0x05: # Set Target Power (ERG mode)
if len(data) >= 3:
target_power = int.from_bytes(data[1:3], byteorder='little')
logger.info(f"Target power impostato: {target_power}W")
current_power = target_power
def handle_cp_control_point(data):
if not data:
return
op_code = data[0]
logger.info(f"Comando CP Control Point: {op_code:#x}")
def handle_wahoo_char_write(uuid_str, data):
logger.info(f"Scrittura su caratteristica Wahoo {uuid_str}: {binascii.hexlify(data)}")
# Funzioni per generare dati
def generate_cycling_power_data():
global current_power, current_cadence
# Varia leggermente i valori
current_power += random.randint(-3, 3)
current_power = max(0, min(2000, current_power))
current_cadence += random.randint(-1, 1)
current_cadence = max(0, min(200, current_cadence))
# Crea Cycling Power Measurement
power_data = bytearray(16)
power_data[0:2] = (0x0034).to_bytes(2, byteorder='little')
power_data[2:4] = (current_power).to_bytes(2, byteorder='little')
power_data[4:8] = (int(current_power * 10)).to_bytes(4, byteorder='little')
power_data[8:12] = (0).to_bytes(4, byteorder='little')
power_data[12:14] = (current_cadence).to_bytes(2, byteorder='little')
power_data[14:16] = (0xBAD8).to_bytes(2, byteorder='little')
return bytes(power_data)
def generate_indoor_bike_data():
global current_speed, current_cadence
# Varia leggermente i valori
current_speed += random.uniform(-0.2, 0.2)
current_speed = max(0, min(60.0, current_speed))
# Crea Indoor Bike Data
bike_data = bytearray(8)
bike_data[0:2] = (0x0044).to_bytes(2, byteorder='little')
bike_data[2:4] = (int(current_speed * 100)).to_bytes(2, byteorder='little')
bike_data[4:6] = (current_cadence).to_bytes(2, byteorder='little')
bike_data[6:8] = (0).to_bytes(2, byteorder='little')
return bytes(bike_data)
async def run():
# Crea server con minimo di parametri
server = BlessServer(name=DEVICE_NAME)
server.read_request_func = read_request
server.write_request_func = write_request
logger.info(f"Configurazione del simulatore {DEVICE_NAME}...")
# 1. Servizi standard
# Aggiungi Cycling Power Service
await server.add_new_service(CYCLING_POWER_SERVICE)
await server.add_new_characteristic(
CYCLING_POWER_SERVICE,
CYCLING_POWER_MEASUREMENT,
GATTCharacteristicProperties.read | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable
)
await server.add_new_characteristic(
CYCLING_POWER_SERVICE,
CYCLING_POWER_FEATURE,
GATTCharacteristicProperties.read,
None,
GATTAttributePermissions.readable
)
await server.add_new_characteristic(
CYCLING_POWER_SERVICE,
CYCLING_POWER_CONTROL_POINT,
GATTCharacteristicProperties.write | GATTCharacteristicProperties.indicate,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
await server.add_new_characteristic(
CYCLING_POWER_SERVICE,
WAHOO_CUSTOM_CP_CHAR,
GATTCharacteristicProperties.write | GATTCharacteristicProperties.indicate,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
# Aggiungi Fitness Machine Service
await server.add_new_service(FITNESS_MACHINE_SERVICE)
await server.add_new_characteristic(
FITNESS_MACHINE_SERVICE,
INDOOR_BIKE_DATA,
GATTCharacteristicProperties.read | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable
)
await server.add_new_characteristic(
FITNESS_MACHINE_SERVICE,
FITNESS_MACHINE_CONTROL_POINT,
GATTCharacteristicProperties.write | GATTCharacteristicProperties.indicate,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
await server.add_new_characteristic(
FITNESS_MACHINE_SERVICE,
FITNESS_MACHINE_FEATURE,
GATTCharacteristicProperties.read,
None,
GATTAttributePermissions.readable
)
# 2. Servizi Wahoo personalizzati
# Wahoo Service 1
await server.add_new_service(WAHOO_SERVICE_1)
await server.add_new_characteristic(
WAHOO_SERVICE_1,
WAHOO_CHAR_1,
GATTCharacteristicProperties.write_without_response | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
await server.add_new_characteristic(
WAHOO_SERVICE_1,
WAHOO_CHAR_2,
GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable
)
# Wahoo Service 3
await server.add_new_service(WAHOO_SERVICE_3)
await server.add_new_characteristic(
WAHOO_SERVICE_3,
WAHOO_CHAR_3,
GATTCharacteristicProperties.write_without_response | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
# Wahoo Service 6
await server.add_new_service(WAHOO_SERVICE_6)
await server.add_new_characteristic(
WAHOO_SERVICE_6,
WAHOO_CHAR_4,
GATTCharacteristicProperties.write_without_response | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
# Wahoo Service B
await server.add_new_service(WAHOO_SERVICE_B)
await server.add_new_characteristic(
WAHOO_SERVICE_B,
WAHOO_CHAR_5,
GATTCharacteristicProperties.read | GATTCharacteristicProperties.write_without_response | GATTCharacteristicProperties.notify,
None,
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
)
logger.info("Configurazione dei servizi completata")
# Avvia il server
await server.start()
logger.info(f"{DEVICE_NAME} è ora in fase di advertising")
# Imposta i valori iniziali DOPO l'avvio del server
# Valori per servizi standard
server.get_characteristic(CYCLING_POWER_MEASUREMENT).value = generate_cycling_power_data()
server.get_characteristic(CYCLING_POWER_FEATURE).value = (0x08).to_bytes(4, byteorder='little')
server.get_characteristic(INDOOR_BIKE_DATA).value = generate_indoor_bike_data()
server.get_characteristic(FITNESS_MACHINE_FEATURE).value = (0x02C6).to_bytes(4, byteorder='little')
# Valori per caratteristiche Wahoo
server.get_characteristic(WAHOO_CHAR_1).value = bytearray(1)
server.get_characteristic(WAHOO_CHAR_2).value = bytearray(1)
server.get_characteristic(WAHOO_CHAR_3).value = bytearray(1)
server.get_characteristic(WAHOO_CHAR_4).value = bytearray(1)
server.get_characteristic(WAHOO_CHAR_5).value = bytearray(1)
# Loop di aggiornamento
try:
counter = 0
while True:
# Aggiorna i dati principali
server.get_characteristic(INDOOR_BIKE_DATA).value = generate_indoor_bike_data()
server.get_characteristic(CYCLING_POWER_MEASUREMENT).value = generate_cycling_power_data()
# Invia notifiche
server.update_value(FITNESS_MACHINE_SERVICE, INDOOR_BIKE_DATA)
server.update_value(CYCLING_POWER_SERVICE, CYCLING_POWER_MEASUREMENT)
if counter % 10 == 0: # Log ogni 10 cicli
logger.info(f"Potenza: {current_power}W, Cadenza: {current_cadence}rpm, Velocità: {current_speed:.1f}km/h")
counter += 1
await asyncio.sleep(0.1)
except KeyboardInterrupt:
logger.info("Arresto richiesto dall'utente")
except Exception as e:
logger.error(f"Errore durante l'esecuzione: {e}")
finally:
await server.stop()
logger.info("Server arrestato")
if __name__ == "__main__":
print("=" * 80)
print(f"Wahoo KICKR 51A6 BLE Simulator per macOS (Versione completa)")
print("=" * 80)
print(f"Avvio della simulazione di {DEVICE_NAME}")
print("Premi Ctrl+C per terminare il server")
print("=" * 80)
try:
asyncio.run(run())
except KeyboardInterrupt:
print("\nSimulazione fermata dall'utente")
except Exception as e:
print(f"Errore: {e}")
print("Potrebbe essere necessario eseguire questo script con sudo")
sys.exit(1)

View File

@@ -0,0 +1,37 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.associations": {
"list": "cpp",
"chrono": "cpp",
"complex": "cpp",
"functional": "cpp",
"optional": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"xlocnum": "cpp",
"xtr1common": "cpp",
"qhttpserver": "cpp",
"array": "cpp",
"deque": "cpp",
"map": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"xstring": "cpp",
"algorithm": "cpp",
"xutility": "cpp",
"xlocale": "cpp",
"filesystem": "cpp",
"bitset": "cpp",
"iterator": "cpp",
"xhash": "cpp",
"xtree": "cpp",
"ostream": "cpp",
"locale": "cpp"
}
}
}

View File

@@ -10,59 +10,87 @@ ColumnLayout {
property alias textFont: accordionText.font.family
property alias textFontSize: accordionText.font.pixelSize
property alias indicatRectColor: indicatRect.color
default property alias accordionContent: contentPlaceholder.data
spacing: 0
default property alias accordionContent: contentLoader.sourceComponent
Layout.fillWidth: true;
// Signal emitted when content becomes visible
signal contentBecameVisible()
spacing: 0
Layout.fillWidth: true
Rectangle {
id: accordionHeader
color: "red"
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true;
Layout.fillWidth: true
height: 48
Rectangle{
id:indicatRect
x: 16; y: 20
width: 8; height: 8
radius: 8
color: "white"
Rectangle {
id: indicatRect
x: 16; y: 20
width: 8; height: 8
radius: 8
color: "white"
}
Text {
id: accordionText
x:34;y:13
x: 34; y: 13
color: "#FFFFFF"
text: rootElement.title
}
Image {
y:13
anchors.right: parent.right
y: 13
anchors.right: parent.right
anchors.rightMargin: 20
width: 30; height: 30
id: indicatImg
source: "qrc:/icons/arrow-collapse-vertical.png"
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
rootElement.isOpen = !rootElement.isOpen
if(rootElement.isOpen)
{
if(rootElement.isOpen) {
indicatImg.source = "qrc:/icons/arrow-expand-vertical.png"
}else{
} else {
indicatImg.source = "qrc:/icons/arrow-collapse-vertical.png"
}
}
}
}
// This will get filled with the content
ColumnLayout {
id: contentPlaceholder
visible: rootElement.isOpen
Layout.fillWidth: true;
// Loader with enhanced visibility handling
Loader {
id: contentLoader
active: rootElement.isOpen
visible: false // Start invisible
Layout.fillWidth: true
asynchronous: false
onLoaded: {
if (item) {
item.Layout.fillWidth = true
visible = true
rootElement.contentBecameVisible()
}
}
// Handle visibility changes
onVisibleChanged: {
if (visible && status === Loader.Ready) {
rootElement.contentBecameVisible()
}
}
}
// Handle accordion closing
onIsOpenChanged: {
if (!isOpen) {
contentLoader.visible = false
}
}
}

4
src/CLAUDE.md Normal file
View File

@@ -0,0 +1,4 @@
when you add a setting remember:
- you have to add always as the last settings declared in the settings.qml
- if you have to add a setting also on another qml file, you need also to declare it there always putting as the last one
- in the qzsettings.cpp there is a allsettingscount that must be updated if you add a setting

View File

@@ -9,6 +9,7 @@ ColumnLayout {
anchors.fill: parent
Settings {
id: settings
property int chart_display_mode: 0
}
WebView {
id: webView
@@ -19,6 +20,9 @@ ColumnLayout {
if (loadRequest.errorString) {
console.error(loadRequest.errorString);
console.error("port " + settings.value("template_inner_QZWS_port"));
} else if (loadRequest.status === WebView.LoadSucceededStatus) {
// Send chart display mode to the web view
sendDisplayModeToWebView();
}
}
onVisibleChanged: {
@@ -28,4 +32,22 @@ ColumnLayout {
}
}
}
// Watch for changes in chart display mode setting
Connections {
target: settings
function onChart_display_modeChanged() {
sendDisplayModeToWebView();
}
}
function sendDisplayModeToWebView() {
if (webView.loading === false) {
webView.runJavaScript("
if (window.setChartDisplayMode) {
window.setChartDisplayMode(" + settings.chart_display_mode + ");
}
");
}
}
}

View File

@@ -92,7 +92,7 @@ class BluetoothHandler : public QObject
void onKeyPressed(int keyCode)
{
qDebug() << "Key pressed:" << keyCode;
if (m_bluetooth && m_bluetooth->device() && m_bluetooth->device()->deviceType() == bluetoothdevice::BIKE) {
if (m_bluetooth && m_bluetooth->device() && m_bluetooth->device()->deviceType() == BIKE) {
if (keyCode == 115) // up
((bike*)m_bluetooth->device())->setGears(((bike*)m_bluetooth->device())->gears() + 1);
else if (keyCode == 114) // down

View File

@@ -13,22 +13,32 @@ ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
FileDialog {
id: fileDialogTrainProgram
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogTrainProgram.fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileDialogTrainProgram.fileUrl)
} else {
trainprogram_open_clicked(fileDialogTrainProgram.fileUrl)
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileUrl)
} else {
trainprogram_open_clicked(fileUrl)
}
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
fileDialogTrainProgram.close()
}
onRejected: {
console.log("Canceled")
fileDialogTrainProgram.close()
}
}
@@ -263,7 +273,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'gpx')
fileDialogTrainProgram.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

View File

@@ -72,7 +72,19 @@ HomeForm {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("New lap started!")
}
}
}
}
MessageDialog {
id: stopConfirmationDialog
text: qsTr("Stop Workout")
informativeText: qsTr("Do you really want to stop the current workout?")
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {
close();
inner_stop();
}
onNoClicked: close()
}
Timer {
@@ -141,7 +153,11 @@ HomeForm {
start.onClicked: { start_clicked(); }
stop.onClicked: {
inner_stop();
if (rootItem.confirmStopEnabled()) {
stopConfirmationDialog.open();
} else {
inner_stop();
}
}
lap.onClicked: { lap_clicked(); popupLap.open(); popupLapAutoClose.running = true; }

View File

@@ -165,7 +165,7 @@ Page {
width: parent.width
anchors.top: row1.bottom
anchors.topMargin: 30
text: "This app should automatically connect to your bike/treadmill/rower. <b>If it doesn't, please check</b>:<br>1) your Echelon/Domyos App MUST be closed while qdomyos-zwift is running;<br>2) bluetooth and bluetooth permission MUST be on<br>3) your bike/treadmill/rower should be turned on BEFORE starting this app<br>4) try to restart your device<br><br>If your bike/treadmill disconnects every 30 seconds try to disable the 'virtual device' setting on the left bar.<br><br>In case of issues, please feel free to contact me at roberto.viola83@gmail.com.<br><br><b>Have a nice ride!</b><br/ ><i>QZ specifically disclaims liability for<br>incidental or consequential damages and assumes<br>no responsibility or liability for any loss<br>or damage suffered by any person as a result of<br>the use or misuse of the app.</i><br><br>Roberto Viola"
text: "This app should automatically connect to your bike/treadmill/rower. <b>If it doesn't, please check</b>:<br>1) your Echelon/Domyos App MUST be closed while qdomyos-zwift is running;<br>2) both Bluetooth and Bluetooth permissions MUST be enabled<br>3) your bike/treadmill/rower should be turned on BEFORE starting this app<br>4) try to restart your device<br><br>If your bike/treadmill disconnects every 30 seconds try to disable the 'virtual device' setting on the left bar.<br><br>In case of issues, please feel free to contact me at roberto.viola83@gmail.com.<br><br><b>Have a nice ride!</b><br/ ><i>QZ specifically disclaims liability for<br>incidental or consequential damages and assumes<br>no responsibility or liability for any loss<br>or damage suffered by any person as a result of<br>the use or misuse of the app.</i><br><br>Roberto Viola"
wrapMode: Label.WordWrap
visible: rootItem.labelHelp
}

View File

@@ -0,0 +1,20 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.0
import Qt.labs.settings 1.0
import QtQuick.Dialogs 1.0
SwitchDelegate {
id: root
MouseArea {
anchors.fill: parent
onClicked: {
if (mouse.x > parent.width - parent.indicator.width) {
root.checked = !root.checked
root.clicked()
}
}
}
}

26
src/OAuth2.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef OAUTH2_H
#define OAUTH2_H
#include <QString>
#include <QTextStream>
struct OAuth2Parameter {
QString responseType = QStringLiteral("code");
QString approval_prompt = QStringLiteral("force");
inline bool isEmpty() const { return responseType.isEmpty() && approval_prompt.isEmpty(); }
QString toString() const {
QString msg;
QTextStream out(&msg);
out << QStringLiteral("OAuth2Parameter{\n") << QStringLiteral("responseType: ") << this->responseType
<< QStringLiteral("\n") << QStringLiteral("approval_prompt: ") << this->approval_prompt
<< QStringLiteral("\n");
return msg;
}
};
#define _STR(x) #x
#define STRINGIFY(x) _STR(x)
#endif // OAUTH2_H

51
src/PreviewChart.qml Normal file
View File

@@ -0,0 +1,51 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.0
import Qt.labs.settings 1.0
import QtWebView 1.1
ColumnLayout {
signal popupclose()
id: column1
spacing: 10
anchors.fill: parent
Settings {
id: settings
}
WebView {
id: webView
anchors.fill: parent
url: "http://localhost:" + settings.value("template_inner_QZWS_port") + "/previewchart/chart.htm"
visible: true
onLoadingChanged: {
if (loadRequest.errorString) {
console.error(loadRequest.errorString);
console.error("port " + settings.value("template_inner_QZWS_port"));
}
}
}
Timer {
id: chartJscheckStartFromWeb
interval: 200; running: true; repeat: true
onTriggered: {if(rootItem.startRequested) {rootItem.startRequested = false; rootItem.stopRequested = false; stackView.pop(); }}
}
Button {
id: closeButton
height: 50
width: parent.width
text: "Close"
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
popupclose();
}
anchors {
bottom: parent.bottom
}
}
Component.onCompleted: {
headerToolbar.visible = true;
}
}

View File

@@ -7,22 +7,32 @@ import QtQuick.Dialogs 1.0
ColumnLayout {
signal loadSettings(url name)
FileDialog {
id: fileDialogSettings
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogSettings.fileUrl)
loadSettings(fileDialogSettings.fileUrl)
fileDialogSettings.close()
}
onRejected: {
console.log("Canceled")
fileDialogSettings.close()
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
loadSettings(fileUrl)
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
}
}
AccordionElement {
StaticAccordionElement {
title: qsTr("Settings folder")
indicatRectColor: Material.color(Material.Grey)
textColor: Material.color(Material.Grey)
@@ -106,7 +116,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'settings')
fileDialogSettings.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

View File

@@ -0,0 +1,68 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
ColumnLayout {
id: rootElement
property bool isOpen: false
property string title: ""
property alias color: accordionHeader.color
property alias textColor: accordionText.color
property alias textFont: accordionText.font.family
property alias textFontSize: accordionText.font.pixelSize
property alias indicatRectColor: indicatRect.color
default property alias accordionContent: contentPlaceholder.data
spacing: 0
Layout.fillWidth: true;
Rectangle {
id: accordionHeader
color: "red"
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true;
height: 48
Rectangle{
id:indicatRect
x: 16; y: 20
width: 8; height: 8
radius: 8
color: "white"
}
Text {
id: accordionText
x:34;y:13
color: "#FFFFFF"
text: rootElement.title
}
Image {
y:13
anchors.right: parent.right
anchors.rightMargin: 20
width: 30; height: 30
id: indicatImg
source: "qrc:/icons/arrow-collapse-vertical.png"
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
rootElement.isOpen = !rootElement.isOpen
if(rootElement.isOpen)
{
indicatImg.source = "qrc:/icons/arrow-expand-vertical.png"
}else{
indicatImg.source = "qrc:/icons/arrow-collapse-vertical.png"
}
}
}
}
// This will get filled with the content
ColumnLayout {
id: contentPlaceholder
visible: rootElement.isOpen
Layout.fillWidth: true;
}
}

View File

@@ -1,4 +1,6 @@
import QtQuick 2.0
import AndroidStatusBar 1.0
import QtQuick.Window 2.12
/**
* adapted from StackOverflow:
@@ -29,7 +31,9 @@ ListView {
z: Infinity
spacing: 5
anchors.fill: parent
anchors.bottomMargin: 10
anchors.bottomMargin: (Qt.platform.os === "android" && AndroidStatusBar.apiLevel >= 31) ?
((Screen.orientation === Qt.PortraitOrientation || Screen.orientation === Qt.InvertedPortraitOrientation) ?
AndroidStatusBar.navigationBarHeight + 10 : 10) : 10
verticalLayoutDirection: ListView.BottomToTop
interactive: false

View File

@@ -11,22 +11,32 @@ ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
FileDialog {
id: fileDialogTrainProgram
title: "Please choose a file"
folder: shortcuts.home
onAccepted: {
console.log("You chose: " + fileDialogTrainProgram.fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileDialogTrainProgram.fileUrl)
} else {
trainprogram_open_clicked(fileDialogTrainProgram.fileUrl)
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
folder: shortcuts.home
visible: true
onAccepted: {
console.log("You chose: " + fileUrl)
if(OS_VERSION === "Android") {
trainprogram_open_other_folder(fileUrl)
} else {
trainprogram_open_clicked(fileUrl)
}
close()
// Destroy and recreate the dialog for next use
fileDialogLoader.active = false
}
onRejected: {
console.log("Canceled")
close()
// Destroy the dialog
fileDialogLoader.active = false
}
}
fileDialogTrainProgram.close()
}
onRejected: {
console.log("Canceled")
fileDialogTrainProgram.close()
}
}
@@ -296,7 +306,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'training')
fileDialogTrainProgram.visible = true
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom

80
src/WebPelotonAuth.qml Normal file
View File

@@ -0,0 +1,80 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtQuick.Dialogs 1.0
import QtGraphicalEffects 1.12
import Qt.labs.settings 1.0
import QtMultimedia 5.15
import QtQuick.Layouts 1.3
import QtWebView 1.1
Item {
id: pelotonAuthPage
anchors.fill: parent
height: parent.height
width: parent.width
visible: true
// Signal to notify the parent stack when we want to go back
signal goBack()
WebView {
anchors.fill: parent
height: parent.height
width: parent.width
visible: !rootItem.pelotonPopupVisible
url: rootItem.getPelotonAuthUrl
}
Popup {
id: popupPelotonConnectedWeb
parent: Overlay.overlay
enabled: rootItem.pelotonPopupVisible
onEnabledChanged: { if(rootItem.pelotonPopupVisible) popupPelotonConnectedWeb.open() }
onClosed: {
rootItem.pelotonPopupVisible = false;
// Attempt to go back to the previous view after the popup is closed
goBack();
}
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 380
height: 120
modal: true
focus: true
palette.text: "white"
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
enter: Transition
{
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition
{
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
Column {
anchors.horizontalCenter: parent.horizontalCenter
Label {
anchors.horizontalCenter: parent.horizontalCenter
width: 370
height: 120
text: qsTr("Your Peloton account is now connected!")
}
}
// Add a MouseArea to capture clicks anywhere on the popup
MouseArea {
anchors.fill: parent
onClicked: {
popupPelotonConnectedWeb.close();
}
}
}
// Component is being completed
Component.onCompleted: {
console.log("WebPelotonAuth loaded")
}
}

View File

@@ -5,6 +5,7 @@ import Qt.labs.settings 1.0
Page {
id: wizardPage
objectName: "wizardPage"
property int currentStep: 0
property var selectedOptions: ({})
@@ -335,7 +336,7 @@ Page {
Text {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Peloton Login")
text: qsTr("Connect to Peloton")
font.pixelSize: 24
font.bold: true
color: "white"
@@ -343,56 +344,38 @@ Page {
Text {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Username")
text: qsTr("Click the button below to connect your Peloton account")
font.pixelSize: 20
font.bold: true
wrapMode: Text.WordWrap
Layout.fillWidth: true
width: stackViewLocal.width * 0.8
horizontalAlignment: Text.AlignHCenter
color: "white"
}
TextField {
id: pelotonUsernameTextField
text: settings.peloton_username
horizontalAlignment: Text.AlignHCenter
Image {
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: false
onAccepted: settings.peloton_username = text
onActiveFocusChanged: if(this.focus) this.cursorPosition = this.text.length
}
source: "icons/icons/Button_Connect_Rect_DarkMode.png"
fillMode: Image.PreserveAspectFit
width: parent.width * 0.8
Text {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Password")
font.pixelSize: 20
font.bold: true
color: "white"
}
TextField {
id: pelotonPasswordTextField
text: settings.peloton_password
horizontalAlignment: Text.AlignHCenter
Layout.fillHeight: false
Layout.alignment: Qt.AlignHCenter
inputMethodHints: Qt.ImhHiddenText
echoMode: TextInput.PasswordEchoOnEdit
onAccepted: settings.peloton_password = text
onActiveFocusChanged: if(this.focus) this.cursorPosition = this.text.length
MouseArea {
anchors.fill: parent
onClicked: {
stackViewLocal.push("WebPelotonAuth.qml")
stackViewLocal.currentItem.goBack.connect(function() {
stackViewLocal.pop();
stackViewLocal.push(pelotonDifficultyComponent)
})
peloton_connect_clicked()
}
}
}
Item {
Layout.preferredHeight: 50
}
WizardButton {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Next")
onClicked: {
settings.peloton_username = pelotonUsernameTextField.text;
settings.peloton_password = pelotonPasswordTextField.text;
stackViewLocal.push(pelotonDifficultyComponent)
}
}
WizardButton {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Back")
@@ -862,7 +845,6 @@ Page {
text: qsTr("Finish")
onClicked: {
settings.tile_gears_enabled = true;
settings.gears_gain = 0.5;
stackViewLocal.push(finalStepComponent);
}
}
@@ -921,7 +903,6 @@ Page {
text: qsTr("Finish")
onClicked: {
settings.tile_gears_enabled = true;
settings.gears_gain = 1;
stackViewLocal.push(finalStepComponent);
}
}

71
src/WorkoutTypeTag.qml Normal file
View File

@@ -0,0 +1,71 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Rectangle {
id: root
property string workoutSource: "QZ"
property alias text: tagText.text
// Auto-size based on text
width: tagText.implicitWidth + 16
height: 24
radius: 12
// Color scheme based on workout source
color: {
switch(workoutSource.toUpperCase()) {
case "PELOTON": return "#ff6b35"
case "ZWIFT": return "#ff6900"
case "ERG": return "#8bc34a"
case "QZ": return "#2196f3"
case "MANUAL": return "#757575"
default: return "#9e9e9e"
}
}
// Subtle border for better definition
border.color: Qt.darker(color, 1.2)
border.width: 1
Text {
id: tagText
anchors.centerIn: parent
text: workoutSource.toUpperCase()
color: "white"
font.pixelSize: 10
font.bold: true
font.family: "Arial"
}
// Subtle shadow effect
Rectangle {
anchors.fill: parent
anchors.topMargin: 1
anchors.leftMargin: 1
radius: parent.radius
color: "#20000000"
z: -1
}
// Hover effect for interactivity feedback
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.scale = 1.05
}
onExited: {
parent.scale = 1.0
}
Behavior on scale {
NumberAnimation {
duration: 150
easing.type: Easing.OutQuad
}
}
}
}

910
src/WorkoutsHistory.qml Normal file
View File

@@ -0,0 +1,910 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtCharts 2.15
import Qt.labs.calendar 1.0
Page {
id: workoutHistoryPage
// Signal for chart preview
signal fitfile_preview_clicked(var url)
// Helper function to wrap text with emoji font only on Android
function wrapEmoji(emoji) {
return Qt.platform.os === "android" ?
'<font face="' + fontManager.emojiFontFamily + '">' + emoji + '</font>' :
emoji;
}
// Sport type to icon mapping (using FIT_SPORT values)
function getSportIcon(sport) {
switch(parseInt(sport)) {
case 1: // FIT_SPORT_RUNNING
case 11: // FIT_SPORT_WALKING
return "🏃"; // Running/Walking
case 2: // FIT_SPORT_CYCLING
return "🚴"; // Cycling
case 4: // FIT_SPORT_FITNESS_EQUIPMENT (Elliptical)
return "⭕"; // Elliptical
case 15: // FIT_SPORT_ROWING
return "🚣"; // Rowing
case 84: // FIT_SPORT_JUMPROPE
return "🪢"; // Jump Rope
default:
return "💪"; // Generic workout
}
}
ColumnLayout {
anchors.fill: parent
spacing: 10
// Header
Rectangle {
Layout.fillWidth: true
height: 60
color: "#f5f5f5"
// Calendar Icon Button - positioned absolutely on the left
Button {
id: calendarButton
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 12
width: 48
height: 48
background: Rectangle {
radius: 8
color: calendarButton.pressed ? "#e0e0e0" : "#f0f0f0"
border.color: "#d0d0d0"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("📅") :
"📅"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
calendarPopup.open()
}
}
// Title with filter status - centered
Column {
anchors.centerIn: parent
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: "Workout History"
font.pixelSize: 24
font.bold: true
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: workoutModel && workoutModel.isDateFiltered ?
"Filtered: " + workoutModel.filteredDate.toLocaleDateString() : ""
font.pixelSize: 12
color: "#666666"
visible: workoutModel && workoutModel.isDateFiltered
}
}
// Clear Filter Button - positioned absolutely on the right
Button {
id: clearFilterButton
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 12
width: 100
height: 36
visible: workoutModel && workoutModel.isDateFiltered
background: Rectangle {
radius: 6
color: clearFilterButton.pressed ? "#ff6666" : "#ff8888"
border.color: "#ff4444"
border.width: 1
}
contentItem: Text {
text: "Clear Filter"
color: "white"
font.pixelSize: 12
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
workoutModel.clearDateFilter()
}
}
}
// Loading indicator
BusyIndicator {
id: loadingIndicator
Layout.alignment: Qt.AlignHCenter
visible: workoutModel ? (workoutModel.isLoading || workoutModel.isDatabaseProcessing) : false
running: visible
}
// Database processing message
Text {
Layout.alignment: Qt.AlignHCenter
visible: workoutModel ? workoutModel.isDatabaseProcessing : false
text: "Processing workout files...\nThis may take a few moments on first startup."
horizontalAlignment: Text.AlignHCenter
color: "#666666"
font.pixelSize: 16
}
// Workout List
ListView {
id: workoutListView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.bottomMargin: streakBanner.visible ? streakBanner.height + 10 : 10
model: workoutModel
spacing: 8
clip: true
onContentYChanged: {
// Hide banner when scrolling down, show when at top
streakBanner.visible = contentY <= 20
}
delegate: SwipeDelegate {
id: swipeDelegate
width: parent.width
height: 135
Component.onCompleted: {
console.log("Delegate data:", JSON.stringify({
sport: sport,
title: title,
date: date,
duration: duration,
distance: distance,
calories: calories,
id: id
}))
}
swipe.right: Rectangle {
width: parent.width
height: parent.height
color: "#FF4444"
clip: true
Row {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 20
Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🗑️") + " Delete" :
"🗑️ Delete"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
color: "white"
font.pixelSize: 16
anchors.verticalCenter: parent.verticalCenter
}
}
}
swipe.onCompleted: {
// Show confirmation dialog
confirmDialog.workoutId = model.id
confirmDialog.workoutTitle = model.title
confirmDialog.open()
}
// Card-like container
Rectangle {
anchors.fill: parent
anchors.margins: 8
radius: 10
color: "white"
border.color: "#e0e0e0"
// Workout Type Tag - positioned absolutely in top-right
WorkoutTypeTag {
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 12
workoutSource: workoutModel ? workoutModel.getWorkoutSource(model.id) : "QZ"
}
// Action buttons - positioned absolutely in bottom-right
Row {
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 12
spacing: 8
// Peloton URL button
Button {
width: 40
height: 45
visible: workoutModel && workoutModel.getWorkoutSource(model.id) === "PELOTON" &&
workoutModel.getPelotonUrl(model.id) !== ""
background: Rectangle {
color: parent.pressed ? "#ff8855" : "#ff6b35"
radius: 6
border.color: "#cc5529"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🌐") :
"🌐"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 16
color: "white"
anchors.centerIn: parent
}
onClicked: {
workoutModel.openPelotonUrl(model.id)
}
}
// Training Program button
Button {
width: 40
height: 45
visible: workoutModel && workoutModel.hasTrainingProgram(model.id)
background: Rectangle {
color: parent.pressed ? "#1976d2" : "#2196f3"
radius: 6
border.color: "#1565c0"
border.width: 1
}
contentItem: Text {
text: Qt.platform.os === "android" ?
wrapEmoji("📋") :
"📋"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 16
color: "white"
anchors.centerIn: parent
}
onClicked: {
var success = workoutModel.loadTrainingProgram(model.id)
if (success) {
trainingProgramDialog.title = "Success"
trainingProgramDialog.message = "Training program loaded successfully!"
trainingProgramDialog.isSuccess = true
} else {
trainingProgramDialog.title = "Error"
trainingProgramDialog.message = "Failed to load training program. Please check if the file exists."
trainingProgramDialog.isSuccess = false
}
trainingProgramDialog.open()
}
}
}
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 16
// Sport icon
Column {
Layout.alignment: Qt.AlignVCenter
Text {
text: Qt.platform.os === "android" ?
wrapEmoji(getSportIcon(sport)) :
getSportIcon(sport)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: 32
}
}
// Workout info
ColumnLayout {
Layout.fillWidth: true
spacing: 4
// Title row (without tag) with auto-scrolling
Rectangle {
Layout.fillWidth: true
Layout.rightMargin: 80 // Reserve space for tag
Layout.preferredHeight: 24
clip: true
color: "transparent"
Text {
id: titleText
text: title
font.bold: true
font.pixelSize: 18
anchors.verticalCenter: parent.verticalCenter
// Auto-scroll animation for long titles
SequentialAnimation on x {
running: titleText.contentWidth > titleText.parent.width
loops: Animation.Infinite
NumberAnimation {
from: 0
to: -(titleText.contentWidth - titleText.parent.width + 20)
duration: Math.max(3000, titleText.contentWidth * 30)
}
PauseAnimation { duration: 1500 }
NumberAnimation {
from: -(titleText.contentWidth - titleText.parent.width + 20)
to: 0
duration: Math.max(3000, titleText.contentWidth * 30)
}
PauseAnimation { duration: 2000 }
}
}
}
Text {
text: date
color: "#666666"
}
// Stats row
RowLayout {
spacing: 16
Text {
text: "⏱ " + duration
}
Text {
text: "📏 " + distance.toFixed(2) + " km"
}
}
RowLayout {
spacing: 16
Text {
text: Qt.platform.os === "android" ?
wrapEmoji("🔥") + " " + Math.round(calories) + " kcal" :
"🔥 " + Math.round(calories) + " kcal"
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
}
}
}
}
}
onClicked: {
console.log("Workout clicked, ID:", model.id)
// Get workout details from the model
var details = workoutModel.getWorkoutDetails(model.id)
console.log("Workout details:", JSON.stringify(details))
// Emit signal with file URL for chart preview - same pattern as profiles.qml
console.log("Emitting fitfile_preview_clicked with path:", details.filePath)
// Convert to URL like profiles.qml does with FolderListModel
var fileUrl = "file://" + details.filePath
console.log("Converted to URL:", fileUrl)
workoutHistoryPage.fitfile_preview_clicked(fileUrl)
// Push the ChartJsTest view
stackView.push("PreviewChart.qml")
}
}
}
}
// Confirmation Dialog
Dialog {
id: confirmDialog
property int workoutId
property string workoutTitle
title: "Delete Workout"
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Text {
text: "Are you sure you want to delete '" + confirmDialog.workoutTitle + "'?"
}
onAccepted: {
workoutModel.deleteWorkout(confirmDialog.workoutId)
swipeDelegate.swipe.close()
}
onRejected: {
swipeDelegate.swipe.close()
}
}
// Training Program Loading Dialog
Dialog {
id: trainingProgramDialog
property string message: ""
property bool isSuccess: true
modal: true
standardButtons: Dialog.Ok
x: (parent.width - width) / 2
y: (parent.height - height) / 2
background: Rectangle {
color: "white"
radius: 8
border.color: trainingProgramDialog.isSuccess ? "#4caf50" : "#f44336"
border.width: 2
}
header: Rectangle {
height: 50
color: trainingProgramDialog.isSuccess ? "#4caf50" : "#f44336"
radius: 8
Text {
anchors.centerIn: parent
text: trainingProgramDialog.title
color: "white"
font.pixelSize: 18
font.bold: true
}
}
contentItem: ColumnLayout {
spacing: 16
Text {
Layout.margins: 20
Layout.preferredWidth: 300
Layout.preferredHeight: 120
text: Qt.platform.os === "android" ?
wrapEmoji("🔥") + " " +
wrapEmoji(trainingProgramDialog.isSuccess ? '✅' : '❌') +
" " + trainingProgramDialog.message :
"🔥 " + (trainingProgramDialog.isSuccess ? '✅ ' : '❌ ') + trainingProgramDialog.message
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 14
}
}
}
// Streak Banner at the bottom
Rectangle {
id: streakBanner
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 80
visible: workoutModel
Behavior on visible {
NumberAnimation {
properties: "opacity"
duration: 300
easing.type: Easing.InOutQuad
}
}
// Special pulsing effect for major milestones
SequentialAnimation on opacity {
running: workoutModel && workoutModel.currentStreak >= 30
loops: Animation.Infinite
NumberAnimation { from: 0.9; to: 1.0; duration: 1500; easing.type: Easing.InOutSine }
NumberAnimation { from: 1.0; to: 0.9; duration: 1500; easing.type: Easing.InOutSine }
}
gradient: Gradient {
GradientStop {
position: 0.0;
color: workoutModel && (workoutModel.currentStreak >= 365) ? "#FFD700" :
workoutModel && (workoutModel.currentStreak >= 180) ? "#9932CC" :
workoutModel && (workoutModel.currentStreak >= 90) ? "#FF1493" :
workoutModel && (workoutModel.currentStreak >= 30) ? "#FF4500" :
workoutModel && (workoutModel.currentStreak >= 7) ? "#FF6347" : "#FF6B35"
}
GradientStop {
position: 1.0;
color: workoutModel && (workoutModel.currentStreak >= 365) ? "#FFA500" :
workoutModel && (workoutModel.currentStreak >= 180) ? "#8A2BE2" :
workoutModel && (workoutModel.currentStreak >= 90) ? "#DC143C" :
workoutModel && (workoutModel.currentStreak >= 30) ? "#FF6B35" :
workoutModel && (workoutModel.currentStreak >= 7) ? "#FF4500" : "#F7931E"
}
}
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#40FFFFFF" }
GradientStop { position: 1.0; color: "#00FFFFFF" }
}
}
ColumnLayout {
anchors.centerIn: parent
spacing: 4
// Current streak with count
RowLayout {
Layout.alignment: Qt.AlignHCenter
spacing: 15
// Fire emoji with animation
Text {
text: Qt.platform.os === "android" ? (
workoutModel && workoutModel.currentStreak >= 365 ? wrapEmoji("👑🔥") :
workoutModel && workoutModel.currentStreak >= 180 ? wrapEmoji("🎖️🔥") :
workoutModel && workoutModel.currentStreak >= 90 ? wrapEmoji("🦁🔥") :
workoutModel && workoutModel.currentStreak >= 30 ? wrapEmoji("🎊🔥") :
workoutModel && workoutModel.currentStreak >= 7 ? wrapEmoji("🏆🔥") : wrapEmoji("🔥")
) : (
workoutModel && workoutModel.currentStreak >= 365 ? "👑🔥" :
workoutModel && workoutModel.currentStreak >= 180 ? "🎖️🔥" :
workoutModel && workoutModel.currentStreak >= 90 ? "🦁🔥" :
workoutModel && workoutModel.currentStreak >= 30 ? "🎊🔥" :
workoutModel && workoutModel.currentStreak >= 7 ? "🏆🔥" : "🔥"
)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: workoutModel && workoutModel.currentStreak >= 7 ? 28 : 24
SequentialAnimation on scale {
running: workoutModel && workoutModel.currentStreak > 0
loops: Animation.Infinite
NumberAnimation {
from: 1.0;
to: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
duration: workoutModel && workoutModel.currentStreak >= 365 ? 600 : 800;
easing.type: Easing.InOutSine
}
NumberAnimation {
from: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
to: 1.0;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 600 : 800;
easing.type: Easing.InOutSine
}
}
// Special sparkle effect for year achievement
SequentialAnimation on rotation {
running: workoutModel && workoutModel.currentStreak >= 7
loops: Animation.Infinite
NumberAnimation { from: 0; to: 360; duration: 3000; easing.type: Easing.Linear }
}
}
// Current streak count
Text {
text: workoutModel ? workoutModel.currentStreak + " day" + (workoutModel.currentStreak !== 1 ? "s" : "") + " streak" : ""
font.pixelSize: 18
font.bold: true
color: "white"
visible: workoutModel
}
// Another fire emoji
Text {
text: Qt.platform.os === "android" ? (
workoutModel && workoutModel.currentStreak >= 365 ? wrapEmoji("🔥👑") :
workoutModel && workoutModel.currentStreak >= 180 ? wrapEmoji("🔥🎖️") :
workoutModel && workoutModel.currentStreak >= 90 ? wrapEmoji("🔥🦁") :
workoutModel && workoutModel.currentStreak >= 30 ? wrapEmoji("🔥🎊") :
workoutModel && workoutModel.currentStreak >= 7 ? wrapEmoji("🔥🏆") : wrapEmoji("🔥")
) : (
workoutModel && workoutModel.currentStreak >= 365 ? "🔥👑" :
workoutModel && workoutModel.currentStreak >= 180 ? "🔥🎖️" :
workoutModel && workoutModel.currentStreak >= 90 ? "🔥🦁" :
workoutModel && workoutModel.currentStreak >= 30 ? "🔥🎊" :
workoutModel && workoutModel.currentStreak >= 7 ? "🔥🏆" : "🔥"
)
textFormat: Qt.platform.os === "android" ? Text.RichText : Text.PlainText
font.pixelSize: workoutModel && workoutModel.currentStreak >= 365 ? 28 : 24
SequentialAnimation on scale {
running: workoutModel && workoutModel.currentStreak > 0
loops: Animation.Infinite
NumberAnimation {
from: 1.0;
to: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 700 : 1000;
easing.type: Easing.InOutSine
}
NumberAnimation {
from: workoutModel && workoutModel.currentStreak >= 7 ? 1.4 : 1.2;
to: 1.0;
duration: workoutModel && workoutModel.currentStreak >= 7 ? 700 : 1000;
easing.type: Easing.InOutSine
}
}
// Counter-rotation for variety
SequentialAnimation on rotation {
running: workoutModel && workoutModel.currentStreak >= 7
loops: Animation.Infinite
NumberAnimation { from: 0; to: -360; duration: 3500; easing.type: Easing.Linear }
}
}
}
// Motivational message
Text {
Layout.alignment: Qt.AlignHCenter
text: workoutModel ? workoutModel.streakMessage : ""
font.pixelSize: 14
font.italic: true
color: "white"
visible: workoutModel && workoutModel.streakMessage !== ""
opacity: 0.9
}
// Best streak (smaller text)
Text {
Layout.alignment: Qt.AlignHCenter
text: workoutModel ? "Personal best: " + workoutModel.longestStreak + " day" + (workoutModel.longestStreak !== 1 ? "s" : "") : ""
font.pixelSize: 12
color: "white"
visible: workoutModel && workoutModel.longestStreak > workoutModel.currentStreak && workoutModel.longestStreak > 0
opacity: 0.7
}
}
// Subtle shadow effect at the top
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 2
gradient: Gradient {
GradientStop { position: 0.0; color: "#40000000" }
GradientStop { position: 1.0; color: "#00000000" }
}
}
}
// Calendar Popup
Popup {
id: calendarPopup
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: Math.min(parent.width * 0.9, 400)
height: Math.min(parent.height * 0.8, 500)
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
onOpened: {
// Refresh workout dates when calendar opens
if (workoutModel) {
calendar.workoutDates = workoutModel.getWorkoutDates()
console.log("Calendar opened, refreshed workout dates:", JSON.stringify(calendar.workoutDates))
}
}
background: Rectangle {
color: "white"
radius: 12
border.color: "#d0d0d0"
border.width: 1
// Shadow effect
Rectangle {
anchors.fill: parent
anchors.topMargin: 2
anchors.leftMargin: 2
radius: parent.radius
color: "#40000000"
z: -1
}
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 16
spacing: 12
// Calendar Header
RowLayout {
Layout.fillWidth: true
Button {
text: "<"
onClicked: calendar.selectedDate = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() - 1, 1)
}
Text {
Layout.fillWidth: true
text: calendar.selectedDate.toLocaleDateString(Qt.locale(), "MMMM yyyy")
font.pixelSize: 18
font.bold: true
horizontalAlignment: Text.AlignHCenter
}
Button {
text: ">"
onClicked: calendar.selectedDate = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() + 1, 1)
}
}
// Calendar Grid
GridLayout {
id: calendar
Layout.fillWidth: true
Layout.fillHeight: true
columns: 7
property date selectedDate: new Date()
property var workoutDates: workoutModel ? workoutModel.getWorkoutDates() : []
// Debug: print workout dates when they change
onWorkoutDatesChanged: {
console.log("Calendar workout dates updated:", JSON.stringify(workoutDates))
}
// Day headers
Repeater {
model: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
text: modelData
font.bold: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "#666666"
}
}
// Calendar days
Repeater {
model: getCalendarDays()
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: 40
property date dayDate: modelData.date
property bool isCurrentMonth: modelData.currentMonth
property bool hasWorkout: modelData.hasWorkout
property bool isToday: dayDate.toDateString() === new Date().toDateString()
color: {
if (mouseArea.pressed) return "#e3f2fd"
if (isToday) return "#bbdefb"
if (!isCurrentMonth) return "#f5f5f5"
return "white"
}
border.color: isToday ? "#2196f3" : "#e0e0e0"
border.width: isToday ? 2 : 1
radius: 4
Column {
anchors.centerIn: parent
spacing: 2
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: dayDate.getDate()
color: isCurrentMonth ? "black" : "#cccccc"
font.pixelSize: 14
}
// Workout indicator dot
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: 8
height: 8
radius: 4
color: "#ff6b35"
visible: hasWorkout
border.width: 1
border.color: "#cc5529"
// Debug: log when a dot should be visible
Component.onCompleted: {
if (hasWorkout) {
console.log("Workout dot visible for date:", dayDate.toDateString())
}
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
if (isCurrentMonth) {
var year = dayDate.getFullYear();
var month = dayDate.getMonth() + 1; // i mesi JS sono 0-indicizzati
var day = dayDate.getDate();
var dateString = year + "-" + (month < 10 ? '0' + month : month) + "-" + (day < 10 ? '0' + day : day);
workoutModel.setDateFilter(dateString);
calendarPopup.close();
}
}
}
}
}
}
// Close button
Button {
Layout.alignment: Qt.AlignHCenter
text: "Close"
onClicked: calendarPopup.close()
}
}
}
// JavaScript functions for calendar
function getCalendarDays() {
var days = []
var firstDay = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth(), 1)
var lastDay = new Date(calendar.selectedDate.getFullYear(), calendar.selectedDate.getMonth() + 1, 0)
var startDate = new Date(firstDay)
startDate.setDate(startDate.getDate() - firstDay.getDay()) // Go back to start of week
var workoutDates = calendar.workoutDates || []
console.log("getCalendarDays: workoutDates received:", JSON.stringify(workoutDates))
// workoutDates is now a QStringList (array of strings in format "yyyy-MM-dd")
var workoutDateStrings = workoutDates || []
console.log("Final workout date strings:", JSON.stringify(workoutDateStrings))
for (var i = 0; i < 42; i++) { // 6 rows x 7 days
var currentDate = new Date(startDate)
currentDate.setDate(startDate.getDate() + i)
// Costruisci la stringa YYYY-MM-DD dai componenti della data locale per evitare problemi di fuso orario
var year = currentDate.getFullYear();
var month = currentDate.getMonth() + 1; // i mesi JS sono 0-indicizzati
var day = currentDate.getDate();
var localDateString = year + "-" + (month < 10 ? '0' + month : month) + "-" + (day < 10 ? '0' + day : day);
var hasWorkout = workoutDateStrings.indexOf(localDateString) !== -1;
if (hasWorkout) {
// Questo console.log ora utilizza la stringa della data locale corretta per la corrispondenza
console.log("Found workout match for:", localDateString);
}
var isCurrentMonth = currentDate.getMonth() === calendar.selectedDate.getMonth()
days.push({
date: currentDate,
currentMonth: isCurrentMonth,
hasWorkout: hasWorkout
})
}
console.log("getCalendarDays: returning", days.length, "days")
return days
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionName="2.18.8" android:versionCode="952" android:installLocation="auto">
<manifest package="org.cagnulen.qdomyoszwift" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionName="2.20.15" android:versionCode="1210" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
@@ -10,7 +10,7 @@
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:debuggable="false" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="qdomyos-zwift" android:extractNativeLibs="true" android:icon="@drawable/icon" android:usesCleartextTraffic="true">
<activity android:theme="@style/Theme.AppCompat" android:exported="true" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="QZ" android:launchMode="singleTop">
<activity android:theme="@style/Theme.AppCompat" android:exported="true" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.cagnulen.qdomyoszwift.CustomQtActivity" android:label="QZ" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@@ -120,7 +120,7 @@
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="36" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/>

View File

@@ -44,13 +44,13 @@ dependencies {
def appcompat_version = "1.3.1"
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation "com.android.billingclient:billing:6.0.1"
implementation "com.android.billingclient:billing:8.0.0"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.github.mik3y:usb-serial-for-android:v3.4.6'
implementation files('libs/usb-serial-for-android-3.8.1.aar')
androidTestImplementation "com.android.support:support-annotations:28.0.0"
implementation 'com.google.android.gms:play-services-wearable:+'
@@ -129,7 +129,7 @@ android {
resConfig "en"
compileSdkVersion 33
minSdkVersion = 21
targetSdkVersion = 34
targetSdkVersion = 36
}
tasks.all { task ->

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,4 @@
package org.cagnulen.qdomyoszwift;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
@@ -23,110 +22,151 @@ import android.widget.Button;
import android.widget.NumberPicker;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.content.Intent;
public class Ant {
private ChannelService.ChannelServiceComm mChannelService = null;
private boolean mChannelServiceBound = false;
private final String TAG = "Ant";
public static Activity activity = null;
static boolean speedRequest = false;
static boolean heartRequest = false;
static boolean bikeRequest = false; // Added bike request flag
static boolean garminKey = false;
static boolean treadmill = false;
static boolean technoGymGroupCycle = false;
static int antBikeDeviceNumber = 0;
static int antHeartDeviceNumber = 0;
public void antStart(Activity a, boolean SpeedRequest, boolean HeartRequest, boolean GarminKey, boolean Treadmill) {
Log.v(TAG, "antStart");
speedRequest = SpeedRequest;
heartRequest = HeartRequest;
treadmill = Treadmill;
garminKey = GarminKey;
// Updated antStart method with BikeRequest parameter at the end
public void antStart(Activity a, boolean SpeedRequest, boolean HeartRequest, boolean GarminKey, boolean Treadmill, boolean BikeRequest, boolean TechnoGymGroupCycle, int AntBikeDeviceNumber, int AntHeartDeviceNumber) {
QLog.v(TAG, "antStart");
speedRequest = SpeedRequest;
heartRequest = HeartRequest;
treadmill = Treadmill;
garminKey = GarminKey;
bikeRequest = BikeRequest; // Set bike request flag
technoGymGroupCycle = TechnoGymGroupCycle;
antBikeDeviceNumber = AntBikeDeviceNumber;
antHeartDeviceNumber = AntHeartDeviceNumber;
activity = a;
if(a != null)
QLog.v(TAG, "antStart activity is valid");
else
{
QLog.v(TAG, "antStart activity is invalid");
return;
}
activity = a;
if(a != null)
Log.v(TAG, "antStart activity is valid");
else
{
Log.v(TAG, "antStart activity is invalid");
return;
}
if(!mChannelServiceBound) doBindChannelService();
}
private ServiceConnection mChannelServiceConnection = new ServiceConnection()
{
@Override
public void onServiceConnected(ComponentName name, IBinder serviceBinder)
{
Log.v(TAG, "mChannelServiceConnection.onServiceConnected...");
@Override
public void onServiceConnected(ComponentName name, IBinder serviceBinder)
{
QLog.v(TAG, "mChannelServiceConnection.onServiceConnected...");
mChannelService = (ChannelService.ChannelServiceComm) serviceBinder;
QLog.v(TAG, "...mChannelServiceConnection.onServiceConnected");
}
mChannelService = (ChannelService.ChannelServiceComm) serviceBinder;
Log.v(TAG, "...mChannelServiceConnection.onServiceConnected");
}
@Override
public void onServiceDisconnected(ComponentName arg0)
{
Log.v(TAG, "mChannelServiceConnection.onServiceDisconnected...");
// Clearing and disabling when disconnecting from ChannelService
mChannelService = null;
Log.v(TAG, "...mChannelServiceConnection.onServiceDisconnected");
}
};
@Override
public void onServiceDisconnected(ComponentName arg0)
{
QLog.v(TAG, "mChannelServiceConnection.onServiceDisconnected...");
// Clearing and disabling when disconnecting from ChannelService
mChannelService = null;
QLog.v(TAG, "...mChannelServiceConnection.onServiceDisconnected");
}
};
private void doBindChannelService()
{
Log.v(TAG, "doBindChannelService...");
// Binds to ChannelService. ChannelService binds and manages connection between the
// app and the ANT Radio Service
mChannelServiceBound = activity.bindService(new Intent(activity, ChannelService.class), mChannelServiceConnection , Context.BIND_AUTO_CREATE);
if(!mChannelServiceBound) //If the bind returns false, run the unbind method to update the GUI
doUnbindChannelService();
Log.i(TAG, " Channel Service binding = "+ mChannelServiceBound);
Log.v(TAG, "...doBindChannelService");
}
QLog.v(TAG, "doBindChannelService...");
// Binds to ChannelService. ChannelService binds and manages connection between the
// app and the ANT Radio Service
mChannelServiceBound = activity.bindService(new Intent(activity, ChannelService.class), mChannelServiceConnection, Context.BIND_AUTO_CREATE);
if(!mChannelServiceBound) //If the bind returns false, run the unbind method to update the GUI
doUnbindChannelService();
QLog.i(TAG, " Channel Service binding = "+ mChannelServiceBound);
QLog.v(TAG, "...doBindChannelService");
}
public void doUnbindChannelService()
{
Log.v(TAG, "doUnbindChannelService...");
if(mChannelServiceBound)
{
activity.unbindService(mChannelServiceConnection);
mChannelServiceBound = false;
}
Log.v(TAG, "...doUnbindChannelService");
}
QLog.v(TAG, "doUnbindChannelService...");
if(mChannelServiceBound)
{
activity.unbindService(mChannelServiceConnection);
mChannelServiceBound = false;
}
QLog.v(TAG, "...doUnbindChannelService");
}
public void setCadenceSpeedPower(float speed, int power, int cadence)
{
if(mChannelService == null)
return;
Log.v(TAG, "setCadenceSpeedPower " + speed + " " + power + " " + cadence);
mChannelService.setSpeed(speed);
mChannelService.setPower(power);
mChannelService.setCadence(cadence);
if(mChannelService == null)
return;
QLog.v(TAG, "setCadenceSpeedPower " + speed + " " + power + " " + cadence);
mChannelService.setSpeed(speed);
mChannelService.setPower(power);
mChannelService.setCadence(cadence);
}
public int getHeart()
{
if(mChannelService == null)
return 0;
if(mChannelService == null)
return 0;
QLog.v(TAG, "getHeart");
return mChannelService.getHeart();
}
Log.v(TAG, "getHeart");
return mChannelService.getHeart();
// Added bike-related getter methods
public int getBikeCadence() {
if(mChannelService == null)
return 0;
QLog.v(TAG, "getBikeCadence");
return mChannelService.getBikeCadence();
}
public int getBikePower() {
if(mChannelService == null)
return 0;
QLog.v(TAG, "getBikePower");
return mChannelService.getBikePower();
}
public double getBikeSpeed() {
if(mChannelService == null)
return 0.0;
QLog.v(TAG, "getBikeSpeed");
return mChannelService.getBikeSpeed();
}
public long getBikeDistance() {
if(mChannelService == null)
return 0;
QLog.v(TAG, "getBikeDistance");
return mChannelService.getBikeDistance();
}
public boolean isBikeConnected() {
if(mChannelService == null)
return false;
QLog.v(TAG, "isBikeConnected");
return mChannelService.isBikeConnected();
}
public void updateBikeTransmitterExtendedMetrics(long distanceMeters, int heartRate,
double elapsedTimeSeconds, int resistance,
double inclination) {
if(mChannelService == null)
return;
QLog.v(TAG, "updateBikeTransmitterExtendedMetrics");
mChannelService.updateBikeTransmitterExtendedMetrics(distanceMeters, heartRate,
elapsedTimeSeconds, resistance,
inclination);
}
}

View File

@@ -0,0 +1,562 @@
package org.cagnulen.qdomyoszwift;
import android.content.Context;
import org.cagnulen.qdomyoszwift.QLog;
import android.app.Activity;
// ANT+ Plugin imports
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.IFitnessEquipmentStateReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.IBikeDataReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.IGeneralFitnessEquipmentDataReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.EquipmentState;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.EquipmentType;
import com.dsi.ant.plugins.antplus.pcc.AntPlusFitnessEquipmentPcc.HeartRateDataSource;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikePowerPcc;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikePowerPcc.IRawPowerOnlyDataReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikePowerPcc.ICalculatedPowerReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeSpeedDistancePcc;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeSpeedDistancePcc.CalculatedSpeedReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeSpeedDistancePcc.CalculatedAccumulatedDistanceReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeSpeedDistancePcc.IRawSpeedAndDistanceDataReceiver;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeCadencePcc;
import com.dsi.ant.plugins.antplus.pcc.AntPlusBikeCadencePcc.ICalculatedCadenceReceiver;
import com.dsi.ant.plugins.antplus.pcc.defines.DeviceState;
import com.dsi.ant.plugins.antplus.pcc.defines.EventFlag;
import com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult;
import com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc.IDeviceStateChangeReceiver;
import com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc.IPluginAccessResultReceiver;
import com.dsi.ant.plugins.antplus.pccbase.PccReleaseHandle;
// Java imports
import java.math.BigDecimal;
import java.util.EnumSet;
public class BikeChannelController {
private static final String TAG = BikeChannelController.class.getSimpleName();
private Context context;
private AntPlusFitnessEquipmentPcc fePcc = null;
private PccReleaseHandle<AntPlusFitnessEquipmentPcc> releaseHandle = null;
private AntPlusBikePowerPcc powerPcc = null;
private PccReleaseHandle<AntPlusBikePowerPcc> powerReleaseHandle = null;
private AntPlusBikeSpeedDistancePcc speedCadencePcc = null;
private PccReleaseHandle<AntPlusBikeSpeedDistancePcc> speedCadenceReleaseHandle = null;
private AntPlusBikeCadencePcc cadencePcc = null;
private PccReleaseHandle<AntPlusBikeCadencePcc> cadenceReleaseHandle = null;
private boolean isConnected = false;
private boolean isPowerConnected = false;
private boolean isSpeedCadenceConnected = false;
// Bike data fields - from fitness equipment
public int cadence = 0; // Current cadence in RPM
public int power = 0; // Current power in watts
public BigDecimal speed = new BigDecimal(0); // Current speed in m/s
public long distance = 0; // Total distance in meters
public long calories = 0; // Total calories burned
public EquipmentType equipmentType = EquipmentType.UNKNOWN;
public EquipmentState equipmentState = EquipmentState.ASLEEP_OFF;
public int heartRate = 0; // Heart rate from equipment
public HeartRateDataSource heartRateSource = HeartRateDataSource.UNKNOWN;
public BigDecimal elapsedTime = new BigDecimal(0); // Elapsed time in seconds
// Bike data fields - from dedicated sensors
public int powerSensorPower = 0; // Power from dedicated power sensor
public int speedSensorCadence = 0; // Cadence from speed/cadence sensor
public BigDecimal speedSensorSpeed = new BigDecimal(0); // Speed from speed/cadence sensor
public long speedSensorDistance = 0; // Distance from speed/cadence sensor
// Fitness equipment state receiver
private final IFitnessEquipmentStateReceiver mFitnessEquipmentStateReceiver =
new IFitnessEquipmentStateReceiver() {
@Override
public void onNewFitnessEquipmentState(long estTimestamp,
EnumSet<EventFlag> eventFlags,
EquipmentType type,
EquipmentState state) {
equipmentType = type;
equipmentState = state;
QLog.d(TAG, "Equipment type: " + type + ", State: " + state);
// Only subscribe to bike specific data if this is actually a bike
if (type == EquipmentType.BIKE && !isSubscribedToBikeData) {
subscribeToBikeSpecificData();
isSubscribedToBikeData = true;
}
}
};
public BikeChannelController(boolean technoGymGroupCycle, int antBikeDeviceNumber) {
this.context = Ant.activity;
if (technoGymGroupCycle) {
// For Technogym Group Cycle: disable openChannel, enable openPowerSensorChannel
openPowerSensorChannel(antBikeDeviceNumber);
} else {
// Standard behavior: enable openChannel, disable openPowerSensorChannel
openChannel();
}
//openSpeedCadenceSensorChannel();
}
public boolean openChannel() {
// Request access to first available fitness equipment device
// Using requestNewOpenAccess from the sample code
releaseHandle = AntPlusFitnessEquipmentPcc.requestNewOpenAccess(
(Activity)context,
context,
new IPluginAccessResultReceiver<AntPlusFitnessEquipmentPcc>() {
@Override
public void onResultReceived(AntPlusFitnessEquipmentPcc result, RequestAccessResult resultCode, DeviceState initialDeviceState) {
switch(resultCode) {
case SUCCESS:
fePcc = result;
isConnected = true;
QLog.d(TAG, "Connected to fitness equipment: " + result.getDeviceName());
subscribeToBikeEvents();
break;
case CHANNEL_NOT_AVAILABLE:
QLog.e(TAG, "Channel Not Available");
break;
case ADAPTER_NOT_DETECTED:
QLog.e(TAG, "ANT Adapter Not Available");
break;
case BAD_PARAMS:
QLog.e(TAG, "Bad request parameters");
break;
case OTHER_FAILURE:
QLog.e(TAG, "RequestAccess failed");
break;
case DEPENDENCY_NOT_INSTALLED:
QLog.e(TAG, "Dependency not installed");
break;
case USER_CANCELLED:
QLog.e(TAG, "User cancelled");
break;
default:
QLog.e(TAG, "Unrecognized result: " + resultCode);
break;
}
}
},
new IDeviceStateChangeReceiver() {
@Override
public void onDeviceStateChange(DeviceState newDeviceState) {
QLog.d(TAG, "Device State Changed to: " + newDeviceState);
if (newDeviceState == DeviceState.DEAD) {
isConnected = false;
}
}
},
mFitnessEquipmentStateReceiver
);
return isConnected;
}
public boolean openPowerSensorChannel(int deviceNumber) {
// Request access to power sensor device (deviceNumber = 0 means first available)
powerReleaseHandle = AntPlusBikePowerPcc.requestAccess((Activity)context, deviceNumber, 0,
new IPluginAccessResultReceiver<AntPlusBikePowerPcc>() {
@Override
public void onResultReceived(AntPlusBikePowerPcc result, RequestAccessResult resultCode, DeviceState initialDeviceState) {
switch(resultCode) {
case SUCCESS:
powerPcc = result;
isPowerConnected = true;
QLog.d(TAG, "Connected to power sensor: " + result.getDeviceName() + " (Device #" + deviceNumber + ")");
subscribeToPowerSensorEvents();
break;
case CHANNEL_NOT_AVAILABLE:
QLog.e(TAG, "Power Sensor Channel Not Available");
break;
case ADAPTER_NOT_DETECTED:
QLog.e(TAG, "ANT Adapter Not Available for Power Sensor");
break;
case BAD_PARAMS:
QLog.e(TAG, "Bad request parameters for Power Sensor");
break;
case OTHER_FAILURE:
QLog.e(TAG, "Power Sensor RequestAccess failed");
break;
case DEPENDENCY_NOT_INSTALLED:
QLog.e(TAG, "Dependency not installed for Power Sensor");
break;
case USER_CANCELLED:
QLog.e(TAG, "User cancelled Power Sensor");
break;
default:
QLog.e(TAG, "Unrecognized power sensor result: " + resultCode);
break;
}
}
},
new IDeviceStateChangeReceiver() {
@Override
public void onDeviceStateChange(DeviceState newDeviceState) {
QLog.d(TAG, "Power Sensor State Changed to: " + newDeviceState);
if (newDeviceState == DeviceState.DEAD) {
isPowerConnected = false;
}
}
}
);
return isPowerConnected;
}
public boolean openSpeedCadenceSensorChannel() {
// Request access to first available speed/cadence sensor device
speedCadenceReleaseHandle = AntPlusBikeSpeedDistancePcc.requestAccess((Activity)context, context,
new IPluginAccessResultReceiver<AntPlusBikeSpeedDistancePcc>() {
@Override
public void onResultReceived(AntPlusBikeSpeedDistancePcc result, RequestAccessResult resultCode, DeviceState initialDeviceState) {
switch(resultCode) {
case SUCCESS:
speedCadencePcc = result;
isSpeedCadenceConnected = true;
QLog.d(TAG, "Connected to speed/cadence sensor: " + result.getDeviceName());
subscribeToSpeedCadenceSensorEvents();
break;
case CHANNEL_NOT_AVAILABLE:
QLog.e(TAG, "Speed/Cadence Sensor Channel Not Available");
break;
case ADAPTER_NOT_DETECTED:
QLog.e(TAG, "ANT Adapter Not Available for Speed/Cadence Sensor");
break;
case BAD_PARAMS:
QLog.e(TAG, "Bad request parameters for Speed/Cadence Sensor");
break;
case OTHER_FAILURE:
QLog.e(TAG, "Speed/Cadence Sensor RequestAccess failed");
break;
case DEPENDENCY_NOT_INSTALLED:
QLog.e(TAG, "Dependency not installed for Speed/Cadence Sensor");
break;
case USER_CANCELLED:
QLog.e(TAG, "User cancelled Speed/Cadence Sensor");
break;
default:
QLog.e(TAG, "Unrecognized speed/cadence sensor result: " + resultCode);
break;
}
}
},
new IDeviceStateChangeReceiver() {
@Override
public void onDeviceStateChange(DeviceState newDeviceState) {
QLog.d(TAG, "Speed/Cadence Sensor State Changed to: " + newDeviceState);
if (newDeviceState == DeviceState.DEAD) {
isSpeedCadenceConnected = false;
}
}
}
);
return isSpeedCadenceConnected;
}
private void subscribeToBikeEvents() {
if (fePcc != null) {
// General fitness equipment data
fePcc.subscribeGeneralFitnessEquipmentDataEvent(new IGeneralFitnessEquipmentDataReceiver() {
@Override
public void onNewGeneralFitnessEquipmentData(long estTimestamp, EnumSet<EventFlag> eventFlags,
BigDecimal elapsedTime, long cumulativeDistance,
BigDecimal instantaneousSpeed, boolean virtualInstantaneousSpeed,
int instantaneousHeartRate, HeartRateDataSource source) {
if (elapsedTime != null && elapsedTime.intValue() != -1) {
BikeChannelController.this.elapsedTime = elapsedTime;
}
if (cumulativeDistance != -1) {
distance = cumulativeDistance;
}
if (instantaneousSpeed != null && instantaneousSpeed.intValue() != -1) {
speed = instantaneousSpeed;
}
if (instantaneousHeartRate != -1) {
heartRate = instantaneousHeartRate;
heartRateSource = source;
}
QLog.d(TAG, "General Data - Time: " + elapsedTime + "s, Distance: " +
distance + "m, Speed: " + speed + "m/s, HR: " + heartRate + "bpm");
}
});
}
}
private boolean isSubscribedToBikeData = false;
private void subscribeToBikeSpecificData() {
if (fePcc != null) {
// Subscribe to bike specific data
fePcc.getBikeMethods().subscribeBikeDataEvent(new IBikeDataReceiver() {
@Override
public void onNewBikeData(long estTimestamp, EnumSet<EventFlag> eventFlags,
int instantaneousCadence, int instantaneousPower) {
if (instantaneousCadence != -1) {
cadence = instantaneousCadence;
}
if (instantaneousPower != -1) {
power = instantaneousPower;
}
QLog.d(TAG, "Bike Data - Cadence: " + cadence + "rpm, Power: " + power + "W");
}
});
}
}
private void subscribeToPowerSensorEvents() {
if (powerPcc != null) {
// Subscribe to raw power-only data events
powerPcc.subscribeRawPowerOnlyDataEvent(new IRawPowerOnlyDataReceiver() {
@Override
public void onNewRawPowerOnlyData(long estTimestamp, EnumSet<EventFlag> eventFlags,
long powerOnlyUpdateEventCount, int instantaneousPower,
long accumulatedPower) {
if (instantaneousPower != -1) {
powerSensorPower = instantaneousPower;
QLog.d(TAG, "Power Sensor Data - Power: " + powerSensorPower + "W");
}
}
});
// Also subscribe to calculated power events
powerPcc.subscribeCalculatedPowerEvent(new ICalculatedPowerReceiver() {
@Override
public void onNewCalculatedPower(long estTimestamp, EnumSet<EventFlag> eventFlags,
AntPlusBikePowerPcc.DataSource dataSource,
BigDecimal calculatedPower) {
if (calculatedPower != null && calculatedPower.intValue() != -1) {
powerSensorPower = calculatedPower.intValue();
QLog.d(TAG, "Power Sensor Calculated Data - Power: " + powerSensorPower + "W");
}
}
});
}
}
private void subscribeToSpeedCadenceSensorEvents() {
if (speedCadencePcc != null) {
// 2.095m circumference = average 700cx23mm road tire
BigDecimal wheelCircumference = new BigDecimal("2.095");
// Subscribe to calculated speed events
speedCadencePcc.subscribeCalculatedSpeedEvent(new CalculatedSpeedReceiver(wheelCircumference) {
@Override
public void onNewCalculatedSpeed(long estTimestamp, EnumSet<EventFlag> eventFlags,
BigDecimal calculatedSpeed) {
if (calculatedSpeed != null && calculatedSpeed.doubleValue() > 0) {
speedSensorSpeed = calculatedSpeed;
QLog.d(TAG, "Speed Sensor Data - Speed: " + speedSensorSpeed + "m/s");
}
}
});
// Subscribe to calculated distance events
speedCadencePcc.subscribeCalculatedAccumulatedDistanceEvent(new CalculatedAccumulatedDistanceReceiver(wheelCircumference) {
@Override
public void onNewCalculatedAccumulatedDistance(long estTimestamp, EnumSet<EventFlag> eventFlags,
BigDecimal calculatedAccumulatedDistance) {
if (calculatedAccumulatedDistance != null && calculatedAccumulatedDistance.longValue() > 0) {
speedSensorDistance = calculatedAccumulatedDistance.longValue();
QLog.d(TAG, "Speed Sensor Data - Distance: " + speedSensorDistance + "m");
}
}
});
// Subscribe to raw speed and distance data
speedCadencePcc.subscribeRawSpeedAndDistanceDataEvent(new IRawSpeedAndDistanceDataReceiver() {
@Override
public void onNewRawSpeedAndDistanceData(long estTimestamp, EnumSet<EventFlag> eventFlags,
BigDecimal timestampOfLastEvent, long cumulativeRevolutions) {
QLog.d(TAG, "Speed/Distance Raw Data - Revs: " + cumulativeRevolutions + ", Time: " + timestampOfLastEvent);
}
});
// Check if this is a combined speed/cadence sensor
if (speedCadencePcc.isSpeedAndCadenceCombinedSensor()) {
// Connect to cadence functionality
cadenceReleaseHandle = AntPlusBikeCadencePcc.requestAccess(
(Activity)context, speedCadencePcc.getAntDeviceNumber(), 0, true,
new IPluginAccessResultReceiver<AntPlusBikeCadencePcc>() {
@Override
public void onResultReceived(AntPlusBikeCadencePcc result, RequestAccessResult resultCode, DeviceState initialDeviceState) {
if (resultCode == RequestAccessResult.SUCCESS) {
cadencePcc = result;
cadencePcc.subscribeCalculatedCadenceEvent(new ICalculatedCadenceReceiver() {
@Override
public void onNewCalculatedCadence(long estTimestamp, EnumSet<EventFlag> eventFlags,
BigDecimal calculatedCadence) {
if (calculatedCadence != null && calculatedCadence.intValue() > 0) {
speedSensorCadence = calculatedCadence.intValue();
QLog.d(TAG, "Cadence Sensor Data - Cadence: " + speedSensorCadence + "rpm");
}
}
});
}
}
},
new IDeviceStateChangeReceiver() {
@Override
public void onDeviceStateChange(DeviceState newDeviceState) {
QLog.d(TAG, "Cadence Sensor State Changed to: " + newDeviceState);
}
}
);
}
}
}
public void close() {
if (releaseHandle != null) {
releaseHandle.close();
releaseHandle = null;
}
if (powerReleaseHandle != null) {
powerReleaseHandle.close();
powerReleaseHandle = null;
}
if (speedCadenceReleaseHandle != null) {
speedCadenceReleaseHandle.close();
speedCadenceReleaseHandle = null;
}
if (cadenceReleaseHandle != null) {
cadenceReleaseHandle.close();
cadenceReleaseHandle = null;
}
fePcc = null;
powerPcc = null;
speedCadencePcc = null;
cadencePcc = null;
isConnected = false;
isPowerConnected = false;
isSpeedCadenceConnected = false;
QLog.d(TAG, "All Channels Closed");
}
// Getter methods for bike data with sensor reconciliation
public int getCadence() {
// Priority: 1) Fitness Equipment, 2) Speed/Cadence Sensor, 3) Power Sensor
if (isConnected && cadence > 0) {
return cadence; // From fitness equipment
} else if (isSpeedCadenceConnected && speedSensorCadence > 0) {
return speedSensorCadence; // From dedicated speed/cadence sensor
} else if (isPowerConnected && speedSensorCadence > 0) {
return speedSensorCadence; // From power sensor (if it provides cadence)
}
return 0;
}
public int getPower() {
// Priority: 1) Dedicated Power Sensor, 2) Fitness Equipment
if (isPowerConnected && powerSensorPower > 0) {
return powerSensorPower; // From dedicated power sensor (most accurate)
} else if (isConnected && power > 0) {
return power; // From fitness equipment
}
return 0;
}
public double getSpeedKph() {
// Convert from m/s to km/h
return getSpeedMps() * 3.6;
}
public double getSpeedMps() {
// Priority: 1) Speed/Cadence Sensor, 2) Fitness Equipment
if (isSpeedCadenceConnected && speedSensorSpeed.doubleValue() > 0) {
return speedSensorSpeed.doubleValue(); // From dedicated speed sensor (most accurate)
} else if (isConnected && speed.doubleValue() > 0) {
return speed.doubleValue(); // From fitness equipment
}
return 0.0;
}
public long getDistance() {
// Priority: 1) Speed/Cadence Sensor, 2) Fitness Equipment
if (isSpeedCadenceConnected && speedSensorDistance > 0) {
return speedSensorDistance; // From dedicated speed sensor (most accurate)
} else if (isConnected && distance > 0) {
return distance; // From fitness equipment
}
return 0;
}
public long getCalories() {
return calories;
}
public int getHeartRate() {
return heartRate;
}
public BigDecimal getElapsedTime() {
return elapsedTime;
}
public EquipmentState getEquipmentState() {
return equipmentState;
}
public EquipmentType getEquipmentType() {
return equipmentType;
}
public boolean isConnected() {
return isConnected;
}
// Additional connection status methods
public boolean isPowerSensorConnected() {
return isPowerConnected;
}
public boolean isSpeedCadenceSensorConnected() {
return isSpeedCadenceConnected;
}
public boolean isAnyDeviceConnected() {
return isConnected || isPowerConnected || isSpeedCadenceConnected;
}
// Raw sensor data getters (for debugging/advanced use)
public int getRawFitnessEquipmentPower() {
return power;
}
public int getRawPowerSensorPower() {
return powerSensorPower;
}
public int getRawFitnessEquipmentCadence() {
return cadence;
}
public int getRawSpeedSensorCadence() {
return speedSensorCadence;
}
public double getRawFitnessEquipmentSpeed() {
return speed.doubleValue();
}
public double getRawSpeedSensorSpeed() {
return speedSensorSpeed.doubleValue();
}
public long getRawFitnessEquipmentDistance() {
return distance;
}
public long getRawSpeedSensorDistance() {
return speedSensorDistance;
}
}

View File

@@ -0,0 +1,651 @@
/*
* Copyright 2012 Dynastream Innovations Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.cagnulen.qdomyoszwift;
import android.os.RemoteException;
import org.cagnulen.qdomyoszwift.QLog;
import com.dsi.ant.channel.AntChannel;
import com.dsi.ant.channel.AntCommandFailedException;
import com.dsi.ant.channel.IAntChannelEventHandler;
import com.dsi.ant.message.ChannelId;
import com.dsi.ant.message.ChannelType;
import com.dsi.ant.message.EventCode;
import com.dsi.ant.message.fromant.AcknowledgedDataMessage;
import com.dsi.ant.message.fromant.ChannelEventMessage;
import com.dsi.ant.message.fromant.MessageFromAntType;
import com.dsi.ant.message.ipc.AntMessageParcel;
import android.os.RemoteException;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import java.util.Random;
/**
* ANT+ Bike Transmitter Controller
* Follows exactly the same pattern as PowerChannelController but for Fitness Equipment
*/
public class BikeTransmitterController {
public static final int FITNESS_EQUIPMENT_SENSOR_ID = 0x9e3d4b67; // Different from power sensor
// The device type and transmission type to be part of the channel ID message
private static final int CHANNEL_FITNESS_EQUIPMENT_DEVICE_TYPE = 17; // Fitness Equipment
private static final int CHANNEL_FITNESS_EQUIPMENT_TRANSMISSION_TYPE = 5;
// The period and frequency values the channel will be configured to
private static final int CHANNEL_FITNESS_EQUIPMENT_PERIOD = 8192; // 4 Hz for FE
private static final int CHANNEL_FITNESS_EQUIPMENT_FREQUENCY = 57;
private static final String TAG = BikeTransmitterController.class.getSimpleName();
// ANT+ Data Page IDs for Fitness Equipment
private static final byte DATA_PAGE_GENERAL_FE = 0x10;
private static final byte DATA_PAGE_BIKE_DATA = 0x19;
private static final byte DATA_PAGE_TRAINER_DATA = 0x1A;
private static final byte DATA_PAGE_GENERAL_SETTINGS = 0x11;
private static Random randGen = new Random();
// Current bike metrics to transmit
int currentCadence = 0; // Current cadence in RPM
int currentPower = 0; // Current power in watts
double currentSpeedKph = 0.0; // Current speed in km/h
long totalDistance = 0; // Total distance in meters
int currentHeartRate = 0; // Heart rate in BPM
double elapsedTimeSeconds = 0.0; // Elapsed time in seconds
int currentResistance = 0; // Current resistance level (0-100)
double currentInclination = 0.0; // Current inclination in percentage
// Control commands received from ANT+ devices
private int requestedResistance = -1; // Requested resistance from controller
private int requestedPower = -1; // Requested power from controller
private double requestedInclination = -100; // Requested inclination from controller
private AntChannel mAntChannel;
private ChannelEventCallback mChannelEventCallback = new ChannelEventCallback();
private boolean mIsOpen;
// Callbacks for control commands
public interface ControlCommandListener {
void onResistanceChangeRequested(int resistance);
void onPowerChangeRequested(int power);
void onInclinationChangeRequested(double inclination);
}
private ControlCommandListener controlListener = null;
public BikeTransmitterController(AntChannel antChannel) {
mAntChannel = antChannel;
openChannel();
}
/**
* Set the listener for control commands received from ANT+ devices
*/
public void setControlCommandListener(ControlCommandListener listener) {
this.controlListener = listener;
}
boolean openChannel() {
if (null != mAntChannel) {
if (mIsOpen) {
QLog.w(TAG, "Channel was already open");
} else {
// Channel ID message contains device number, type and transmission type
ChannelId channelId = new ChannelId(FITNESS_EQUIPMENT_SENSOR_ID & 0xFFFF,
CHANNEL_FITNESS_EQUIPMENT_DEVICE_TYPE, CHANNEL_FITNESS_EQUIPMENT_TRANSMISSION_TYPE);
try {
// Setting the channel event handler so that we can receive messages from ANT
mAntChannel.setChannelEventHandler(mChannelEventCallback);
// Performs channel assignment by assigning the type to the channel
mAntChannel.assign(ChannelType.BIDIRECTIONAL_MASTER);
// Configures the channel ID, messaging period and rf frequency after assigning,
// then opening the channel.
mAntChannel.setChannelId(channelId);
mAntChannel.setPeriod(CHANNEL_FITNESS_EQUIPMENT_PERIOD);
mAntChannel.setRfFrequency(CHANNEL_FITNESS_EQUIPMENT_FREQUENCY);
mAntChannel.open();
mIsOpen = true;
QLog.d(TAG, "Opened fitness equipment channel with device number: " + FITNESS_EQUIPMENT_SENSOR_ID);
} catch (RemoteException e) {
channelError(e);
} catch (AntCommandFailedException e) {
// This will release, and therefore unassign if required
channelError("Open failed", e);
}
}
} else {
QLog.w(TAG, "No channel available");
}
return mIsOpen;
}
public boolean startTransmission() {
return openChannel();
}
public void stopTransmission() {
close();
}
void channelError(RemoteException e) {
String logString = "Remote service communication failed.";
QLog.e(TAG, logString);
}
void channelError(String error, AntCommandFailedException e) {
StringBuilder logString;
if (e.getResponseMessage() != null) {
String initiatingMessageId = "0x" + Integer.toHexString(
e.getResponseMessage().getInitiatingMessageId());
String rawResponseCode = "0x" + Integer.toHexString(
e.getResponseMessage().getRawResponseCode());
logString = new StringBuilder(error)
.append(". Command ")
.append(initiatingMessageId)
.append(" failed with code ")
.append(rawResponseCode);
} else {
String attemptedMessageId = "0x" + Integer.toHexString(
e.getAttemptedMessageType().getMessageId());
String failureReason = e.getFailureReason().toString();
logString = new StringBuilder(error)
.append(". Command ")
.append(attemptedMessageId)
.append(" failed with reason ")
.append(failureReason);
}
QLog.e(TAG, logString.toString());
mAntChannel.release();
}
public void close() {
if (null != mAntChannel) {
mIsOpen = false;
// Releasing the channel to make it available for others.
// After releasing, the AntChannel instance cannot be reused.
mAntChannel.release();
mAntChannel = null;
}
QLog.e(TAG, "Fitness Equipment Channel Closed");
}
// Setter methods for updating bike metrics from the main application
public void setCadence(int cadence) {
this.currentCadence = Math.max(0, cadence);
}
public void setPower(int power) {
this.currentPower = Math.max(0, power);
}
public void setSpeedKph(double speedKph) {
this.currentSpeedKph = Math.max(0, speedKph);
}
public void setDistance(long distance) {
this.totalDistance = Math.max(0, distance);
}
public void setHeartRate(int heartRate) {
this.currentHeartRate = Math.max(0, Math.min(255, heartRate));
}
public void setElapsedTime(double timeSeconds) {
this.elapsedTimeSeconds = Math.max(0, timeSeconds);
}
public void setResistance(int resistance) {
this.currentResistance = Math.max(0, Math.min(100, resistance));
}
public void setInclination(double inclination) {
this.currentInclination = Math.max(-100, Math.min(100, inclination));
}
// Getter methods for the last requested control values
public int getRequestedResistance() {
return requestedResistance;
}
public int getRequestedPower() {
return requestedPower;
}
public double getRequestedInclination() {
return requestedInclination;
}
public void clearControlRequests() {
requestedResistance = -1;
requestedPower = -1;
requestedInclination = -100;
}
public boolean isTransmitting() {
return mIsOpen;
}
public String getTransmissionInfo() {
if (!mIsOpen) {
return "Transmission: STOPPED";
}
return String.format("Transmission: ACTIVE - Cadence: %drpm, Power: %dW, " +
"Speed: %.1fkm/h, Resistance: %d, Inclination: %.1f%%",
currentCadence, currentPower, currentSpeedKph,
currentResistance, currentInclination);
}
/**
* Helper method to convert byte array to hex string for debugging
*/
private String bytesToHex(byte[] bytes) {
StringBuilder hex = new StringBuilder();
for (byte b : bytes) {
hex.append(String.format("%02X ", b & 0xFF));
}
return hex.toString().trim();
}
/**
* Implements the Channel Event Handler Interface following PowerChannelController pattern
*/
public class ChannelEventCallback implements IAntChannelEventHandler {
int cnt = 0;
int eventCount = 0;
int eventPowerCount = 0;
int cumulativeDistance = 0;
int cumulativeWatt = 0;
int accumulatedTorque32 = 0;
Timer carousalTimer = null;
@Override
public void onChannelDeath() {
// Display channel death message when channel dies
QLog.e(TAG, "Fitness Equipment Channel Death");
}
@Override
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
QLog.d(TAG, "Rx: " + antParcel);
QLog.d(TAG, "Message Type: " + messageType);
byte[] payload = new byte[8];
// Start unsolicited transmission timer like PowerChannelController
if(carousalTimer == null) {
carousalTimer = new Timer(); // At this line a new Thread will be created
carousalTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
QLog.d(TAG, "Tx Unsolicited Fitness Equipment Data");
byte[] payload = new byte[8];
String debugString = "";
eventCount = (eventCount + 1) & 0xFF;
cumulativeDistance = (cumulativeDistance + (int)(currentSpeedKph / 3.6)) & 0xFFFF; // rough distance calc
cnt += 1;
// Cycle through different data pages like PowerChannelController
if (cnt % 5 == 0) {
// General FE Data Page (0x10)
debugString = buildGeneralFEDataPage(payload);
} else if (cnt % 5 == 1) {
// Bike Data Page (0x19)
debugString = buildBikeDataPage(payload);
} else if (cnt % 5 == 2) {
// Trainer Data Page (0x1A)
debugString = buildBikeDataPage(payload);
} else if (cnt % 5 == 3) {
// General Settings Page (0x11)
debugString = buildGeneralSettingsPage(payload);
} else {
// Default General FE Data Page (0x10)
debugString = buildGeneralFEDataPage(payload);
}
// Log the hex data and parsed values
QLog.d(TAG, "Tx Payload HEX: " + bytesToHex(payload));
QLog.d(TAG, debugString);
if (mIsOpen) {
try {
// Setting the data to be broadcast on the next channel period
mAntChannel.setBroadcastData(payload);
} catch (RemoteException e) {
channelError(e);
}
}
}
}, 0, 250); // Every 250ms for 4Hz
}
// Switching on message type to handle different types of messages
switch (messageType) {
case BROADCAST_DATA:
// Rx Data
break;
case ACKNOWLEDGED_DATA:
// Handle control commands
payload = new AcknowledgedDataMessage(antParcel).getPayload();
QLog.d(TAG, "AcknowledgedDataMessage: " + payload);
handleControlCommand(payload);
break;
case CHANNEL_EVENT:
// Constructing channel event message from parcel
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
EventCode code = eventMessage.getEventCode();
QLog.d(TAG, "Event Code: " + code);
// Switching on event code to handle the different types of channel events
switch (code) {
case TX:
cnt += 1;
String debugString = "";
// Cycle through different data pages like PowerChannelController
if (cnt % 16 == 1) {
// General FE Data Page (0x10)
debugString = buildGeneralFEDataPage(payload);
} else if (cnt % 16 == 5) {
// Bike Data Page (0x19)
debugString = buildBikeDataPage(payload);
} else if (cnt % 16 == 9) {
// Trainer Data Page (0x1A)
debugString = buildBikeDataPage(payload);
} else if (cnt % 16 == 13) {
// General Settings Page (0x11)
debugString = buildGeneralSettingsPage(payload);
} else {
// Default General FE Data Page (0x10)
debugString = buildGeneralFEDataPage(payload);
}
// Log the hex data and parsed values
QLog.d(TAG, "Tx Payload HEX: " + bytesToHex(payload));
QLog.d(TAG, debugString);
if (mIsOpen) {
try {
// Setting the data to be broadcast on the next channel period
mAntChannel.setBroadcastData(payload);
} catch (RemoteException e) {
channelError(e);
}
}
break;
case CHANNEL_COLLISION:
cnt += 1;
break;
case RX_SEARCH_TIMEOUT:
QLog.e(TAG, "No Device Found");
break;
case CHANNEL_CLOSED:
case RX_FAIL:
case RX_FAIL_GO_TO_SEARCH:
case TRANSFER_RX_FAILED:
case TRANSFER_TX_COMPLETED:
case TRANSFER_TX_FAILED:
case TRANSFER_TX_START:
case UNKNOWN:
// TODO More complex communication will need to handle these events
break;
}
break;
case ANT_VERSION:
case BURST_TRANSFER_DATA:
case CAPABILITIES:
case CHANNEL_ID:
case CHANNEL_RESPONSE:
case CHANNEL_STATUS:
case SERIAL_NUMBER:
case OTHER:
// TODO More complex communication will need to handle these message types
break;
}
}
/**
* Build General Fitness Equipment Data Page (0x10) - Page 16
* Following Table 8-7 format exactly
* @param payload byte array to populate
* @return debug string with hex and parsed values
*/
private String buildGeneralFEDataPage(byte[] payload) {
payload[0] = 0x10; // Data Page Number = 0x10 (Page 16)
// Byte 1: Equipment Type Bit Field (Refer to Table 8-8)
payload[1] = 0x19; // Equipment type: Bike (stationary bike = 0x19)
// Byte 2: Elapsed Time (0.25 seconds resolution, rollover at 64s)
int elapsedTime025s = (int) (elapsedTimeSeconds * 4) & 0xFF;
payload[2] = (byte) elapsedTime025s;
// Byte 3: Distance Traveled (1 meter resolution, rollover at 256m)
int distanceMeters = (int) (totalDistance) & 0xFF;
payload[3] = (byte) distanceMeters;
// Bytes 4-5: Speed (0.001 m/s resolution, 0xFFFF = invalid)
int speedMms = (int) (currentSpeedKph / 3.6 * 1000);
if (speedMms > 65534) speedMms = 65534; // Max valid value
payload[4] = (byte) (speedMms & 0xFF); // Speed LSB
payload[5] = (byte) ((speedMms >> 8) & 0xFF); // Speed MSB
// Byte 6: Heart Rate (0xFF = invalid)
payload[6] = (byte) (currentHeartRate == 0 ? 0xFF : currentHeartRate);
// Byte 7: Capabilities Bit Field (4 bits 0:3) + FE State Bit Field (4 bits 4:7)
payload[7] = 0x00; // Set to 0x00 for now (refer to Tables 8-9 and 8-10)
// Create debug string
return String.format(Locale.US,
"General FE Data Page (0x10): " +
"Page=0x%02X, Equipment=0x%02X(Bike), " +
"ElapsedTime=0x%02X(%.1fs), Distance=0x%02X(%dm), " +
"Speed=0x%02X%02X(%.1fkm/h), HeartRate=0x%02X(%s), " +
"Capabilities=0x%02X",
payload[0] & 0xFF, payload[1] & 0xFF,
payload[2] & 0xFF, elapsedTimeSeconds,
payload[3] & 0xFF, distanceMeters,
payload[5] & 0xFF, payload[4] & 0xFF, currentSpeedKph,
payload[6] & 0xFF, currentHeartRate == 0 ? "Invalid" : currentHeartRate + "bpm",
payload[7] & 0xFF);
}
/**
* Build Specific Trainer/Stationary Bike Data Page (0x19) - Page 25
* Following Table 8-25 format exactly
* @param payload byte array to populate
* @return debug string with hex and parsed values
*/
private String buildBikeDataPage(byte[] payload) {
payload[0] = 0x19; // Data Page Number = 0x19 (Page 25)
// Byte 1: Update Event Count (increments with each information update)
eventPowerCount = (eventPowerCount + 1) & 0xFF;
payload[1] = (byte) eventPowerCount;
// Byte 2: Instantaneous Cadence (RPM, 0xFF = invalid)
payload[2] = (byte) (currentCadence == 0 ? 0xFF : currentCadence);
// Bytes 3-4: Accumulated Power (1 watt resolution, rollover at 65536W)
// This is cumulative power, not instantaneous
cumulativeWatt = (cumulativeWatt + currentPower);
payload[3] = (byte) (cumulativeWatt & 0xFF); // Accumulated Power LSB
payload[4] = (byte) ((cumulativeWatt >> 8) & 0xFF); // Accumulated Power MSB
// Bytes 5-6: Instantaneous Power (1.5 bytes, 0xFFF = invalid for both fields)
if (currentPower > 4094) {
// 0xFFF indicates BOTH instantaneous and accumulated power fields are invalid
payload[5] = (byte) 0xFF; // Instantaneous Power LSB
payload[6] = (byte) 0xFF; // Instantaneous Power MSB (bits 0-3) + Trainer Status (bits 4-7)
} else {
payload[5] = (byte) (currentPower & 0xFF); // Instantaneous Power LSB
payload[6] = (byte) ((currentPower >> 8) & 0x0F); // Instantaneous Power MSN (bits 0-3)
// Bits 4-7 of byte 6: Trainer Status Bit Field (refer to Table 8-27)
payload[6] |= 0x00; // Trainer status = 0 for now
}
// Byte 7: Flags Bit Field (bits 0-3) + FE State Bit Field (bits 4-7)
payload[7] = 0x00; // Set to 0x00 for now
// Create debug string
String cadenceStr = currentCadence == 0 ? "Invalid" : currentCadence + "rpm";
String powerStr = currentPower > 4094 ? "Invalid" : currentPower + "W";
return String.format(Locale.US,
"Bike Data Page (0x19): " +
"Page=0x%02X, EventCount=0x%02X(%d), " +
"Cadence=0x%02X(%s), AccumPower=0x%02X%02X(%dW), " +
"InstPower=0x%X%02X(%s), Flags=0x%02X",
payload[0] & 0xFF, payload[1] & 0xFF, eventCount,
payload[2] & 0xFF, cadenceStr,
payload[4] & 0xFF, payload[3] & 0xFF, cumulativeWatt,
(payload[6] & 0x0F), payload[5] & 0xFF, powerStr,
payload[7] & 0xFF);
}
/**
* Build General Settings Page (0x11) - Page 17
* Following Table 8-11 format exactly
* @param payload byte array to populate
* @return debug string with hex and parsed values
*/
private String buildGeneralSettingsPage(byte[] payload) {
payload[0] = 0x11; // Data Page Number = 0x11 (Page 17)
// Byte 1: Reserved (0xFF - Do not interpret)
payload[1] = (byte) 0xFF;
// Byte 2: Reserved (0xFF - Do not interpret)
payload[2] = (byte) 0xFF;
// Byte 3: Cycle length (0.01 meters resolution, 0xFF = invalid)
// Length of one 'cycle' - for bike this could be wheel circumference
int cycleLengthCm = 210; // 2.1m wheel circumference = 210cm
payload[3] = (byte) (cycleLengthCm & 0xFF);
// Bytes 4-5: Incline Percentage (signed integer, 0.01% resolution, 0x7FFF = invalid)
int inclinePercent001 = (int) (currentInclination * 100); // Convert to 0.01% units
if (inclinePercent001 < -10000) inclinePercent001 = -10000; // Min -100.00%
if (inclinePercent001 > 10000) inclinePercent001 = 10000; // Max +100.00%
payload[4] = (byte) (inclinePercent001 & 0xFF); // Incline LSB
payload[5] = (byte) ((inclinePercent001 >> 8) & 0xFF); // Incline MSB
// Byte 6: Resistance Level (0.5% resolution, percentage of maximum applicable resistance)
int resistanceLevel05 = (int) (currentResistance * 2); // Convert to 0.5% units
if (resistanceLevel05 > 200) resistanceLevel05 = 200; // Max 100% = 200 in 0.5% units
payload[6] = (byte) (resistanceLevel05 & 0xFF);
// Byte 7: Capabilities Bit Field (bits 0-3) + FE State Bit Field (bits 4-7)
payload[7] = 0x00; // Set to 0x00 for now
// Create debug string
return String.format(Locale.US,
"General Settings Page (0x11): " +
"Page=0x%02X, Reserved1=0x%02X, Reserved2=0x%02X, " +
"CycleLength=0x%02X(%.2fm), Incline=0x%02X%02X(%.2f%%), " +
"Resistance=0x%02X(%d%%), Capabilities=0x%02X",
payload[0] & 0xFF, payload[1] & 0xFF, payload[2] & 0xFF,
payload[3] & 0xFF, cycleLengthCm / 100.0,
payload[5] & 0xFF, payload[4] & 0xFF, currentInclination,
payload[6] & 0xFF, currentResistance,
payload[7] & 0xFF);
}
/**
* Handle incoming control commands
*/
private void handleControlCommand(byte[] data) {
if (data.length < 8) return;
byte pageNumber = data[0];
QLog.d(TAG, "Received control command page: 0x" + String.format("%02X", pageNumber));
QLog.d(TAG, "Control Command HEX: " + bytesToHex(data));
// Handle control command pages
switch (pageNumber) {
case 0x30: // Basic Resistance
handleBasicResistanceCommand(data);
break;
case 0x31: // Target Power
handleTargetPowerCommand(data);
break;
case 0x33: // Track Resistance
handleTrackResistanceCommand(data);
break;
default:
QLog.d(TAG, "Unknown control page: 0x" + String.format("%02X", pageNumber));
break;
}
}
private void handleBasicResistanceCommand(byte[] data) {
int resistance = data[7] & 0xFF; // Resistance in 0.5% increments
double resistancePercent = resistance * 0.5;
QLog.d(TAG, String.format(Locale.US,
"Basic Resistance Command (0x30): Resistance=0x%02X(%.1f%%)",
resistance, resistancePercent));
if (resistancePercent != requestedResistance && controlListener != null) {
requestedResistance = (int) resistancePercent;
controlListener.onResistanceChangeRequested(requestedResistance);
}
}
private void handleTargetPowerCommand(byte[] data) {
int targetPower = ((data[7] & 0xFF) << 8) | (data[6] & 0xFF);
targetPower = targetPower / 4;
QLog.d(TAG, String.format(Locale.US,
"Target Power Command (0x31): Power=0x%02X%02X(%dW)",
data[7] & 0xFF, data[6] & 0xFF, targetPower));
if (targetPower != requestedPower && controlListener != null) {
requestedPower = targetPower;
controlListener.onPowerChangeRequested(targetPower);
}
}
private void handleTrackResistanceCommand(byte[] data) {
// Grade is in 0.01% increments, signed 16-bit
int gradeRaw = ((data[6] & 0xFF) << 8) | (data[5] & 0xFF);
if (gradeRaw > 32767) gradeRaw -= 65536; // Convert to signed
double grade = (gradeRaw - 0x4E20) * 0.01;
QLog.d(TAG, String.format(Locale.US,
"Track Resistance Command (0x33): Grade=0x%02X%02X(%.2f%%)",
data[6] & 0xFF, data[5] & 0xFF, grade));
if (Math.abs(grade - requestedInclination) > 0.1 && controlListener != null) {
requestedInclination = grade;
controlListener.onInclinationChangeRequested(grade);
}
}
}
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.content.BroadcastReceiver;
import android.content.ContextWrapper;
import android.content.IntentFilter;
@@ -89,12 +89,12 @@ public class BleAdvertiser {
private static AdvertiseCallback advertiseCallback = new AdvertiseCallback() {
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
Log.d("BleAdvertiser", "Advertising started successfully");
QLog.d("BleAdvertiser", "Advertising started successfully");
}
@Override
public void onStartFailure(int errorCode) {
Log.e("BleAdvertiser", "Advertising failed with error code: " + errorCode);
QLog.e("BleAdvertiser", "Advertising failed with error code: " + errorCode);
}
};
}

View File

@@ -25,7 +25,7 @@ import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class CSafeRowerUSBHID {
@@ -34,21 +34,21 @@ public class CSafeRowerUSBHID {
static int lastReadLen = 0;
public static void open(Context context) {
Log.d("QZ","CSafeRowerUSBHID open");
QLog.d("QZ","CSafeRowerUSBHID open");
hidBridge = new HidBridge(context, 0x0002, 0x17A4);
boolean ret = hidBridge.OpenDevice();
Log.d("QZ","hidBridge.OpenDevice " + ret);
QLog.d("QZ","hidBridge.OpenDevice " + ret);
if(ret == false) {
hidBridge = new HidBridge(context, 0x0001, 0x17A4);
ret = hidBridge.OpenDevice();
Log.d("QZ","hidBridge.OpenDevice " + ret);
QLog.d("QZ","hidBridge.OpenDevice " + ret);
}
hidBridge.StartReadingThread();
Log.d("QZ","hidBridge.StartReadingThread");
QLog.d("QZ","hidBridge.StartReadingThread");
}
public static void write (byte[] bytes) {
Log.d("QZ","CSafeRowerUSBHID writing " + new String(bytes, StandardCharsets.ISO_8859_1));
QLog.d("QZ","CSafeRowerUSBHID writing " + new String(bytes, StandardCharsets.ISO_8859_1));
hidBridge.WriteData(bytes);
}
@@ -60,10 +60,10 @@ public class CSafeRowerUSBHID {
if(hidBridge.IsThereAnyReceivedData()) {
receiveData = hidBridge.GetReceivedDataFromQueue();
lastReadLen = receiveData.length;
Log.d("QZ","CSafeRowerUSBHID reading " + lastReadLen + new String(receiveData, StandardCharsets.ISO_8859_1));
QLog.d("QZ","CSafeRowerUSBHID reading " + lastReadLen + new String(receiveData, StandardCharsets.ISO_8859_1));
return receiveData;
} else {
Log.d("QZ","CSafeRowerUSBHID empty data");
QLog.d("QZ","CSafeRowerUSBHID empty data");
lastReadLen = 0;
return null;
}

View File

@@ -34,7 +34,7 @@ import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.util.SparseArray;
import android.os.Build;
import androidx.core.content.ContextCompat;
@@ -49,15 +49,21 @@ public class ChannelService extends Service {
private AntChannelProvider mAntChannelProvider = null;
private boolean mAllowAddChannel = false;
public static native void nativeSetResistance(int resistance);
public static native void nativeSetPower(int power);
public static native void nativeSetInclination(double inclination);
HeartChannelController heartChannelController = null;
PowerChannelController powerChannelController = null;
SpeedChannelController speedChannelController = null;
SDMChannelController sdmChannelController = null;
BikeChannelController bikeChannelController = null; // Added BikeChannelController reference
BikeTransmitterController bikeTransmitterController = null; // Added BikeTransmitterController reference
private ServiceConnection mAntRadioServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.v(TAG, "onServiceConnected");
QLog.v(TAG, "onServiceConnected");
// Must pass in the received IBinder object to correctly construct an AntService object
mAntRadioService = new AntService(service);
@@ -72,7 +78,7 @@ public class ChannelService extends Service {
// radio by attempting to acquire a channel.
boolean legacyInterfaceInUse = mAntChannelProvider.isLegacyInterfaceInUse();
Log.v(TAG, "onServiceConnected mChannelAvailable=" + mChannelAvailable + " legacyInterfaceInUse=" + legacyInterfaceInUse);
QLog.v(TAG, "onServiceConnected mChannelAvailable=" + mChannelAvailable + " legacyInterfaceInUse=" + legacyInterfaceInUse);
// If there are channels OR legacy interface in use, allow adding channels
if (mChannelAvailable || legacyInterfaceInUse) {
@@ -85,7 +91,7 @@ public class ChannelService extends Service {
try {
openAllChannels();
} catch (ChannelNotAvailableException exception) {
Log.e(TAG, "Channel not available!!");
QLog.e(TAG, "Channel not available!!");
}
} catch (RemoteException e) {
// TODO Auto-generated catch block
@@ -117,12 +123,20 @@ public class ChannelService extends Service {
if (null != sdmChannelController) {
sdmChannelController.speed = speed;
}
// Update bike transmitter with speed data (only if not treadmill)
if (!Ant.treadmill && null != bikeTransmitterController) {
bikeTransmitterController.setSpeedKph(speed);
}
}
void setPower(int power) {
if (null != powerChannelController) {
powerChannelController.power = power;
}
// Update bike transmitter with power data (only if not treadmill)
if (!Ant.treadmill && null != bikeTransmitterController) {
bikeTransmitterController.setPower(power);
}
}
void setCadence(int cadence) {
@@ -135,16 +149,164 @@ public class ChannelService extends Service {
if (null != sdmChannelController) {
sdmChannelController.cadence = cadence;
}
// Update bike transmitter with cadence data (only if not treadmill)
if (!Ant.treadmill && null != bikeTransmitterController) {
bikeTransmitterController.setCadence(cadence);
}
}
int getHeart() {
if (null != heartChannelController) {
Log.v(TAG, "getHeart");
QLog.v(TAG, "getHeart");
return heartChannelController.heart;
}
if (null != bikeChannelController) {
return bikeChannelController.getHeartRate();
}
return 0;
}
// Added getters for bike channel data
int getBikeCadence() {
if (null != bikeChannelController) {
return bikeChannelController.getCadence();
}
return 0;
}
int getBikePower() {
if (null != bikeChannelController) {
return bikeChannelController.getPower();
}
return 0;
}
double getBikeSpeed() {
if (null != bikeChannelController) {
return bikeChannelController.getSpeedKph();
}
return 0.0;
}
long getBikeDistance() {
if (null != bikeChannelController) {
return bikeChannelController.getDistance();
}
return 0;
}
boolean isBikeConnected() {
return (bikeChannelController != null && bikeChannelController.isConnected());
}
// ========== BIKE TRANSMITTER METHODS ==========
/**
* Start the bike transmitter (only available if not treadmill)
*/
boolean startBikeTransmitter() {
QLog.v(TAG, "ChannelServiceComm.startBikeTransmitter");
if (Ant.treadmill) {
QLog.w(TAG, "Bike transmitter not available in treadmill mode");
return false;
}
if (bikeTransmitterController != null) {
return bikeTransmitterController.startTransmission();
}
QLog.w(TAG, "Bike transmitter controller is null");
return false;
}
/**
* Stop the bike transmitter
*/
void stopBikeTransmitter() {
QLog.v(TAG, "ChannelServiceComm.stopBikeTransmitter");
if (bikeTransmitterController != null) {
bikeTransmitterController.stopTransmission();
}
}
/**
* Check if bike transmitter is active (only if not treadmill)
*/
boolean isBikeTransmitterActive() {
if (Ant.treadmill) {
return false;
}
return (bikeTransmitterController != null && bikeTransmitterController.isTransmitting());
}
/**
* Update bike transmitter with extended metrics (only if not treadmill)
*/
void updateBikeTransmitterExtendedMetrics(long distanceMeters, int heartRate,
double elapsedTimeSeconds, int resistance,
double inclination) {
if (!Ant.treadmill && bikeTransmitterController != null) {
bikeTransmitterController.setDistance(distanceMeters);
bikeTransmitterController.setHeartRate(heartRate);
bikeTransmitterController.setElapsedTime(elapsedTimeSeconds);
bikeTransmitterController.setResistance(resistance);
bikeTransmitterController.setInclination(inclination);
}
}
/**
* Get the last requested resistance from ANT+ controller (only if not treadmill)
*/
int getRequestedResistanceFromAnt() {
if (!Ant.treadmill && bikeTransmitterController != null) {
return bikeTransmitterController.getRequestedResistance();
}
return -1;
}
/**
* Get the last requested power from ANT+ controller (only if not treadmill)
*/
int getRequestedPowerFromAnt() {
if (!Ant.treadmill && bikeTransmitterController != null) {
return bikeTransmitterController.getRequestedPower();
}
return -1;
}
/**
* Get the last requested inclination from ANT+ controller (only if not treadmill)
*/
double getRequestedInclinationFromAnt() {
if (!Ant.treadmill && bikeTransmitterController != null) {
return bikeTransmitterController.getRequestedInclination();
}
return -100.0;
}
/**
* Clear any pending control requests (only if not treadmill)
*/
void clearAntControlRequests() {
if (!Ant.treadmill && bikeTransmitterController != null) {
bikeTransmitterController.clearControlRequests();
}
}
/**
* Get transmission info for debugging (only if not treadmill)
*/
String getBikeTransmitterInfo() {
if (Ant.treadmill) {
return "Bike transmitter disabled in treadmill mode";
}
if (bikeTransmitterController != null) {
return bikeTransmitterController.getTransmissionInfo();
}
return "Bike transmitter not initialized";
}
/**
* Closes all channels currently added.
*/
@@ -155,7 +317,7 @@ public class ChannelService extends Service {
public void openAllChannels() throws ChannelNotAvailableException {
if (Ant.heartRequest && heartChannelController == null)
heartChannelController = new HeartChannelController();
heartChannelController = new HeartChannelController(Ant.antHeartDeviceNumber);
if (Ant.speedRequest) {
if(Ant.treadmill && sdmChannelController == null) {
@@ -165,6 +327,72 @@ public class ChannelService extends Service {
speedChannelController = new SpeedChannelController(acquireChannel());
}
}
// Add initialization for BikeChannelController (receiver)
if (Ant.bikeRequest && bikeChannelController == null) {
bikeChannelController = new BikeChannelController(Ant.technoGymGroupCycle, Ant.antBikeDeviceNumber);
}
// Add initialization for BikeTransmitterController (transmitter) - only when NOT treadmill
if (!Ant.treadmill && bikeTransmitterController == null) {
QLog.v(TAG, "Initializing BikeTransmitterController (not treadmill mode)");
try {
// Acquire channel like other controllers
AntChannel transmitterChannel = acquireChannel();
if (transmitterChannel != null) {
bikeTransmitterController = new BikeTransmitterController(transmitterChannel);
// Set up control command listener to handle requests from ANT+ devices
bikeTransmitterController.setControlCommandListener(new BikeTransmitterController.ControlCommandListener() {
@Override
public void onResistanceChangeRequested(int resistance) {
QLog.d(TAG, "ChannelService: ANT+ Resistance change requested: " + resistance);
// Send broadcast intent to notify the main application
Intent intent = new Intent("org.cagnulen.qdomyoszwift.ANT_RESISTANCE_CHANGE");
intent.putExtra("resistance", resistance);
nativeSetResistance(resistance);
sendBroadcast(intent);
}
@Override
public void onPowerChangeRequested(int power) {
QLog.d(TAG, "ChannelService: ANT+ Power change requested: " + power + "W");
// Send broadcast intent to notify the main application
Intent intent = new Intent("org.cagnulen.qdomyoszwift.ANT_POWER_CHANGE");
intent.putExtra("power", power);
nativeSetPower(power);
sendBroadcast(intent);
}
@Override
public void onInclinationChangeRequested(double inclination) {
QLog.d(TAG, "ChannelService: ANT+ Inclination change requested: " + inclination + "%");
// Send broadcast intent to notify the main application
Intent intent = new Intent("org.cagnulen.qdomyoszwift.ANT_INCLINATION_CHANGE");
intent.putExtra("inclination", inclination);
nativeSetInclination(inclination);
sendBroadcast(intent);
}
});
QLog.i(TAG, "BikeTransmitterController initialized successfully (bike mode)");
// Start the bike transmitter immediately after initialization
boolean transmissionStarted = bikeTransmitterController.startTransmission();
if (transmissionStarted) {
QLog.i(TAG, "BikeTransmitterController transmission started automatically");
} else {
QLog.w(TAG, "Failed to start BikeTransmitterController transmission");
}
} else {
QLog.e(TAG, "Failed to acquire channel for BikeTransmitterController");
}
} catch (Exception e) {
QLog.e(TAG, "Failed to initialize BikeTransmitterController: " + e.getMessage());
bikeTransmitterController = null;
}
}
}
private void closeAllChannels() {
@@ -176,10 +404,18 @@ public class ChannelService extends Service {
speedChannelController.close();
if (sdmChannelController != null)
sdmChannelController.close();
if (bikeChannelController != null) // Added closing bikeChannelController
bikeChannelController.close();
if (bikeTransmitterController != null) { // Added closing bikeTransmitterController
bikeTransmitterController.close(); // Use close() method like other controllers
}
heartChannelController = null;
powerChannelController = null;
speedChannelController = null;
sdmChannelController = null;
bikeChannelController = null; // Added nullifying bikeChannelController
bikeTransmitterController = null; // Added nullifying bikeTransmitterController
}
AntChannel acquireChannel() throws ChannelNotAvailableException {
@@ -200,13 +436,13 @@ public class ChannelService extends Service {
else {
NetworkKey mNK = new NetworkKey(new byte[]{(byte) 0xb9, (byte) 0xa5, (byte) 0x21, (byte) 0xfb,
(byte) 0xbd, (byte) 0x72, (byte) 0xc3, (byte) 0x45});
Log.v(TAG, mNK.toString());
QLog.v(TAG, mNK.toString());
mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, mNK);
}
} catch (RemoteException e) {
Log.v(TAG, "ACP Remote Ex");
QLog.v(TAG, "ACP Remote Ex");
} catch (UnsupportedFeatureException e) {
Log.v(TAG, "ACP UnsupportedFeature Ex");
QLog.v(TAG, "ACP UnsupportedFeature Ex");
}
}
return mAntChannel;
@@ -223,14 +459,14 @@ public class ChannelService extends Service {
private final BroadcastReceiver mChannelProviderStateChangedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive");
QLog.d(TAG, "onReceive");
if (AntChannelProvider.ACTION_CHANNEL_PROVIDER_STATE_CHANGED.equals(intent.getAction())) {
boolean update = false;
// Retrieving the data contained in the intent
int numChannels = intent.getIntExtra(AntChannelProvider.NUM_CHANNELS_AVAILABLE, 0);
boolean legacyInterfaceInUse = intent.getBooleanExtra(AntChannelProvider.LEGACY_INTERFACE_IN_USE, false);
Log.d(TAG, "onReceive" + mAllowAddChannel + " " + numChannels + " " + legacyInterfaceInUse);
QLog.d(TAG, "onReceive" + mAllowAddChannel + " " + numChannels + " " + legacyInterfaceInUse);
if (mAllowAddChannel) {
// Was a acquire channel allowed
@@ -249,7 +485,7 @@ public class ChannelService extends Service {
try {
openAllChannels();
} catch (ChannelNotAvailableException exception) {
Log.e(TAG, "Channel not available!!");
QLog.e(TAG, "Channel not available!!");
}
}
}
@@ -258,7 +494,7 @@ public class ChannelService extends Service {
};
private void doBindAntRadioService() {
if (BuildConfig.DEBUG) Log.v(TAG, "doBindAntRadioService");
if (BuildConfig.DEBUG) QLog.v(TAG, "doBindAntRadioService");
ContextCompat.registerReceiver(
this,
@@ -273,14 +509,14 @@ public class ChannelService extends Service {
}
private void doUnbindAntRadioService() {
if (BuildConfig.DEBUG) Log.v(TAG, "doUnbindAntRadioService");
if (BuildConfig.DEBUG) QLog.v(TAG, "doUnbindAntRadioService");
// Stop listing for channel available intents
try {
unregisterReceiver(mChannelProviderStateChangedReceiver);
} catch (IllegalArgumentException exception) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Attempting to unregister a never registered Channel Provider State Changed receiver.");
QLog.d(TAG, "Attempting to unregister a never registered Channel Provider State Changed receiver.");
}
if (mAntRadioServiceBound) {
@@ -315,7 +551,7 @@ public class ChannelService extends Service {
}
static void die(String error) {
Log.e(TAG, "DIE: " + error);
QLog.e(TAG, "DIE: " + error);
}
}
}

View File

@@ -4,20 +4,20 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.OpenableColumns;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class ContentHelper {
public static String getFileName(Context context, Uri uri) {
String result = null;
if (uri.getScheme().equals("content")) {
Log.d("ContentHelper", "content");
QLog.d("ContentHelper", "content");
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
Log.d("ContentHelper", "cursor " + cursor);
QLog.d("ContentHelper", "cursor " + cursor);
try {
if (cursor != null && cursor.moveToFirst()) {
result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
Log.d("ContentHelper", "result " + result);
QLog.d("ContentHelper", "result " + result);
}
} finally {
cursor.close();

View File

@@ -0,0 +1,91 @@
package org.cagnulen.qdomyoszwift;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.DisplayCutout;
import org.qtproject.qt5.android.bindings.QtActivity;
public class CustomQtActivity extends QtActivity {
private static final String TAG = "CustomQtActivity";
// Declare the native method that will be implemented in C++
private static native void onInsetsChanged(int top, int bottom, int left, int right);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate: CustomQtActivity initialized");
// This tells the OS that we want to handle the display cutout area ourselves
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
// This is the core of the new solution. We set a listener on the main view.
// The OS will call this listener whenever the insets change (e.g., on rotation).
final View decorView = getWindow().getDecorView();
decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
final float density = getResources().getDisplayMetrics().density;
int top = 0;
int bottom = 0;
int left = 0;
int right = 0;
if (density > 0) {
// Use system window insets as primary source
top = Math.round(insets.getSystemWindowInsetTop() / density);
bottom = Math.round(insets.getSystemWindowInsetBottom() / density);
left = Math.round(insets.getSystemWindowInsetLeft() / density);
right = Math.round(insets.getSystemWindowInsetRight() / density);
// For API 28+, also check display cutout for additional padding
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
DisplayCutout cutout = insets.getDisplayCutout();
if (cutout != null) {
// Use the maximum between system window inset and cutout safe inset
left = Math.max(left, Math.round(cutout.getSafeInsetLeft() / density));
right = Math.max(right, Math.round(cutout.getSafeInsetRight() / density));
top = Math.max(top, Math.round(cutout.getSafeInsetTop() / density));
bottom = Math.max(bottom, Math.round(cutout.getSafeInsetBottom() / density));
}
}
}
Log.d(TAG, "onApplyWindowInsets - Top:" + top + " Bottom:" + bottom + " Left:" + left + " Right:" + right);
Log.d(TAG, "Raw insets - SystemTop:" + insets.getSystemWindowInsetTop() +
" SystemBottom:" + insets.getSystemWindowInsetBottom() +
" SystemLeft:" + insets.getSystemWindowInsetLeft() +
" SystemRight:" + insets.getSystemWindowInsetRight());
Log.d(TAG, "Stable insets - StableTop:" + insets.getStableInsetTop() +
" StableBottom:" + insets.getStableInsetBottom() +
" StableLeft:" + insets.getStableInsetLeft() +
" StableRight:" + insets.getStableInsetRight());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
DisplayCutout cutout = insets.getDisplayCutout();
if (cutout != null) {
Log.d(TAG, "Cutout insets - Top:" + cutout.getSafeInsetTop() +
" Bottom:" + cutout.getSafeInsetBottom() +
" Left:" + cutout.getSafeInsetLeft() +
" Right:" + cutout.getSafeInsetRight());
}
}
// Push the new, correct inset values to the C++ layer
onInsetsChanged(top, bottom, left, right);
return v.onApplyWindowInsets(insets);
}
});
}
// This method is still needed for the QML check
public static int getApiLevel() {
return Build.VERSION.SDK_INT;
}
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
@@ -29,32 +29,26 @@ public class FloatingHandler {
static public int _width;
static public int _height;
static public int _alpha;
static public String _htmlPage = "floating.htm";
public static void show(Context context, int port, int width, int height, int transparency) {
_context = context;
_port = port;
_width = width;
_height = height;
_alpha = transparency;
public static void show(Context context, int port, int width, int height, int transparency, String htmlPage) {
_context = context;
_port = port;
_width = width;
_height = height;
_alpha = transparency;
_htmlPage = htmlPage;
// First it confirms whether the
// 'Display over other apps' permission in given
if (checkOverlayDisplayPermission()) {
if(_intent == null)
_intent = new Intent(context, FloatingWindowGFG.class);
// FloatingWindowGFG service is started
context.startService(_intent);
// The MainActivity closes here
//finish();
} else {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + _context.getPackageName()));
// This method will start the intent. It takes two parameter, one is the Intent and the other is
// an requestCode Integer. Here it is -1.
Activity a = (Activity)_context;
a.startActivityForResult(intent, -1);
}
}
if (checkOverlayDisplayPermission()) {
if (_intent == null)
_intent = new Intent(context, FloatingWindowGFG.class);
context.startService(_intent);
} else {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + _context.getPackageName()));
Activity a = (Activity) _context;
a.startActivityForResult(intent, -1);
}
}
public static void hide() {
if(_intent != null)

View File

@@ -24,8 +24,12 @@ import android.widget.Toast;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.webkit.JavascriptInterface;
import androidx.constraintlayout.widget.ConstraintLayout;
public class FloatingWindowGFG extends Service {
@@ -37,6 +41,14 @@ public class FloatingWindowGFG extends Service {
private WindowManager.LayoutParams floatWindowLayoutParam;
private WindowManager windowManager;
private Button maximizeBtn;
private Handler handler;
private Runnable paddingTimeoutRunnable;
private boolean isDraggingEnabled = false;
private int originalHeight;
private boolean isExpanded = false;
private WebView webView;
private int originalMargin = 20; // in dp, matching the XML layout
private int reducedMargin = 2; // minimal margin when not dragging
// Retrieve the user preference node for the package com.mycompany
SharedPreferences sharedPreferences;
@@ -56,6 +68,9 @@ public class FloatingWindowGFG extends Service {
public void onCreate() {
super.onCreate();
// Initialize handler for timeout operations
handler = new Handler(Looper.getMainLooper());
// The screen height and width are calculated, cause
// the height and width of the floating window is set depending on this
/*DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
@@ -73,23 +88,30 @@ public class FloatingWindowGFG extends Service {
// inflate a new view hierarchy from the floating_layout xml
floatView = (ViewGroup) inflater.inflate(R.layout.floating_layout, null);
WebView wv = (WebView)floatView.findViewById(R.id.webview);
wv.setWebViewClient(new WebViewClient(){
webView = (WebView)floatView.findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient(){
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
WebSettings settings = wv.getSettings();
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
wv.loadUrl("http://localhost:" + FloatingHandler._port + "/floating/floating.htm");
wv.clearView();
wv.measure(100, 100);
wv.setAlpha(Float.valueOf(FloatingHandler._alpha) / 100.0f);
// Add JavaScript interface for communication with HTML
webView.addJavascriptInterface(new WebAppInterface(), "Android");
webView.loadUrl("http://localhost:" + FloatingHandler._port + "/floating/" + FloatingHandler._htmlPage);
webView.clearView();
webView.measure(100, 100);
webView.setAlpha(Float.valueOf(FloatingHandler._alpha) / 100.0f);
settings.setBuiltInZoomControls(true);
settings.setUseWideViewPort(true);
settings.setDomStorageEnabled(true);
Log.d("QZ","loadurl");
QLog.d("QZ","loadurl");
// Initially set reduced margin for normal operation
setWebViewMargin(reducedMargin);
// WindowManager.LayoutParams takes a lot of parameters to set the
@@ -116,17 +138,18 @@ public class FloatingWindowGFG extends Service {
// 5) Next parameter is Layout_Format. System chooses a format that supports
// translucency by PixelFormat.TRANSLUCENT
originalHeight = FloatingHandler._height;
floatWindowLayoutParam = new WindowManager.LayoutParams(
(int) (FloatingHandler._width ),
(int) (FloatingHandler._height ),
(int) (originalHeight ),
LAYOUT_TYPE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
);
// The Gravity of the Floating Window is set.
// The Window will appear in the center of the screen
floatWindowLayoutParam.gravity = Gravity.CENTER;
// Use TOP | LEFT for free positioning without constraints
floatWindowLayoutParam.gravity = Gravity.TOP | Gravity.LEFT;
// X and Y value of the window is set
floatWindowLayoutParam.x = 0;
@@ -145,48 +168,86 @@ public class FloatingWindowGFG extends Service {
// The window can be moved at any position on the screen.
floatView.setOnTouchListener(new View.OnTouchListener() {
final WindowManager.LayoutParams floatWindowLayoutUpdateParam = floatWindowLayoutParam;
double x;
double y;
double px;
double py;
int initialX;
int initialY;
float initialTouchX;
float initialTouchY;
boolean isDragging = false;
final int TOUCH_THRESHOLD = 10; // Threshold for distinguishing tap vs drag
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.d("QZ","onTouch");
QLog.d("QZ","onTouch action: " + event.getAction());
switch (event.getAction()) {
// When the window will be touched,
// the x and y position of that position
// will be retrieved
case MotionEvent.ACTION_DOWN:
x = floatWindowLayoutUpdateParam.x;
y = floatWindowLayoutUpdateParam.y;
// returns the original raw X
// coordinate of this event
px = event.getRawX();
// returns the original raw Y
// coordinate of this event
py = event.getRawY();
// Store initial positions
initialX = floatWindowLayoutUpdateParam.x;
initialY = floatWindowLayoutUpdateParam.y;
initialTouchX = event.getRawX();
initialTouchY = event.getRawY();
isDragging = false;
// Enable dragging for 5 seconds
enableDraggingTemporarily();
break;
// When the window will be dragged around,
// it will update the x, y of the Window Layout Parameter
case MotionEvent.ACTION_MOVE:
floatWindowLayoutUpdateParam.x = (int) ((x + event.getRawX()) - px);
floatWindowLayoutUpdateParam.y = (int) ((y + event.getRawY()) - py);
SharedPreferences.Editor myEdit = sharedPreferences.edit();
myEdit.putInt(PREF_NAME_X, floatWindowLayoutUpdateParam.x);
myEdit.putInt(PREF_NAME_Y, floatWindowLayoutUpdateParam.y);
myEdit.commit();
// updated parameter is applied to the WindowManager
windowManager.updateViewLayout(floatView, floatWindowLayoutUpdateParam);
break;
// Calculate distance moved
float deltaX = event.getRawX() - initialTouchX;
float deltaY = event.getRawY() - initialTouchY;
// Check if we've moved enough to consider this a drag
if (!isDragging && (Math.abs(deltaX) > TOUCH_THRESHOLD || Math.abs(deltaY) > TOUCH_THRESHOLD)) {
isDragging = true;
}
return false;
// Only allow dragging if it's temporarily enabled
if (isDragging && isDraggingEnabled) {
// Get screen dimensions for boundary checking
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;
// Calculate new position
int newX = initialX + (int) deltaX;
int newY = initialY + (int) deltaY;
// Apply boundary constraints
// Keep window within screen bounds
int windowWidth = FloatingHandler._width;
int windowHeight = FloatingHandler._height;
if (newX < 0) newX = 0;
if (newY < 0) newY = 0;
if (newX + windowWidth > screenWidth) newX = screenWidth - windowWidth;
if (newY + windowHeight > screenHeight) newY = screenHeight - windowHeight;
// Update position
floatWindowLayoutUpdateParam.x = newX;
floatWindowLayoutUpdateParam.y = newY;
// Save position to preferences
SharedPreferences.Editor myEdit = sharedPreferences.edit();
myEdit.putInt(PREF_NAME_X, floatWindowLayoutUpdateParam.x);
myEdit.putInt(PREF_NAME_Y, floatWindowLayoutUpdateParam.y);
myEdit.apply(); // Use apply() instead of commit() for better performance
// Apply updated parameter to the WindowManager
windowManager.updateViewLayout(floatView, floatWindowLayoutUpdateParam);
}
break;
case MotionEvent.ACTION_UP:
// If it wasn't a drag, it's a tap - let the WebView handle it
if (!isDragging) {
return false; // Let the event propagate to WebView
}
isDragging = false;
break;
}
return isDragging && isDraggingEnabled; // Consume the event only if we're dragging and dragging is enabled
}
});
}
@@ -200,4 +261,107 @@ public class FloatingWindowGFG extends Service {
// Window is removed from the screen
windowManager.removeView(floatView);
}
// Method to enable dragging temporarily for 5 seconds
private void enableDraggingTemporarily() {
isDraggingEnabled = true;
// Increase margin for better dragging experience
setWebViewMargin(originalMargin);
// Cancel any existing timeout
if (paddingTimeoutRunnable != null) {
handler.removeCallbacks(paddingTimeoutRunnable);
}
// Create new timeout runnable
paddingTimeoutRunnable = new Runnable() {
@Override
public void run() {
isDraggingEnabled = false;
// Restore reduced margin for normal operation
setWebViewMargin(reducedMargin);
QLog.d("QZ", "Dragging disabled after timeout, margin restored");
}
};
// Schedule timeout for 5 seconds
handler.postDelayed(paddingTimeoutRunnable, 5000);
}
// Method to expand window height dynamically
private void expandWindow(int additionalHeight) {
if (!isExpanded) {
isExpanded = true;
floatWindowLayoutParam.height = originalHeight + additionalHeight;
// Adjust Y position to keep window within screen bounds
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int screenHeight = displayMetrics.heightPixels;
if (floatWindowLayoutParam.y + floatWindowLayoutParam.height > screenHeight) {
floatWindowLayoutParam.y = screenHeight - floatWindowLayoutParam.height;
if (floatWindowLayoutParam.y < 0) {
floatWindowLayoutParam.y = 0;
}
}
windowManager.updateViewLayout(floatView, floatWindowLayoutParam);
QLog.d("QZ", "Window expanded to height: " + floatWindowLayoutParam.height);
}
}
// Method to restore original window height
private void restoreWindow() {
if (isExpanded) {
isExpanded = false;
floatWindowLayoutParam.height = originalHeight;
windowManager.updateViewLayout(floatView, floatWindowLayoutParam);
QLog.d("QZ", "Window restored to original height: " + originalHeight);
}
}
// Method to set WebView margin dynamically
private void setWebViewMargin(int marginDp) {
if (webView != null) {
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) webView.getLayoutParams();
int marginPx = (int) (marginDp * getResources().getDisplayMetrics().density);
params.setMargins(marginPx, marginPx, marginPx, marginPx);
webView.setLayoutParams(params);
QLog.d("QZ", "WebView margin set to: " + marginDp + "dp (" + marginPx + "px)");
}
}
// JavaScript interface class
public class WebAppInterface {
@JavascriptInterface
public void expandFloatingWindow(int additionalHeight) {
handler.post(new Runnable() {
@Override
public void run() {
expandWindow(additionalHeight);
}
});
}
@JavascriptInterface
public void restoreFloatingWindow() {
handler.post(new Runnable() {
@Override
public void run() {
restoreWindow();
}
});
}
@JavascriptInterface
public void enableDraggingMargins() {
handler.post(new Runnable() {
@Override
public void run() {
enableDraggingTemporarily();
}
});
}
}
}

View File

@@ -10,7 +10,7 @@ import android.os.Build;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import android.content.pm.ServiceInfo;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class ForegroundService extends Service {
public static final String CHANNEL_ID = "ForegroundServiceChannel";
@@ -43,7 +43,7 @@ public class ForegroundService extends Service {
startForeground(1, notification);
}
} catch (Exception e) {
Log.e("ForegroundService", "Failed to start foreground service", e);
QLog.e("ForegroundService", "Failed to start foreground service", e);
return START_NOT_STICKY;
}
//do heavy work on a background thread

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.garmin.android.connectiq.ConnectIQ;
import com.garmin.android.connectiq.ConnectIQAdbStrategy;
import com.garmin.android.connectiq.IQApp;
@@ -53,22 +53,22 @@ public class Garmin {
private static Integer Power = 0;
public static int getHR() {
Log.d(TAG, "getHR " + HR);
QLog.d(TAG, "getHR " + HR);
return HR;
}
public static int getPower() {
Log.d(TAG, "getPower " + Power);
QLog.d(TAG, "getPower " + Power);
return Power;
}
public static double getSpeed() {
Log.d(TAG, "getSpeed " + Speed);
QLog.d(TAG, "getSpeed " + Speed);
return Speed;
}
public static int getFootCad() {
Log.d(TAG, "getFootCad " + FootCad);
QLog.d(TAG, "getFootCad " + FootCad);
return FootCad;
}
@@ -83,7 +83,7 @@ public class Garmin {
@Override
public void onInitializeError(ConnectIQ.IQSdkErrorStatus errStatus) {
Log.e(TAG, errStatus.toString());
QLog.e(TAG, errStatus.toString());
connectIqReady = false;
}
@@ -91,7 +91,7 @@ public class Garmin {
public void onSdkReady() {
connectIqInitializing = false;
connectIqReady = true;
Log.i(TAG, " onSdkReady");
QLog.i(TAG, " onSdkReady");
registerWatchMessagesReceiver();
registerDeviceStatusReceiver();
@@ -118,16 +118,16 @@ public class Garmin {
try {
List<IQDevice> devices = connectIQ.getConnectedDevices();
if (devices != null && devices.size() > 0) {
Log.v(TAG, "getDevice connected: " + devices.get(0).toString() );
QLog.v(TAG, "getDevice connected: " + devices.get(0).toString() );
deviceCache = devices.get(0);
return deviceCache;
} else {
return deviceCache;
}
} catch (InvalidStateException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
} catch (ServiceUnavailableException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
return null;
}
@@ -193,33 +193,33 @@ public class Garmin {
@Override
public void onApplicationInfoReceived(IQApp app) {
Log.d(TAG, "App installed.");
QLog.d(TAG, "App installed.");
}
@Override
public void onApplicationNotInstalled(String applicationId) {
if (getDevice() != null) {
Toast.makeText(context, "App not installed on your Garmin watch", Toast.LENGTH_LONG).show();
Log.d(TAG, "watch app not installed.");
QLog.d(TAG, "watch app not installed.");
}
}
});
} catch (InvalidStateException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
} catch (ServiceUnavailableException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
}
private static void registerDeviceStatusReceiver() {
Log.d(TAG, "registerDeviceStatusReceiver");
QLog.d(TAG, "registerDeviceStatusReceiver");
IQDevice device = getDevice();
try {
if (device != null) {
connectIQ.registerForDeviceEvents(device, new ConnectIQ.IQDeviceEventListener() {
@Override
public void onDeviceStatusChanged(IQDevice device, IQDevice.IQDeviceStatus newStatus) {
Log.d(TAG, "Device status changed, now " + newStatus);
QLog.d(TAG, "Device status changed, now " + newStatus);
}
});
}
@@ -229,7 +229,7 @@ public class Garmin {
}
private static void registerWatchMessagesReceiver(){
Log.d(TAG, "registerWatchMessageReceiver");
QLog.d(TAG, "registerWatchMessageReceiver");
IQDevice device = getDevice();
try {
if (device != null) {
@@ -238,7 +238,7 @@ public class Garmin {
public void onMessageReceived(IQDevice device, IQApp app, List<Object> message, ConnectIQ.IQMessageStatus status) {
if (status == ConnectIQ.IQMessageStatus.SUCCESS) {
//MessageHandler.getInstance().handleMessageFromWatchUsingCIQ(message, status, context);
Log.d(TAG, "onMessageReceived, status: " + status.toString() + message.get(0));
QLog.d(TAG, "onMessageReceived, status: " + status.toString() + message.get(0));
try {
String var[] = message.toArray()[0].toString().split(",");
HR = Integer.parseInt(var[0].replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\{", "").replaceAll("\\}", "").replaceAll(" ", "").split("=")[1]);
@@ -249,21 +249,21 @@ public class Garmin {
Speed = Double.parseDouble(var[1].replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\{", "").replaceAll("\\}", "").replaceAll(" ", "").split("=")[1]);
}
}
Log.d(TAG, "HR " + HR);
Log.d(TAG, "FootCad " + FootCad);
QLog.d(TAG, "HR " + HR);
QLog.d(TAG, "FootCad " + FootCad);
} catch (Exception e) {
Log.e(TAG, "Processing error", e);
QLog.e(TAG, "Processing error", e);
}
} else {
Log.d(TAG, "onMessageReceived error, status: " + status.toString());
QLog.d(TAG, "onMessageReceived error, status: " + status.toString());
}
}
});
} else {
Log.d(TAG, "registerWatchMessagesReceiver: No device found.");
QLog.d(TAG, "registerWatchMessagesReceiver: No device found.");
}
} catch (InvalidStateException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
}
@@ -273,19 +273,19 @@ public class Garmin {
try {
if (context != null) {
Log.d(TAG, "Shutting down with wrapped context");
QLog.d(TAG, "Shutting down with wrapped context");
connectIQ.shutdown(context);
} else {
Log.d(TAG, "Shutting down without wrapped context");
QLog.d(TAG, "Shutting down without wrapped context");
connectIQ.shutdown(applicationContext);
}
} catch (InvalidStateException e) {
// This is usually because the SDK was already shut down so no worries.
Log.e(TAG, "This is usually because the SDK was already shut down so no worries.", e);
QLog.e(TAG, "This is usually because the SDK was already shut down so no worries.", e);
} catch (IllegalArgumentException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
} catch (RuntimeException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
}
@@ -299,11 +299,11 @@ public class Garmin {
}
}
} catch (InvalidStateException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
} catch (IllegalArgumentException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
} catch (RuntimeException e) {
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
}
}

View File

@@ -1,7 +1,7 @@
package org.cagnulen.qdomyoszwift;
import android.content.Context;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.app.Activity;
// ANT+ Plugin imports
@@ -42,14 +42,14 @@ public class HeartChannelController {
private boolean isConnected = false;
public int heart = 0; // Public to be accessible from ChannelService
public HeartChannelController() {
public HeartChannelController(int antHeartDeviceNumber) {
this.context = Ant.activity;
openChannel();
openChannel(antHeartDeviceNumber);
}
public boolean openChannel() {
// Request access to first available heart rate device
releaseHandle = AntPlusHeartRatePcc.requestAccess((Activity)context, 0, 0, // 0 means first available device
public boolean openChannel(int deviceNumber) {
// Request access to heart rate device (deviceNumber = 0 means first available)
releaseHandle = AntPlusHeartRatePcc.requestAccess((Activity)context, deviceNumber, 0,
new IPluginAccessResultReceiver<AntPlusHeartRatePcc>() {
@Override
public void onResultReceived(AntPlusHeartRatePcc result, RequestAccessResult resultCode, DeviceState initialDeviceState) {
@@ -57,26 +57,26 @@ public class HeartChannelController {
case SUCCESS:
hrPcc = result;
isConnected = true;
Log.d(TAG, "Connected to heart rate monitor: " + result.getDeviceName());
QLog.d(TAG, "Connected to heart rate monitor: " + result.getDeviceName() + " (Device #" + deviceNumber + ")");
subscribeToHrEvents();
break;
case CHANNEL_NOT_AVAILABLE:
Log.e(TAG, "Channel Not Available");
QLog.e(TAG, "Channel Not Available");
break;
case ADAPTER_NOT_DETECTED:
Log.e(TAG, "ANT Adapter Not Available");
QLog.e(TAG, "ANT Adapter Not Available");
break;
case BAD_PARAMS:
Log.e(TAG, "Bad request parameters");
QLog.e(TAG, "Bad request parameters");
break;
case OTHER_FAILURE:
Log.e(TAG, "RequestAccess failed");
QLog.e(TAG, "RequestAccess failed");
break;
case DEPENDENCY_NOT_INSTALLED:
Log.e(TAG, "Dependency not installed");
QLog.e(TAG, "Dependency not installed");
break;
default:
Log.e(TAG, "Unrecognized result: " + resultCode);
QLog.e(TAG, "Unrecognized result: " + resultCode);
break;
}
}
@@ -84,7 +84,7 @@ public class HeartChannelController {
new IDeviceStateChangeReceiver() {
@Override
public void onDeviceStateChange(DeviceState newDeviceState) {
Log.d(TAG, "Device State Changed to: " + newDeviceState);
QLog.d(TAG, "Device State Changed to: " + newDeviceState);
if (newDeviceState == DeviceState.DEAD) {
isConnected = false;
}
@@ -104,7 +104,7 @@ public class HeartChannelController {
BigDecimal heartBeatEventTime, DataState dataState) {
heart = computedHeartRate;
Log.d(TAG, "Heart Rate: " + heart);
QLog.d(TAG, "Heart Rate: " + heart);
}
});
}
@@ -117,7 +117,7 @@ public class HeartChannelController {
}
hrPcc = null;
isConnected = false;
Log.d(TAG, "Channel Closed");
QLog.d(TAG, "Channel Closed");
}
public int getHeartRate() {

View File

@@ -16,7 +16,7 @@ import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.os.Build;
import androidx.core.content.ContextCompat;
@@ -169,7 +169,7 @@ public class HidBridge {
} catch(NullPointerException e)
{
Log("Error happened while writing. Could not connect to the device or interface is busy?");
Log.e("HidBridge", Log.getStackTraceString(e));
QLog.e("HidBridge", QLog.getStackTraceString(e));
return false;
}
return true;
@@ -289,7 +289,7 @@ public class HidBridge {
catch (NullPointerException e) {
Log("Error happened while reading. No device or the connection is busy");
Log.e("HidBridge", Log.getStackTraceString(e));
QLog.e("HidBridge", QLog.getStackTraceString(e));
}
catch (ThreadDeath e) {
if (readConnection != null) {
@@ -332,7 +332,7 @@ public class HidBridge {
}
}
else {
Log.d("TAG", "permission denied for the device " + device);
QLog.d("TAG", "permission denied for the device " + device);
}
}
}
@@ -344,7 +344,7 @@ public class HidBridge {
* @param message to log.
*/
private void Log(String message) {
Log.d("HidBridge", message);
QLog.d("HidBridge", message);
}
/**

View File

@@ -8,7 +8,7 @@ import com.garmin.android.connectiq.IQDevice;
import java.nio.BufferUnderflowException;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class IQMessageReceiverWrapper extends BroadcastReceiver {
private final BroadcastReceiver receiver;
@@ -20,7 +20,7 @@ public class IQMessageReceiverWrapper extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive intent " + intent.getAction());
QLog.d(TAG, "onReceive intent " + intent.getAction());
if ("com.garmin.android.connectiq.SEND_MESSAGE_STATUS".equals(intent.getAction())) {
replaceIQDeviceById(intent, "com.garmin.android.connectiq.EXTRA_REMOTE_DEVICE");
} else if ("com.garmin.android.connectiq.OPEN_APPLICATION".equals(intent.getAction())) {
@@ -32,7 +32,7 @@ public class IQMessageReceiverWrapper extends BroadcastReceiver {
try {
receiver.onReceive(context, intent);
} catch (IllegalArgumentException | BufferUnderflowException e) {
Log.d(TAG, e.toString());
QLog.d(TAG, e.toString());
}
}
@@ -44,7 +44,7 @@ public class IQMessageReceiverWrapper extends BroadcastReceiver {
intent.putExtra(extraName, device.getDeviceIdentifier());
}
} catch (ClassCastException e) {
Log.d(TAG, e.toString());
QLog.d(TAG, e.toString());
// It's already a long, i.e. on the simulator.
}
}

View File

@@ -5,7 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.provider.Settings;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class LocationHelper {
private static final String TAG = "LocationHelper";
@@ -13,7 +13,7 @@ public class LocationHelper {
private static boolean isBluetoothEnabled = false;
public static boolean start(Context context) {
Log.d(TAG, "Starting LocationHelper check...");
QLog.d(TAG, "Starting LocationHelper check...");
isLocationEnabled = isLocationEnabled(context);
isBluetoothEnabled = isBluetoothEnabled();
@@ -23,7 +23,7 @@ public class LocationHelper {
public static void requestPermissions(Context context) {
if (!isLocationEnabled || !isBluetoothEnabled) {
Log.d(TAG, "Some services are disabled. Prompting user...");
QLog.d(TAG, "Some services are disabled. Prompting user...");
if (!isLocationEnabled) {
promptEnableLocation(context);
}
@@ -31,7 +31,7 @@ public class LocationHelper {
promptEnableBluetooth(context);
}
} else {
Log.d(TAG, "All services are already enabled.");
QLog.d(TAG, "All services are already enabled.");
}
}
@@ -50,14 +50,14 @@ public class LocationHelper {
}
private static void promptEnableLocation(Context context) {
Log.d(TAG, "Prompting to enable Location...");
QLog.d(TAG, "Prompting to enable Location...");
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
private static void promptEnableBluetooth(Context context) {
Log.d(TAG, "Prompting to enable Bluetooth...");
QLog.d(TAG, "Prompting to enable Bluetooth...");
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);

View File

@@ -5,15 +5,19 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
public class MediaButtonReceiver extends BroadcastReceiver {
private static MediaButtonReceiver instance;
private static final int TARGET_VOLUME = 7; // Middle volume value for infinite gear changes
private static boolean restoringVolume = false; // Flag to prevent recursion
@Override
public void onReceive(Context context, Intent intent) {
Log.d("MediaButtonReceiver", "Received intent: " + intent.toString());
QLog.d("MediaButtonReceiver", "Received intent: " + intent.toString());
String intentAction = intent.getAction();
if ("android.media.VOLUME_CHANGED_ACTION".equals(intentAction)) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
@@ -21,26 +25,87 @@ public class MediaButtonReceiver extends BroadcastReceiver {
int currentVolume = intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_VALUE", -1);
int previousVolume = intent.getIntExtra("android.media.EXTRA_PREV_VOLUME_STREAM_VALUE", -1);
Log.d("MediaButtonReceiver", "Volume changed. Current: " + currentVolume + ", Max: " + maxVolume);
QLog.d("MediaButtonReceiver", "Volume changed. Current: " + currentVolume + ", Previous: " + previousVolume + ", Max: " + maxVolume + ", Restoring: " + restoringVolume);
// If we're restoring volume, skip processing and reset flag
if (restoringVolume) {
QLog.d("MediaButtonReceiver", "Volume restore completed");
restoringVolume = false;
return;
}
// Process the gear change
nativeOnMediaButtonEvent(previousVolume, currentVolume, maxVolume);
// Auto-restore volume to middle value after a short delay to enable infinite gear changes
if (currentVolume != TARGET_VOLUME) {
final AudioManager am = audioManager;
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
QLog.d("MediaButtonReceiver", "Auto-restoring volume to: " + TARGET_VOLUME);
restoringVolume = true;
am.setStreamVolume(AudioManager.STREAM_MUSIC, TARGET_VOLUME, 0);
}
}, 100); // 100ms delay to ensure gear change is processed first
}
}
}
private native void nativeOnMediaButtonEvent(int prev, int current, int max);
public static void registerReceiver(Context context) {
if (instance == null) {
instance = new MediaButtonReceiver();
}
IntentFilter filter = new IntentFilter("android.media.VOLUME_CHANGED_ACTION");
if (Build.VERSION.SDK_INT >= 34) {
context.registerReceiver(instance, filter, Context.RECEIVER_EXPORTED);
} else {
context.registerReceiver(instance, filter);
}
Log.d("MediaButtonReceiver", "registerReceiver");
}
try {
if (instance == null) {
instance = new MediaButtonReceiver();
}
IntentFilter filter = new IntentFilter("android.media.VOLUME_CHANGED_ACTION");
if (context == null) {
QLog.e("MediaButtonReceiver", "Context is null, cannot register receiver");
return;
}
if (Build.VERSION.SDK_INT >= 34) {
try {
context.registerReceiver(instance, filter, Context.RECEIVER_EXPORTED);
} catch (SecurityException se) {
QLog.e("MediaButtonReceiver", "Security exception while registering receiver: " + se.getMessage());
}
} else {
try {
context.registerReceiver(instance, filter);
} catch (SecurityException se) {
QLog.e("MediaButtonReceiver", "Security exception while registering receiver: " + se.getMessage());
}
}
QLog.d("MediaButtonReceiver", "Receiver registered successfully");
// Initialize volume to target value for gear control
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (audioManager != null) {
int currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
if (currentVolume != TARGET_VOLUME) {
QLog.d("MediaButtonReceiver", "Initializing volume to: " + TARGET_VOLUME);
restoringVolume = true;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, TARGET_VOLUME, 0);
// Reset flag after initialization
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
restoringVolume = false;
}
}, 200);
}
}
} catch (IllegalArgumentException e) {
QLog.e("MediaButtonReceiver", "Invalid arguments for receiver registration: " + e.getMessage());
} catch (Exception e) {
QLog.e("MediaButtonReceiver", "Unexpected error while registering receiver: " + e.getMessage());
}
}
public static void unregisterReceiver(Context context) {
if (instance != null) {
context.unregisterReceiver(instance);

View File

@@ -12,7 +12,7 @@ import android.util.DisplayMetrics;
import android.os.Build;
import android.provider.Settings;
import android.app.AppOpsManager;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.annotation.TargetApi;
import com.rvalerio.fgchecker.AppChecker;
@@ -83,11 +83,11 @@ public class MediaProjection {
@Override
public void onForeground(String packageName) {
_packageName = packageName;
/*Log.e("MediaProjection", packageName);
/*QLog.e("MediaProjection", packageName);
if(isLandscape())
Log.e("MediaProjection", "Landscape");
QLog.e("MediaProjection", "Landscape");
else
Log.e("MediaProjection", "Portrait");*/
QLog.e("MediaProjection", "Portrait");*/
}
})
.timeout(1000)

View File

@@ -1,5 +1,5 @@
package org.cagnulen.qdomyoszwift;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class MyActivity extends org.qtproject.qt5.android.bindings.QtActivity {
@@ -12,6 +12,6 @@ public class MyActivity extends org.qtproject.qt5.android.bindings.QtActivity {
super.onCreate(savedInstanceState);
this.getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
activity_ = this;
Log.v(TAG, "onCreate");
QLog.v(TAG, "onCreate");
}
}

View File

@@ -2,7 +2,7 @@ package org.cagnulen.qdomyoszwift;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import java.util.List;
@@ -12,7 +12,7 @@ public class NativeScanCallback extends ScanCallback {
public native void scanError(int code);
@Override
public void onScanResult(int callbackType, ScanResult result) {
Log.i(TAG, "Res " + result);
QLog.i(TAG, "Res " + result);
newScanResult(new ScanRecordResult(result));
}
@@ -24,7 +24,7 @@ public class NativeScanCallback extends ScanCallback {
@Override
public void onScanFailed(int errorCode) {
Log.i(TAG, "onScanFailed "+errorCode);
QLog.i(TAG, "onScanFailed "+errorCode);
scanError(errorCode);
}
}

View File

@@ -17,7 +17,7 @@
package org.cagnulen.qdomyoszwift;
import android.os.RemoteException;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.dsi.ant.channel.AntChannel;
import com.dsi.ant.channel.AntCommandFailedException;
@@ -61,7 +61,7 @@ public class PowerChannelController {
boolean openChannel() {
if (null != mAntChannel) {
if (mIsOpen) {
Log.w(TAG, "Channel was already open");
QLog.w(TAG, "Channel was already open");
} else {
// Channel ID message contains device number, type and transmission type. In
// order for master (TX) channels and slave (RX) channels to connect, they
@@ -92,7 +92,7 @@ public class PowerChannelController {
mAntChannel.open();
mIsOpen = true;
Log.d(TAG, "Opened channel with device number: " + POWER_SENSOR_ID);
QLog.d(TAG, "Opened channel with device number: " + POWER_SENSOR_ID);
} catch (RemoteException e) {
channelError(e);
@@ -102,7 +102,7 @@ public class PowerChannelController {
}
}
} else {
Log.w(TAG, "No channel available");
QLog.w(TAG, "No channel available");
}
return mIsOpen;
@@ -112,7 +112,7 @@ public class PowerChannelController {
void channelError(RemoteException e) {
String logString = "Remote service communication failed.";
Log.e(TAG, logString);
QLog.e(TAG, logString);
}
@@ -142,7 +142,7 @@ public class PowerChannelController {
.append(failureReason);
}
Log.e(TAG, logString.toString());
QLog.e(TAG, logString.toString());
mAntChannel.release();
}
@@ -158,7 +158,7 @@ public class PowerChannelController {
mAntChannel = null;
}
Log.e(TAG, "Channel Closed");
QLog.e(TAG, "Channel Closed");
}
/**
@@ -175,13 +175,13 @@ public class PowerChannelController {
@Override
public void onChannelDeath() {
// Display channel death message when channel dies
Log.e(TAG, "Channel Death");
QLog.e(TAG, "Channel Death");
}
@Override
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
Log.d(TAG, "Rx: " + antParcel);
Log.d(TAG, "Message Type: " + messageType);
QLog.d(TAG, "Rx: " + antParcel);
QLog.d(TAG, "Message Type: " + messageType);
byte[] payload = new byte[8];
if(carousalTimer == null) {
@@ -189,7 +189,7 @@ public class PowerChannelController {
carousalTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Log.d(TAG, "Tx Unsollicited");
QLog.d(TAG, "Tx Unsollicited");
byte[] payload = new byte[8];
eventCount = (eventCount + 1) & 0xFF;
cumulativePower = (cumulativePower + power) & 0xFFFF;
@@ -225,7 +225,7 @@ public class PowerChannelController {
// Rx Data
//updateData(new AcknowledgedDataMessage(antParcel).getPayload());
payload = new AcknowledgedDataMessage(antParcel).getPayload();
Log.d(TAG, "AcknowledgedDataMessage: " + payload);
QLog.d(TAG, "AcknowledgedDataMessage: " + payload);
if ((payload[0] == 0) && (payload[1] == 1) && (payload[2] == (byte)0xAA)) {
payload[0] = (byte) 0x01;
@@ -268,7 +268,7 @@ public class PowerChannelController {
// Constructing channel event message from parcel
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
EventCode code = eventMessage.getEventCode();
Log.d(TAG, "Event Code: " + code);
QLog.d(TAG, "Event Code: " + code);
// Switching on event code to handle the different types of channel events
switch (code) {
@@ -320,7 +320,7 @@ public class PowerChannelController {
break;
case RX_SEARCH_TIMEOUT:
// TODO May want to keep searching
Log.e(TAG, "No Device Found");
QLog.e(TAG, "No Device Found");
break;
case CHANNEL_CLOSED:
case RX_FAIL:

181
src/android/src/QLog.java Normal file
View File

@@ -0,0 +1,181 @@
package org.cagnulen.qdomyoszwift;
import android.util.Log;
/**
* QLog - Wrapper for Android's Log class that redirects logs to Qt's logging system
* Usage: import org.cagnulen.qdomyoszwift.Log;
*/
public class QLog {
public static native void sendToQt(int level, String tag, String message);
static {
try {
// Try to load the native library if needed
System.loadLibrary("qtlogging_native");
} catch (UnsatisfiedLinkError e) {
// Library might be loaded elsewhere, or will be loaded later
Log.w("QLog", "Native library not loaded yet: " + e.getMessage());
}
}
// Debug level methods
public static int d(String tag, String msg) {
try {
sendToQt(3, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.d(tag, msg);
}
public static int d(String tag, String msg, Throwable tr) {
try {
sendToQt(3, tag, msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.d(tag, msg, tr);
}
// Error level methods
public static int e(String tag, String msg) {
try {
sendToQt(6, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.e(tag, msg);
}
public static int e(String tag, String msg, Throwable tr) {
try {
sendToQt(6, tag, msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.e(tag, msg, tr);
}
// Info level methods
public static int i(String tag, String msg) {
try {
sendToQt(4, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.i(tag, msg);
}
public static int i(String tag, String msg, Throwable tr) {
try {
sendToQt(4, tag, msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.i(tag, msg, tr);
}
// Verbose level methods
public static int v(String tag, String msg) {
try {
sendToQt(2, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.v(tag, msg);
}
public static int v(String tag, String msg, Throwable tr) {
try {
sendToQt(2, tag, msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.v(tag, msg, tr);
}
// Warning level methods
public static int w(String tag, String msg) {
try {
sendToQt(5, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.w(tag, msg);
}
public static int w(String tag, String msg, Throwable tr) {
try {
sendToQt(5, tag, msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.w(tag, msg, tr);
}
public static int w(String tag, Throwable tr) {
try {
sendToQt(5, tag, Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.w(tag, tr);
}
// What a Terrible Failure: Report an exception that should never happen
public static int wtf(String tag, String msg) {
try {
sendToQt(7, tag, "WTF: " + msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.wtf(tag, msg);
}
public static int wtf(String tag, Throwable tr) {
try {
sendToQt(7, tag, "WTF: " + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.wtf(tag, tr);
}
public static int wtf(String tag, String msg, Throwable tr) {
try {
sendToQt(7, tag, "WTF: " + msg + '\n' + Log.getStackTraceString(tr));
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.wtf(tag, msg, tr);
}
// Utility methods
public static String getStackTraceString(Throwable tr) {
return Log.getStackTraceString(tr);
}
public static boolean isLoggable(String tag, int level) {
return Log.isLoggable(tag, level);
}
// Additional utility methods
public static int println(int priority, String tag, String msg) {
try {
sendToQt(priority, tag, msg);
} catch (UnsatisfiedLinkError e) {
// Native library not available, continue with Android logging only
}
return Log.println(priority, tag, msg);
}
// API Level 28+ (Android 9+) methods
public static RuntimeException getStackTraceElement() {
try {
return (RuntimeException) Log.class.getMethod("getStackTraceElement").invoke(null);
} catch (Exception e) {
return new RuntimeException("QLog: Failed to get stack trace element");
}
}
}

View File

@@ -17,7 +17,7 @@ import android.os.Environment;
import android.os.IBinder;
import android.os.PowerManager;
import android.provider.Settings;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
@@ -43,6 +43,8 @@ public class QZAdbRemote implements DeviceConnectionListener {
private static final String LOG_TAG = "QZ:AdbRemote";
private static String lastCommand = "";
private static boolean ADBConnected = false;
private static boolean cryptoReady = false;
private static final Object cryptoLock = new Object();
private static String _address = "127.0.0.1";
private static Context _context;
@@ -62,31 +64,46 @@ public class QZAdbRemote implements DeviceConnectionListener {
@Override
public void notifyConnectionEstablished(DeviceConnection devConn) {
QLog.d(LOG_TAG, "notifyConnectionEstablished - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
ADBConnected = true;
Log.i(LOG_TAG, "notifyConnectionEstablished" + lastCommand);
QLog.i(LOG_TAG, "notifyConnectionEstablished - CONNECTED=true, lastCommand=" + lastCommand);
QLog.d(LOG_TAG, "notifyConnectionEstablished - END: ADBConnected=" + ADBConnected);
}
@Override
public void notifyConnectionFailed(DeviceConnection devConn, Exception e) {
QLog.d(LOG_TAG, "notifyConnectionFailed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
ADBConnected = false;
Log.e(LOG_TAG, e.getMessage());
QLog.e(LOG_TAG, "notifyConnectionFailed - ERROR: " + (e != null ? e.getMessage() : "null exception") + ", ADBConnected=" + ADBConnected);
if (e != null) {
QLog.e(LOG_TAG, "notifyConnectionFailed - STACK_TRACE: ", e);
}
}
@Override
public void notifyStreamFailed(DeviceConnection devConn, Exception e) {
QLog.d(LOG_TAG, "notifyStreamFailed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
ADBConnected = false;
Log.e(LOG_TAG, e.getMessage());
QLog.e(LOG_TAG, "notifyStreamFailed - ERROR: " + (e != null ? e.getMessage() : "null exception") + ", ADBConnected=" + ADBConnected);
if (e != null) {
QLog.e(LOG_TAG, "notifyStreamFailed - STACK_TRACE: ", e);
}
}
@Override
public void notifyStreamClosed(DeviceConnection devConn) {
QLog.d(LOG_TAG, "notifyStreamClosed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
ADBConnected = false;
Log.e(LOG_TAG, "notifyStreamClosed");
QLog.e(LOG_TAG, "notifyStreamClosed - ADBConnected=" + ADBConnected);
}
@Override
public AdbCrypto loadAdbCrypto(DeviceConnection devConn) {
return AdbUtils.readCryptoConfig(_context.getFilesDir());
QLog.d(LOG_TAG, "loadAdbCrypto - START: devConn=" + devConn + ", context=" + _context);
AdbCrypto crypto = AdbUtils.readCryptoConfig(_context.getFilesDir());
QLog.d(LOG_TAG, "loadAdbCrypto - RESULT: crypto=" + (crypto != null ? "valid" : "null"));
return crypto;
}
@Override
@@ -96,7 +113,7 @@ public class QZAdbRemote implements DeviceConnectionListener {
@Override
public void receivedData(DeviceConnection devConn, byte[] data, int offset, int length) {
Log.i(LOG_TAG, data.toString());
QLog.i(LOG_TAG, data.toString());
}
@Override
@@ -111,96 +128,132 @@ public class QZAdbRemote implements DeviceConnectionListener {
private DeviceConnection startConnection(String host, int port) {
QLog.d(LOG_TAG, "startConnection - START: host=" + host + ", port=" + port + ", binder=" + binder);
/* Create the connection object */
DeviceConnection conn = binder.createConnection(host, port);
QLog.d(LOG_TAG, "startConnection - CONNECTION_CREATED: conn=" + conn);
/* Add this activity as a connection listener */
binder.addListener(conn, this);
QLog.d(LOG_TAG, "startConnection - LISTENER_ADDED: this=" + this);
/* Begin the async connection process */
QLog.d(LOG_TAG, "startConnection - STARTING_CONNECT: about to call conn.startConnect()");
conn.startConnect();
QLog.d(LOG_TAG, "startConnection - END: startConnect() called, returning conn=" + conn);
return conn;
}
private DeviceConnection connectOrLookupConnection(String host, int port) {
QLog.d(LOG_TAG, "connectOrLookupConnection - START: host=" + host + ", port=" + port + ", binder=" + binder);
DeviceConnection conn = binder.findConnection(host, port);
QLog.d(LOG_TAG, "connectOrLookupConnection - EXISTING_CONN: conn=" + (conn != null ? "found" : "null"));
if (conn == null) {
/* No existing connection, so start the connection process */
QLog.d(LOG_TAG, "connectOrLookupConnection - NEW_CONNECTION: starting new connection");
conn = startConnection(host, port);
}
else {
/* Add ourselves as a new listener of this connection */
QLog.d(LOG_TAG, "connectOrLookupConnection - REUSE_CONNECTION: adding listener to existing connection");
binder.addListener(conn, this);
}
QLog.d(LOG_TAG, "connectOrLookupConnection - END: returning conn=" + conn);
return conn;
}
public ServiceConnection serviceConn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder arg1) {
QLog.d(LOG_TAG, "onServiceConnected - START: componentName=" + arg0 + ", binder=" + arg1 + ", _address=" + _address);
binder = (ShellService.ShellServiceBinder)arg1;
QLog.d(LOG_TAG, "onServiceConnected - BINDER_SET: binder=" + binder + ", existing_connection=" + connection);
if (connection != null) {
QLog.d(LOG_TAG, "onServiceConnected - REMOVING_OLD_LISTENER: connection=" + connection);
binder.removeListener(connection, QZAdbRemote.getInstance());
}
QLog.d(LOG_TAG, "onServiceConnected - CONNECTING: about to call connectOrLookupConnection");
connection = connectOrLookupConnection(_address, 5555);
QLog.d(LOG_TAG, "onServiceConnected - END: connection=" + connection);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
QLog.d(LOG_TAG, "onServiceDisconnected - START: componentName=" + arg0 + ", old_binder=" + binder);
binder = null;
QLog.d(LOG_TAG, "onServiceDisconnected - END: binder set to null");
}
};
static public void createConnection(String ip, Context context) {
QLog.d(LOG_TAG, "createConnection - START: ip=" + ip + ", context=" + context + ", existing_binder=" + binder);
_address = ip;
_context = context;
QLog.d(LOG_TAG, "createConnection - PARAMS_SET: _address=" + _address + ", _context=" + _context);
/* If we have old RSA keys, just use them */
QLog.d(LOG_TAG, "createConnection - CHECKING_CRYPTO: reading existing crypto config");
AdbCrypto crypto = AdbUtils.readCryptoConfig(_context.getFilesDir());
QLog.d(LOG_TAG, "createConnection - CRYPTO_CHECK: crypto=" + (crypto != null ? "exists" : "null"));
if (crypto == null)
{
/* We need to make a new pair */
Log.i(LOG_TAG,
QLog.i(LOG_TAG,
"This will only be done once.");
new Thread(new Runnable() {
@Override
public void run() {
AdbCrypto crypto;
crypto = AdbUtils.writeNewCryptoConfig(_context.getFilesDir());
if (crypto == null)
{
Log.e(LOG_TAG,
"Unable to generate and save RSA key pair");
return;
}
}
}).start();
QLog.d(LOG_TAG, "createConnection - GENERATING_CRYPTO: synchronously generating crypto keys");
crypto = AdbUtils.writeNewCryptoConfig(_context.getFilesDir());
if (crypto == null) {
QLog.e(LOG_TAG, "Unable to generate and save RSA key pair");
cryptoReady = false;
return;
}
QLog.d(LOG_TAG, "createConnection - CRYPTO_GENERATED: crypto keys generated successfully");
synchronized (cryptoLock) {
cryptoReady = true;
}
} else {
QLog.d(LOG_TAG, "createConnection - CRYPTO_EXISTS: marking crypto as ready");
synchronized (cryptoLock) {
cryptoReady = true;
}
}
QLog.d(LOG_TAG, "createConnection - SERVICE_CHECK: binder=" + (binder != null ? "exists" : "null"));
if (binder == null) {
QLog.i(LOG_TAG, "createConnection - STARTING_SERVICE: Starting ShellService.class");
service = new Intent(_context, ShellService.class);
service.putExtra(EXTRA_FOREGROUND_SERVICE_TYPE, FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
QLog.d(LOG_TAG, "createConnection - SERVICE_INTENT: service=" + service);
/* Bind the service if we're not bound already. After binding, the callback will
* perform the initial connection. */
QLog.d(LOG_TAG, "createConnection - BINDING_SERVICE: about to bind service");
_context.bindService(service, QZAdbRemote.getInstance().serviceConn, Service.BIND_AUTO_CREATE);
QLog.d(LOG_TAG, "createConnection - SERVICE_BOUND: bindService called");
QLog.d(LOG_TAG, "createConnection - STARTING_SERVICE: SDK_INT=" + Build.VERSION.SDK_INT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
QLog.d(LOG_TAG, "createConnection - FOREGROUND_SERVICE: starting foreground service");
_context.startForegroundService(service);
}
else {
QLog.d(LOG_TAG, "createConnection - REGULAR_SERVICE: starting regular service");
_context.startService(service);
}
QLog.d(LOG_TAG, "createConnection - SERVICE_STARTED: service start completed");
} else {
QLog.d(LOG_TAG, "createConnection - SKIP_SERVICE: binder already exists, skipping service creation");
}
QLog.d(LOG_TAG, "createConnection - END: method completed");
}
static public void sendCommand(String command) {
Log.d(LOG_TAG, "sendCommand " + ADBConnected + " " + command);
QLog.d(LOG_TAG, "sendCommand " + ADBConnected + " " + command);
if(ADBConnected) {
StringBuilder commandBuffer = new StringBuilder();
@@ -212,7 +265,7 @@ public class QZAdbRemote implements DeviceConnectionListener {
/* Send it to the device */
connection.queueCommand(commandBuffer.toString());
} else {
Log.e(LOG_TAG, "sendCommand ADB is not connected!");
QLog.e(LOG_TAG, "sendCommand ADB is not connected!");
}
}

View File

@@ -17,7 +17,7 @@ package org.cagnulen.qdomyoszwift;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.dsi.ant.channel.AntChannel;
import com.dsi.ant.channel.AntCommandFailedException;
@@ -68,7 +68,7 @@ public class SDMChannelController {
boolean openChannel() {
if (null != mAntChannel) {
if (mIsOpen) {
Log.w(TAG, "Channel was already open");
QLog.w(TAG, "Channel was already open");
} else {
// Channel ID message contains device number, type and transmission type. In
// order for master (TX) channels and slave (RX) channels to connect, they
@@ -99,7 +99,7 @@ public class SDMChannelController {
mAntChannel.open();
mIsOpen = true;
Log.d(TAG, "Opened channel with device number: " + SPEED_SENSOR_ID);
QLog.d(TAG, "Opened channel with device number: " + SPEED_SENSOR_ID);
} catch (RemoteException e) {
channelError(e);
} catch (AntCommandFailedException e) {
@@ -108,7 +108,7 @@ public class SDMChannelController {
}
}
} else {
Log.w(TAG, "No channel available");
QLog.w(TAG, "No channel available");
}
return mIsOpen;
@@ -117,7 +117,7 @@ public class SDMChannelController {
void channelError(RemoteException e) {
String logString = "Remote service communication failed.";
Log.e(TAG, logString);
QLog.e(TAG, logString);
}
void channelError(String error, AntCommandFailedException e) {
@@ -146,11 +146,11 @@ public class SDMChannelController {
.append(failureReason);
}
Log.e(TAG, logString.toString());
QLog.e(TAG, logString.toString());
mAntChannel.release();
Log.e(TAG, "ANT Command Failed");
QLog.e(TAG, "ANT Command Failed");
}
public void close() {
@@ -164,7 +164,7 @@ public class SDMChannelController {
mAntChannel = null;
}
Log.e(TAG, "Channel Closed");
QLog.e(TAG, "Channel Closed");
}
/**
@@ -186,20 +186,20 @@ public class SDMChannelController {
@Override
public void onChannelDeath() {
// Display channel death message when channel dies
Log.e(TAG, "Channel Death");
QLog.e(TAG, "Channel Death");
}
@Override
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
Log.d(TAG, "Rx: " + antParcel);
Log.d(TAG, "Message Type: " + messageType);
QLog.d(TAG, "Rx: " + antParcel);
QLog.d(TAG, "Message Type: " + messageType);
if(carousalTimer == null) {
carousalTimer = new Timer(); // At this line a new Thread will be created
carousalTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Log.d(TAG, "Tx Unsollicited");
QLog.d(TAG, "Tx Unsollicited");
long realtimeMillis = SystemClock.elapsedRealtime();
double speedM_s = speed / 3.6;
long deltaTime = (realtimeMillis - lastTime);
@@ -243,7 +243,7 @@ public class SDMChannelController {
// Constructing channel event message from parcel
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
EventCode code = eventMessage.getEventCode();
Log.d(TAG, "Event Code: " + code);
QLog.d(TAG, "Event Code: " + code);
// Switching on event code to handle the different types of channel events
switch (code) {
@@ -278,7 +278,7 @@ public class SDMChannelController {
break;
case RX_SEARCH_TIMEOUT:
// TODO May want to keep searching
Log.e(TAG, "No Device Found");
QLog.e(TAG, "No Device Found");
break;
case CHANNEL_CLOSED:
case RX_FAIL:

View File

@@ -18,7 +18,7 @@ import android.media.projection.MediaProjectionManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.WindowManager;
@@ -43,7 +43,7 @@ import android.graphics.Rect;
import android.graphics.Point;
import androidx.core.util.Pair;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.os.Build;
public class ScreenCaptureService extends Service {
@@ -137,7 +137,7 @@ public class ScreenCaptureService extends Service {
int pixelStride = planes[0].getPixelStride();
int rowStride = planes[0].getRowStride();
int rowPadding = rowStride - pixelStride * mWidth;
//Log.e(TAG, "Image reviewing");
//QLog.e(TAG, "Image reviewing");
isRunning = true;
@@ -152,7 +152,7 @@ public class ScreenCaptureService extends Service {
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
IMAGES_PRODUCED++;
Log.e(TAG, "captured image: " + IMAGES_PRODUCED);
QLog.e(TAG, "captured image: " + IMAGES_PRODUCED);
*/
InputImage inputImage = InputImage.fromBitmap(bitmap, 0);
@@ -169,7 +169,7 @@ public class ScreenCaptureService extends Service {
public void onSuccess(Text result) {
// Task completed successfully
//Log.e(TAG, "Image done!");
//QLog.e(TAG, "Image done!");
String resultText = result.getText();
lastText = resultText;
@@ -204,12 +204,12 @@ public class ScreenCaptureService extends Service {
@Override
public void onFailure(Exception e) {
// Task failed with an exception
//Log.e(TAG, "Image fail");
//QLog.e(TAG, "Image fail");
isRunning = false;
}
});
} else {
//Log.e(TAG, "Image ignored");
//QLog.e(TAG, "Image ignored");
}
}
} catch (Exception e) {
@@ -246,7 +246,7 @@ public class ScreenCaptureService extends Service {
private class MediaProjectionStopCallback extends MediaProjection.Callback {
@Override
public void onStop() {
Log.e(TAG, "stopping projection.");
QLog.e(TAG, "stopping projection.");
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -276,12 +276,12 @@ public class ScreenCaptureService extends Service {
if (!storeDirectory.exists()) {
boolean success = storeDirectory.mkdirs();
if (!success) {
Log.e(TAG, "failed to create file storage directory.");
QLog.e(TAG, "failed to create file storage directory.");
stopSelf();
}
}
} else {
Log.e(TAG, "failed to create file storage directory, getExternalFilesDir is null.");
QLog.e(TAG, "failed to create file storage directory, getExternalFilesDir is null.");
stopSelf();
}
@@ -310,7 +310,7 @@ public class ScreenCaptureService extends Service {
startForeground(notification.first, notification.second);
}
} catch (Exception e) {
Log.e("ForegroundService", "Failed to start foreground service", e);
QLog.e("ForegroundService", "Failed to start foreground service", e);
return START_NOT_STICKY;
}
// start projection

View File

@@ -6,7 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.content.IntentFilter;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.app.Service;
import android.media.RingtoneManager;
import android.net.Uri;
@@ -35,7 +35,7 @@ public class Shortcuts {
List<ShortcutInfo> shortcuts = new ArrayList<>();
Log.d("Shortcuts", folder);
QLog.d("Shortcuts", folder);
File[] files = new File(folder, "profiles").listFiles();
if (files != null) {
for (int i = 0; i < files.length && i < 5; i++) { // Limit to 5 shortcuts
@@ -45,7 +45,7 @@ public class Shortcuts {
if (dotIndex > 0) { // Check if there is a dot, indicating an extension exists
fileNameWithoutExtension = fileNameWithoutExtension.substring(0, dotIndex);
}
Log.d("Shortcuts", file.getAbsolutePath());
QLog.d("Shortcuts", file.getAbsolutePath());
Intent intent = new Intent(context, context.getClass());
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra("profile_path", file.getAbsolutePath());
@@ -74,7 +74,7 @@ public class Shortcuts {
for (String key : extras.keySet()) {
Object value = extras.get(key);
if("profile_path".equals(key)) {
Log.d("Shortcuts", "profile_path: " + value.toString());
QLog.d("Shortcuts", "profile_path: " + value.toString());
return value.toString();
}
}
@@ -88,7 +88,7 @@ public class Shortcuts {
if (extras != null) {
for (String key : extras.keySet()) {
Object value = extras.get(key);
Log.d("Shortcuts", "Key: " + key + ", Value: " + value.toString());
QLog.d("Shortcuts", "Key: " + key + ", Value: " + value.toString());
}
}
}

View File

@@ -17,7 +17,7 @@ package org.cagnulen.qdomyoszwift;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.dsi.ant.channel.AntChannel;
import com.dsi.ant.channel.AntCommandFailedException;
@@ -67,7 +67,7 @@ public class SpeedChannelController {
boolean openChannel() {
if (null != mAntChannel) {
if (mIsOpen) {
Log.w(TAG, "Channel was already open");
QLog.w(TAG, "Channel was already open");
} else {
// Channel ID message contains device number, type and transmission type. In
// order for master (TX) channels and slave (RX) channels to connect, they
@@ -98,7 +98,7 @@ public class SpeedChannelController {
mAntChannel.open();
mIsOpen = true;
Log.d(TAG, "Opened channel with device number: " + SPEED_SENSOR_ID);
QLog.d(TAG, "Opened channel with device number: " + SPEED_SENSOR_ID);
} catch (RemoteException e) {
channelError(e);
} catch (AntCommandFailedException e) {
@@ -107,7 +107,7 @@ public class SpeedChannelController {
}
}
} else {
Log.w(TAG, "No channel available");
QLog.w(TAG, "No channel available");
}
return mIsOpen;
@@ -116,7 +116,7 @@ public class SpeedChannelController {
void channelError(RemoteException e) {
String logString = "Remote service communication failed.";
Log.e(TAG, logString);
QLog.e(TAG, logString);
}
void channelError(String error, AntCommandFailedException e) {
@@ -145,11 +145,11 @@ public class SpeedChannelController {
.append(failureReason);
}
Log.e(TAG, logString.toString());
QLog.e(TAG, logString.toString());
mAntChannel.release();
Log.e(TAG, "ANT Command Failed");
QLog.e(TAG, "ANT Command Failed");
}
public void close() {
@@ -163,7 +163,7 @@ public class SpeedChannelController {
mAntChannel = null;
}
Log.e(TAG, "Channel Closed");
QLog.e(TAG, "Channel Closed");
}
/**
@@ -185,20 +185,20 @@ public class SpeedChannelController {
@Override
public void onChannelDeath() {
// Display channel death message when channel dies
Log.e(TAG, "Channel Death");
QLog.e(TAG, "Channel Death");
}
@Override
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
Log.d(TAG, "Rx: " + antParcel);
Log.d(TAG, "Message Type: " + messageType);
QLog.d(TAG, "Rx: " + antParcel);
QLog.d(TAG, "Message Type: " + messageType);
if(carousalTimer == null) {
carousalTimer = new Timer(); // At this line a new Thread will be created
carousalTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Log.d(TAG, "Tx Unsollicited");
QLog.d(TAG, "Tx Unsollicited");
long realtimeMillis = SystemClock.elapsedRealtime();
if (lastTime != 0) {
@@ -252,7 +252,7 @@ public class SpeedChannelController {
// Constructing channel event message from parcel
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
EventCode code = eventMessage.getEventCode();
Log.d(TAG, "Event Code: " + code);
QLog.d(TAG, "Event Code: " + code);
// Switching on event code to handle the different types of channel events
switch (code) {
@@ -296,7 +296,7 @@ public class SpeedChannelController {
break;
case RX_SEARCH_TIMEOUT:
// TODO May want to keep searching
Log.e(TAG, "No Device Found");
QLog.e(TAG, "No Device Found");
break;
case CHANNEL_CLOSED:
case RX_FAIL:

View File

@@ -8,7 +8,7 @@ import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.app.Service;
import android.media.RingtoneManager;
import android.net.Uri;
@@ -43,12 +43,23 @@ public class Usbserial {
static int lastReadLen = 0;
public static void open(Context context) {
Log.d("QZ","UsbSerial open");
open(context, 2400); // Default baud rate for Computrainer
}
public static void open(Context context, int baudRate) {
QLog.d("QZ","UsbSerial open with baud rate: " + baudRate);
// DEBUG: List all USB devices detected by Android
UsbserialDebug.listAllUsbDevices(context);
// Find all available drivers from attached devices.
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
List<UsbSerialDriver> availableDrivers = UsbSerialProber.getDefaultProber().findAllDrivers(manager);
QLog.d("QZ","UsbSerial drivers found by UsbSerialProber: " + availableDrivers.size());
if (availableDrivers.isEmpty()) {
Log.d("QZ","UsbSerial no available drivers");
QLog.d("QZ","UsbSerial no available drivers");
return;
}
@@ -58,7 +69,7 @@ public class Usbserial {
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
RingtoneManager.getRingtone(context, notification).play();
Log.d("QZ","USB permission ...");
QLog.d("QZ","USB permission ...");
final Boolean[] granted = {null};
BroadcastReceiver usbReceiver = new BroadcastReceiver() {
@Override
@@ -69,12 +80,20 @@ public class Usbserial {
int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0;
PendingIntent permissionIntent = PendingIntent.getBroadcast(context, 0, new Intent("org.cagnulen.qdomyoszwift.USB_PERMISSION"), flags);
IntentFilter filter = new IntentFilter("org.cagnulen.qdomyoszwift.USB_PERMISSION");
ContextCompat.registerReceiver(
context,
usbReceiver,
filter,
ContextCompat.RECEIVER_EXPORTED
);
// Fix for Android 6 compatibility: RECEIVER_EXPORTED only available in Android 13+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ContextCompat.registerReceiver(
context,
usbReceiver,
filter,
ContextCompat.RECEIVER_EXPORTED
);
} else {
// Use old API for Android 6-12
context.registerReceiver(usbReceiver, filter);
}
manager.requestPermission(driver.getDevice(), permissionIntent);
for(int i=0; i<5000; i++) {
if(granted[0] != null) break;
@@ -85,12 +104,12 @@ public class Usbserial {
// Do something here
}
}
Log.d("QZ","USB permission "+granted[0]);
QLog.d("QZ","USB permission "+granted[0]);
}
UsbDeviceConnection connection = manager.openDevice(driver.getDevice());
if (connection == null) {
Log.d("QZ","UsbSerial no permissions");
QLog.d("QZ","UsbSerial no permissions");
// add UsbManager.requestPermission(driver.getDevice(), ..) handling here
return;
}
@@ -98,20 +117,19 @@ public class Usbserial {
port = driver.getPorts().get(0); // Most devices have just one port (port 0)
try {
port.open(connection);
port.setParameters(2400, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
port.setParameters(baudRate, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
QLog.d("QZ","UsbSerial port opened successfully at " + baudRate + " baud");
}
catch (IOException e) {
// Do something here
QLog.d("QZ","UsbSerial port open failed: " + e.getMessage());
}
Log.d("QZ","UsbSerial port opened");
}
public static void write (byte[] bytes) {
if(port == null)
return;
Log.d("QZ","UsbSerial writing " + new String(bytes, StandardCharsets.UTF_8));
QLog.d("QZ","UsbSerial writing " + new String(bytes, StandardCharsets.UTF_8));
try {
port.write(bytes, 2000);
}
@@ -132,7 +150,7 @@ public class Usbserial {
try {
lastReadLen = port.read(receiveData, 2000);
Log.d("QZ","UsbSerial reading " + lastReadLen + new String(receiveData, StandardCharsets.UTF_8));
QLog.d("QZ","UsbSerial reading " + lastReadLen + new String(receiveData, StandardCharsets.UTF_8));
}
catch (IOException e) {
// Do something here

View File

@@ -0,0 +1,31 @@
package org.cagnulen.qdomyoszwift;
import android.content.Context;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import java.util.HashMap;
public class UsbserialDebug {
public static void listAllUsbDevices(Context context) {
QLog.d("QZ", "=== USB DEVICE DEBUG START ===");
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
QLog.d("QZ", "Total USB devices found: " + deviceList.size());
for (UsbDevice device : deviceList.values()) {
QLog.d("QZ", "----------------------------");
QLog.d("QZ", "Device Name: " + device.getDeviceName());
QLog.d("QZ", "Vendor ID: " + device.getVendorId() + " (0x" + Integer.toHexString(device.getVendorId()) + ")");
QLog.d("QZ", "Product ID: " + device.getProductId() + " (0x" + Integer.toHexString(device.getProductId()) + ")");
QLog.d("QZ", "Device Class: " + device.getDeviceClass());
QLog.d("QZ", "Device Subclass: " + device.getDeviceSubclass());
QLog.d("QZ", "Device Protocol: " + device.getDeviceProtocol());
QLog.d("QZ", "Has Permission: " + manager.hasPermission(device));
QLog.d("QZ", "Interface Count: " + device.getInterfaceCount());
}
QLog.d("QZ", "=== USB DEVICE DEBUG END ===");
}
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
@@ -33,7 +33,7 @@ public class WearableController {
_intent = new Intent(context, WearableMessageListenerService.class);
// FloatingWindowGFG service is started
context.startService(_intent);
Log.v("WearableController", "started");
QLog.v("WearableController", "started");
}
public static int getHeart() {

View File

@@ -15,7 +15,7 @@ import com.google.android.gms.wearable.Wearable;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.wearable.DataItemBuffer;
import com.google.android.gms.wearable.DataMap;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.os.Bundle;
import com.google.android.gms.common.api.Status;
import java.io.InputStream;
@@ -31,7 +31,7 @@ public class WearableMessageListenerService extends Service implements
@Override
public void onCreate() {
super.onCreate();
Log.v("WearableMessageListenerService","onCreate");
QLog.v("WearableMessageListenerService","onCreate");
}
public static int getHeart() {
@@ -55,7 +55,7 @@ public class WearableMessageListenerService extends Service implements
mWearableClient.addListener(this);
Wearable.getDataClient(this).addListener(this);
Log.v("WearableMessageListenerService","onStartCommand");
QLog.v("WearableMessageListenerService","onStartCommand");
// Return START_STICKY to restart the service if it's killed by the system
return START_STICKY;
@@ -65,9 +65,9 @@ public class WearableMessageListenerService extends Service implements
public void onDataChanged(DataEventBuffer dataEvents) {
for (DataEvent event : dataEvents) {
if (event.getType() == DataEvent.TYPE_DELETED) {
Log.d(TAG, "DataItem deleted: " + event.getDataItem().getUri());
QLog.d(TAG, "DataItem deleted: " + event.getDataItem().getUri());
} else if (event.getType() == DataEvent.TYPE_CHANGED) {
Log.d(TAG, "DataItem changed: " + event.getDataItem().getUri() + " " + event.getDataItem().getUri().getPath());
QLog.d(TAG, "DataItem changed: " + event.getDataItem().getUri() + " " + event.getDataItem().getUri().getPath());
if(event.getDataItem().getUri().getPath().equals("/qz")) {
new Thread(new Runnable() {
@Override
@@ -78,14 +78,14 @@ public class WearableMessageListenerService extends Service implements
heart_rate = DataMap.fromByteArray(result.get(0).getData())
.getInt("heart_rate", 0);
} else {
Log.e(TAG, "Unexpected number of DataItems found.\n"
QLog.e(TAG, "Unexpected number of DataItems found.\n"
+ "\tExpected: 1\n"
+ "\tActual: " + result.getCount());
}
} else if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onHandleIntent: failed to get current alarm state");
} else {
QLog.d(TAG, "onHandleIntent: failed to get current alarm state");
}
Log.d(TAG, "Heart: " + heart_rate);
QLog.d(TAG, "Heart: " + heart_rate);
}
}).start();
}
@@ -96,17 +96,17 @@ public class WearableMessageListenerService extends Service implements
@Override
public void onConnected(Bundle bundle) {
Log.v("WearableMessageListenerService","onConnected");
QLog.v("WearableMessageListenerService","onConnected");
}
@Override
public void onConnectionSuspended(int i) {
Log.v("WearableMessageListenerService","onConnectionSuspended");
QLog.v("WearableMessageListenerService","onConnectionSuspended");
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.v("WearableMessageListenerService","onConnectionFailed");
QLog.v("WearableMessageListenerService","onConnectionFailed");
}
@Override
@@ -117,8 +117,8 @@ public class WearableMessageListenerService extends Service implements
// Handle the received message data here
String messageData = new String(data); // Assuming it's a simple string message
Log.v("Wearable", path);
Log.v("Wearable", messageData);
QLog.v("Wearable", path);
QLog.v("Wearable", messageData);
// You can then perform actions or update data in your service based on the received message
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import android.content.BroadcastReceiver;
import android.content.ContextWrapper;
import android.content.IntentFilter;
@@ -44,12 +44,12 @@ public class ZapClickLayer {
}
public static int processCharacteristic(byte[] value) {
Log.d(TAG, "processCharacteristic");
QLog.d(TAG, "processCharacteristic");
return device.processCharacteristic("QZ", value);
}
public static byte[] buildHandshakeStart() {
Log.d(TAG, "buildHandshakeStart");
QLog.d(TAG, "buildHandshakeStart");
return device.buildHandshakeStart();
}
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.garmin.android.connectiq.ConnectIQ;
import com.garmin.android.connectiq.ConnectIQAdbStrategy;
import com.garmin.android.connectiq.IQApp;
@@ -49,17 +49,17 @@ public class ZwiftAPI {
// Ora puoi usare 'message' come un oggetto normale
} catch (InvalidProtocolBufferException e) {
// Gestisci l'eccezione se il messaggio non può essere parsato
Log.e(TAG, e.toString());
QLog.e(TAG, e.toString());
}
}
public static float getAltitude() {
Log.d(TAG, "getAltitude " + playerState.getAltitude());
QLog.d(TAG, "getAltitude " + playerState.getAltitude());
return playerState.getAltitude();
}
public static float getDistance() {
Log.d(TAG, "getDistance " + playerState.getDistance());
QLog.d(TAG, "getDistance " + playerState.getDistance());
return playerState.getDistance();
}
}

View File

@@ -17,7 +17,7 @@ import android.widget.EditText;
import android.widget.Toast;
import android.os.Looper;
import android.os.Handler;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.garmin.android.connectiq.ConnectIQ;
import com.garmin.android.connectiq.ConnectIQAdbStrategy;
import com.garmin.android.connectiq.IQApp;

View File

@@ -9,6 +9,7 @@ import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.Socket;
import java.util.HashMap;
import org.cagnulen.qdomyoszwift.QLog;
/**
* This class represents an ADB connection.
@@ -124,10 +125,13 @@ public class AdbConnection implements Closeable {
try {
/* Read and parse a message off the socket's input stream */
AdbProtocol.AdbMessage msg = AdbProtocol.AdbMessage.parseAdbMessage(inputStream);
QLog.d("AdbConnection", "connectionThread - Received packet: command=0x" + Integer.toHexString(msg.command) + ", arg0=" + msg.arg0 + ", arg1=" + msg.arg1);
/* Verify magic and checksum */
if (!AdbProtocol.validateMessage(msg))
if (!AdbProtocol.validateMessage(msg)) {
QLog.w("AdbConnection", "connectionThread - Invalid message, dropping packet");
continue;
}
switch (msg.command)
{
@@ -175,21 +179,25 @@ public class AdbConnection implements Closeable {
break;
case AdbProtocol.CMD_AUTH:
QLog.d("AdbConnection", "connectionThread - Received AUTH packet, type=" + msg.arg0);
byte[] packet;
if (msg.arg0 == AdbProtocol.AUTH_TYPE_TOKEN)
{
/* This is an authentication challenge */
QLog.d("AdbConnection", "connectionThread - AUTH_TYPE_TOKEN challenge, sentSignature=" + conn.sentSignature);
if (conn.sentSignature)
{
/* We've already tried our signature, so send our public key */
QLog.d("AdbConnection", "connectionThread - Sending RSA public key");
packet = AdbProtocol.generateAuth(AdbProtocol.AUTH_TYPE_RSA_PUBLIC,
conn.crypto.getAdbPublicKeyPayload());
}
else
{
/* We'll sign the token */
QLog.d("AdbConnection", "connectionThread - Signing token with private key");
packet = AdbProtocol.generateAuth(AdbProtocol.AUTH_TYPE_SIGNATURE,
conn.crypto.signAdbTokenPayload(msg.payload));
conn.sentSignature = true;
@@ -198,16 +206,22 @@ public class AdbConnection implements Closeable {
/* Write the AUTH reply */
conn.outputStream.write(packet);
conn.outputStream.flush();
QLog.d("AdbConnection", "connectionThread - AUTH response sent");
}
else {
QLog.w("AdbConnection", "connectionThread - Unhandled AUTH type: " + msg.arg0);
}
break;
case AdbProtocol.CMD_CNXN:
QLog.d("AdbConnection", "connectionThread - Received CNXN packet! maxData=" + msg.arg1);
synchronized (conn) {
/* We need to store the max data size */
conn.maxData = msg.arg1;
/* Mark us as connected and unwait anyone waiting on the connection */
conn.connected = true;
QLog.d("AdbConnection", "connectionThread - Connection established! Notifying waiting threads");
conn.notifyAll();
}
break;
@@ -219,6 +233,7 @@ public class AdbConnection implements Closeable {
} catch (Exception e) {
/* The cleanup is taken care of by a combination of this thread
* and close() */
QLog.e("AdbConnection", "connectionThread - Exception in connection thread: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
break;
}
}
@@ -270,23 +285,32 @@ public class AdbConnection implements Closeable {
if (connected)
throw new IllegalStateException("Already connected");
QLog.d("AdbConnection", "connect() - Starting ADB connection");
/* Write the CONNECT packet */
outputStream.write(AdbProtocol.generateConnect());
outputStream.flush();
QLog.d("AdbConnection", "connect() - CONNECT packet sent, starting connection thread");
/* Start the connection thread to respond to the peer */
connectAttempted = true;
connectionThread.start();
QLog.d("AdbConnection", "connect() - Connection thread started, waiting for connection...");
/* Wait for the connection to go live */
synchronized (this) {
if (!connected)
if (!connected) {
QLog.d("AdbConnection", "connect() - Waiting for connection to complete...");
wait();
QLog.d("AdbConnection", "connect() - Wait completed, connected=" + connected);
}
if (!connected) {
QLog.e("AdbConnection", "connect() - Connection failed after wait");
throw new IOException("Connection failed");
}
}
QLog.d("AdbConnection", "connect() - Successfully connected!");
}
/**

View File

@@ -11,6 +11,7 @@ import com.cgutman.adblib.AdbConnection;
import com.cgutman.adblib.AdbCrypto;
import com.cgutman.adblib.AdbStream;
import com.cgutman.androidremotedebugger.AdbUtils;
import org.cagnulen.qdomyoszwift.QLog;
public class DeviceConnection implements Closeable {
private static final int CONN_TIMEOUT = 5000;
@@ -59,42 +60,58 @@ public class DeviceConnection implements Closeable {
}
public void startConnect() {
QLog.d("DeviceConnection", "startConnect - START: host=" + host + ", port=" + port + ", listener=" + listener);
new Thread(new Runnable() {
@Override
public void run() {
QLog.d("DeviceConnection", "startConnect.run - THREAD_START: host=" + host + ", port=" + port);
boolean connected = false;
Socket socket = new Socket();
AdbCrypto crypto;
/* Load the crypto config */
QLog.d("DeviceConnection", "startConnect.run - LOADING_CRYPTO: calling loadAdbCrypto");
crypto = listener.loadAdbCrypto(DeviceConnection.this);
if (crypto == null) {
QLog.e("DeviceConnection", "startConnect.run - CRYPTO_FAILED: crypto is null, returning");
return;
}
QLog.d("DeviceConnection", "startConnect.run - CRYPTO_LOADED: crypto=" + crypto);
try {
/* Establish a connect to the remote host */
QLog.d("DeviceConnection", "startConnect.run - SOCKET_CONNECT: connecting to " + host + ":" + port + " with timeout=" + CONN_TIMEOUT);
socket.connect(new InetSocketAddress(host, port), CONN_TIMEOUT);
QLog.d("DeviceConnection", "startConnect.run - SOCKET_CONNECTED: socket connected successfully");
} catch (IOException e) {
QLog.e("DeviceConnection", "startConnect.run - SOCKET_FAILED: connection failed", e);
listener.notifyConnectionFailed(DeviceConnection.this, e);
return;
}
try {
/* Establish the application layer connection */
QLog.d("DeviceConnection", "startConnect.run - ADB_CONNECTION: creating AdbConnection");
connection = AdbConnection.create(socket, crypto);
QLog.d("DeviceConnection", "startConnect.run - ADB_CONNECT: calling connection.connect()");
connection.connect();
QLog.d("DeviceConnection", "startConnect.run - ADB_CONNECTED: ADB connection established");
/* Open the shell stream */
QLog.d("DeviceConnection", "startConnect.run - SHELL_STREAM: opening shell stream");
shellStream = connection.open("shell:");
QLog.d("DeviceConnection", "startConnect.run - SHELL_OPENED: shell stream opened successfully");
connected = true;
} catch (IOException e) {
QLog.e("DeviceConnection", "startConnect.run - ADB_IO_ERROR: IOException during ADB connection", e);
listener.notifyConnectionFailed(DeviceConnection.this, e);
} catch (InterruptedException e) {
QLog.e("DeviceConnection", "startConnect.run - ADB_INTERRUPTED: InterruptedException during ADB connection", e);
listener.notifyConnectionFailed(DeviceConnection.this, e);
} finally {
/* Cleanup if the connection failed */
if (!connected) {
QLog.d("DeviceConnection", "startConnect.run - CLEANUP: connection failed, cleaning up");
AdbUtils.safeClose(shellStream);
/* The AdbConnection object will close the underlying socket
@@ -112,12 +129,16 @@ public class DeviceConnection implements Closeable {
}
/* Notify the listener that the connection is complete */
QLog.d("DeviceConnection", "startConnect.run - NOTIFY_SUCCESS: calling listener.notifyConnectionEstablished");
listener.notifyConnectionEstablished(DeviceConnection.this);
QLog.d("DeviceConnection", "startConnect.run - NOTIFIED: notifyConnectionEstablished called");
/* Start the receive thread */
QLog.d("DeviceConnection", "startConnect.run - START_RECEIVE: starting receive thread");
startReceiveThread();
/* Enter the blocking send loop */
QLog.d("DeviceConnection", "startConnect.run - SEND_LOOP: entering send loop");
sendLoop();
}
}).start();
@@ -148,23 +169,32 @@ public class DeviceConnection implements Closeable {
}
private void startReceiveThread() {
QLog.d("DeviceConnection", "startReceiveThread - START: creating receive thread");
new Thread(new Runnable() {
@Override
public void run() {
QLog.d("DeviceConnection", "startReceiveThread.run - THREAD_START: receive thread started");
try {
while (!shellStream.isClosed()) {
QLog.d("DeviceConnection", "startReceiveThread.run - READING: waiting for data from shellStream");
byte[] data = shellStream.read();
QLog.d("DeviceConnection", "startReceiveThread.run - DATA_RECEIVED: " + data.length + " bytes received");
listener.receivedData(DeviceConnection.this, data, 0, data.length);
}
QLog.d("DeviceConnection", "startReceiveThread.run - STREAM_CLOSED: shellStream is closed");
listener.notifyStreamClosed(DeviceConnection.this);
} catch (IOException e) {
QLog.e("DeviceConnection", "startReceiveThread.run - IO_ERROR: IOException in receive thread", e);
listener.notifyStreamFailed(DeviceConnection.this, e);
} catch (InterruptedException e) {
QLog.d("DeviceConnection", "startReceiveThread.run - INTERRUPTED: receive thread interrupted");
} finally {
QLog.d("DeviceConnection", "startReceiveThread.run - CLEANUP: cleaning up receive thread");
AdbUtils.safeClose(DeviceConnection.this);
}
}
}).start();
QLog.d("DeviceConnection", "startReceiveThread - END: receive thread started");
}
public boolean isClosed() {

View File

@@ -23,7 +23,7 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import androidx.core.app.NotificationCompat;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
public class ShellService extends Service implements DeviceConnectionListener {
@@ -48,14 +48,20 @@ public class ShellService extends Service implements DeviceConnectionListener {
public class ShellServiceBinder extends Binder {
public DeviceConnection createConnection(String host, int port) {
QLog.d("ShellService", "createConnection - START: host=" + host + ", port=" + port + ", listener=" + listener);
DeviceConnection conn = new DeviceConnection(listener, host, port);
QLog.d("ShellService", "createConnection - CONNECTION_CREATED: conn=" + conn);
listener.addListener(conn, ShellService.this);
QLog.d("ShellService", "createConnection - LISTENER_ADDED: returning conn=" + conn);
return conn;
}
public DeviceConnection findConnection(String host, int port) {
String connStr = host+":"+port;
return currentConnectionMap.get(connStr);
QLog.d("ShellService", "findConnection - SEARCH: connStr=" + connStr + ", mapSize=" + currentConnectionMap.size());
DeviceConnection found = currentConnectionMap.get(connStr);
QLog.d("ShellService", "findConnection - RESULT: found=" + (found != null ? "exists" : "null"));
return found;
}
public void notifyPausingActivity(DeviceConnection devConn) {
@@ -76,68 +82,95 @@ public class ShellService extends Service implements DeviceConnectionListener {
}
public void addListener(DeviceConnection conn, DeviceConnectionListener listener) {
QLog.d("ShellService", "addListener - START: conn=" + conn + ", listener=" + listener);
ShellService.this.listener.addListener(conn, listener);
QLog.d("ShellService", "addListener - END: listener added");
}
public void removeListener(DeviceConnection conn, DeviceConnectionListener listener) {
QLog.d("ShellService", "removeListener - START: conn=" + conn + ", listener=" + listener);
ShellService.this.listener.removeListener(conn, listener);
QLog.d("ShellService", "removeListener - END: listener removed");
}
}
@Override
public IBinder onBind(Intent arg0) {
QLog.d("ShellService", "onBind - START: intent=" + arg0 + ", binder=" + binder);
QLog.d("ShellService", "onBind - END: returning binder");
return binder;
}
@Override
public boolean onUnbind(Intent intent) {
QLog.d("ShellService", "onUnbind - START: intent=" + intent + ", connections=" + currentConnectionMap.size());
/* Stop the service if no connections remain */
if (currentConnectionMap.isEmpty()) {
QLog.d("ShellService", "onUnbind - STOPPING_SERVICE: no connections remain");
stopSelf();
} else {
QLog.d("ShellService", "onUnbind - KEEPING_SERVICE: " + currentConnectionMap.size() + " connections remain");
}
QLog.d("ShellService", "onUnbind - END: returning false");
return false;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
QLog.d("ShellService", "onStartCommand - START: intent=" + intent + ", flags=" + flags + ", startId=" + startId + ", foregroundId=" + foregroundId);
if (foregroundId == 0) {
try {
int serviceType = intent.getIntExtra(EXTRA_FOREGROUND_SERVICE_TYPE, FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
// If we're not already running in the foreground, use a placeholder
// notification until a real connection is established. After connection
// establishment, the real notification will replace this one.
QLog.d("ShellService", "onStartCommand - FOREGROUND_START: serviceType=" + serviceType + ", SDK_INT=" + Build.VERSION.SDK_INT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
QLog.d("ShellService", "onStartCommand - FOREGROUND_Q+: starting with service type");
startForeground(FOREGROUND_PLACEHOLDER_ID, createForegroundPlaceholderNotification(), serviceType);
} else {
QLog.d("ShellService", "onStartCommand - FOREGROUND_LEGACY: starting without service type");
startForeground(FOREGROUND_PLACEHOLDER_ID, createForegroundPlaceholderNotification());
}
QLog.d("ShellService", "onStartCommand - FOREGROUND_SUCCESS: foreground service started");
} catch (Exception e) {
Log.e("ForegroundService", "Failed to start foreground service", e);
QLog.e("ForegroundService", "Failed to start foreground service", e);
return START_NOT_STICKY;
}
} else {
QLog.d("ShellService", "onStartCommand - SKIP_FOREGROUND: already running in foreground with id=" + foregroundId);
}
// Don't restart if we've been killed. We will have already lost our connections
// when we died, so we'll just be running doing nothing if the OS restarted us.
QLog.d("ShellService", "onStartCommand - END: returning START_NOT_STICKY");
return Service.START_NOT_STICKY;
}
@Override
public void onCreate() {
QLog.d("ShellService", "onCreate - START: initializing service");
super.onCreate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
QLog.d("ShellService", "onCreate - NOTIFICATION_CHANNEL: creating notification channel");
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "Connection Info", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
QLog.d("ShellService", "onCreate - NOTIFICATION_CHANNEL: channel created");
}
QLog.d("ShellService", "onCreate - WIFI_LOCK: creating wifi lock");
WifiManager wm = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
wlanLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL, "RemoteADBShell:ShellService");
QLog.d("ShellService", "onCreate - WIFI_LOCK: wlanLock=" + wlanLock);
QLog.d("ShellService", "onCreate - WAKE_LOCK: creating wake lock");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "RemoteADBShell:ShellService");
QLog.d("ShellService", "onCreate - WAKE_LOCK: wakeLock=" + wakeLock);
QLog.d("ShellService", "onCreate - END: service initialization complete");
}
@Override
@@ -248,44 +281,76 @@ public class ShellService extends Service implements DeviceConnectionListener {
}
private synchronized void addNewConnection(DeviceConnection devConn) {
QLog.d("ShellService", "addNewConnection - START: devConn=" + devConn + ", currentSize=" + currentConnectionMap.size());
if (currentConnectionMap.isEmpty()) {
QLog.d("ShellService", "addNewConnection - ACQUIRING_LOCKS: first connection, acquiring locks");
wakeLock.acquire();
wlanLock.acquire();
QLog.d("ShellService", "addNewConnection - LOCKS_ACQUIRED: wakeLock and wlanLock acquired");
}
currentConnectionMap.put(getConnectionString(devConn), devConn);
String connString = getConnectionString(devConn);
QLog.d("ShellService", "addNewConnection - ADDING: connString=" + connString);
currentConnectionMap.put(connString, devConn);
QLog.d("ShellService", "addNewConnection - END: connection added, newSize=" + currentConnectionMap.size());
}
private synchronized void removeConnection(DeviceConnection devConn) {
currentConnectionMap.remove(getConnectionString(devConn));
String connString = getConnectionString(devConn);
QLog.d("ShellService", "removeConnection - START: devConn=" + devConn + ", connString=" + connString + ", currentSize=" + currentConnectionMap.size());
currentConnectionMap.remove(connString);
QLog.d("ShellService", "removeConnection - REMOVED: newSize=" + currentConnectionMap.size());
/* Stop the service if no connections remain */
if (currentConnectionMap.isEmpty()) {
QLog.d("ShellService", "removeConnection - STOPPING_SERVICE: no connections remain");
stopSelf();
} else {
QLog.d("ShellService", "removeConnection - KEEPING_SERVICE: " + currentConnectionMap.size() + " connections remain");
}
QLog.d("ShellService", "removeConnection - END");
}
@Override
public void notifyConnectionEstablished(DeviceConnection devConn) {
QLog.d("ShellService", "notifyConnectionEstablished - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
addNewConnection(devConn);
QLog.d("ShellService", "notifyConnectionEstablished - CONNECTION_ADDED: updating notification");
updateNotification(devConn, true);
QLog.d("ShellService", "notifyConnectionEstablished - END: connection established successfully");
}
@Override
public void notifyConnectionFailed(DeviceConnection devConn, Exception e) {
QLog.d("ShellService", "notifyConnectionFailed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
QLog.e("ShellService", "notifyConnectionFailed - ERROR: " + (e != null ? e.getMessage() : "null exception"));
if (e != null) {
QLog.e("ShellService", "notifyConnectionFailed - STACK_TRACE: ", e);
}
/* No notification is displaying here */
QLog.d("ShellService", "notifyConnectionFailed - END");
}
@Override
public void notifyStreamFailed(DeviceConnection devConn, Exception e) {
QLog.d("ShellService", "notifyStreamFailed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
QLog.e("ShellService", "notifyStreamFailed - ERROR: " + (e != null ? e.getMessage() : "null exception"));
if (e != null) {
QLog.e("ShellService", "notifyStreamFailed - STACK_TRACE: ", e);
}
updateNotification(devConn, false);
QLog.d("ShellService", "notifyStreamFailed - NOTIFICATION_UPDATED: removing connection");
removeConnection(devConn);
QLog.d("ShellService", "notifyStreamFailed - END");
}
@Override
public void notifyStreamClosed(DeviceConnection devConn) {
QLog.d("ShellService", "notifyStreamClosed - START: devConn=" + devConn + ", host=" + (devConn != null ? devConn.getHost() : "null") + ", port=" + (devConn != null ? devConn.getPort() : "null"));
updateNotification(devConn, false);
QLog.d("ShellService", "notifyStreamClosed - NOTIFICATION_UPDATED: removing connection");
removeConnection(devConn);
QLog.d("ShellService", "notifyStreamClosed - END");
}
@Override

View File

@@ -55,7 +55,7 @@ import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import com.android.billingclient.api.AcknowledgePurchaseParams;
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
@@ -65,13 +65,16 @@ import com.android.billingclient.api.BillingFlowParams;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.ConsumeParams;
import com.android.billingclient.api.ConsumeResponseListener;
import com.android.billingclient.api.PendingPurchasesParams;
import com.android.billingclient.api.ProductDetails;
import com.android.billingclient.api.ProductDetailsResponseListener;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.Purchase.PurchaseState;
import com.android.billingclient.api.PurchasesResponseListener;
import com.android.billingclient.api.PurchasesUpdatedListener;
import com.android.billingclient.api.SkuDetails;
import com.android.billingclient.api.SkuDetailsParams;
import com.android.billingclient.api.SkuDetailsResponseListener;
import com.android.billingclient.api.QueryProductDetailsParams;
import com.android.billingclient.api.QueryPurchasesParams;
import com.android.billingclient.api.QueryProductDetailsResult;
/***********************************************************************
@@ -79,7 +82,7 @@ import com.android.billingclient.api.SkuDetailsResponseListener;
** Add Dependencies below to build.gradle file:
dependencies {
def billing_version = "4.0.0"
def billing_version = "8.0.0"
implementation "com.android.billingclient:billing:$billing_version"
}
@@ -97,8 +100,8 @@ public class InAppPurchase implements PurchasesUpdatedListener
public static final int RESULT_OK = BillingClient.BillingResponseCode.OK;
public static final int RESULT_USER_CANCELED = BillingClient.BillingResponseCode.USER_CANCELED;
public static final String TYPE_INAPP = BillingClient.SkuType.INAPP;
public static final String TYPE_SUBS = BillingClient.SkuType.SUBS;
public static final String TYPE_INAPP = BillingClient.ProductType.INAPP;
public static final String TYPE_SUBS = BillingClient.ProductType.SUBS;
public static final String TAG = "InAppPurchase";
// Should be in sync with InAppTransaction::FailureReason
@@ -119,25 +122,28 @@ public class InAppPurchase implements PurchasesUpdatedListener
}
public void initializeConnection(){
Log.w(TAG, "initializeConnection start");
QLog.w(TAG, "initializeConnection start");
PendingPurchasesParams pendingPurchasesParams = PendingPurchasesParams.newBuilder()
.enableOneTimeProducts()
.build();
billingClient = BillingClient.newBuilder(m_context)
.enablePendingPurchases()
.enablePendingPurchases(pendingPurchasesParams)
.setListener(this)
.build();
billingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(BillingResult billingResult) {
Log.w(TAG, "onBillingSetupFinished");
QLog.w(TAG, "onBillingSetupFinished");
if (billingResult.getResponseCode() == RESULT_OK) {
purchasedProductsQueried(m_nativePointer);
} else {
Log.w(TAG, "onBillingSetupFinished error!" + billingResult.getResponseCode());
QLog.w(TAG, "onBillingSetupFinished error!" + billingResult.getResponseCode());
}
}
@Override
public void onBillingServiceDisconnected() {
Log.w(TAG, "Billing service disconnected");
QLog.w(TAG, "Billing service disconnected");
}
});
}
@@ -146,18 +152,23 @@ public class InAppPurchase implements PurchasesUpdatedListener
public void onPurchasesUpdated(BillingResult billingResult, List<Purchase> purchases) {
int responseCode = billingResult.getResponseCode();
QLog.d(TAG, "onPurchasesUpdated called. Response code: " + responseCode + ", Debug message: " + billingResult.getDebugMessage());
if (purchases == null) {
QLog.e(TAG, "Purchase failed: Data missing from result (purchases is null)");
purchaseFailed(purchaseRequestCode, FAILUREREASON_ERROR, "Data missing from result");
return;
}
if (billingResult.getResponseCode() == RESULT_OK) {
QLog.d(TAG, "Purchase successful, handling " + purchases.size() + " purchases");
handlePurchase(purchases);
} else if (responseCode == RESULT_USER_CANCELED) {
QLog.d(TAG, "Purchase cancelled by user");
purchaseFailed(purchaseRequestCode, FAILUREREASON_USERCANCELED, "");
} else {
String errorString = getErrorString(responseCode);
QLog.e(TAG, "Purchase failed with error: " + errorString + " (code: " + responseCode + ")");
purchaseFailed(purchaseRequestCode, FAILUREREASON_ERROR, errorString);
}
}
@@ -191,7 +202,7 @@ public class InAppPurchase implements PurchasesUpdatedListener
@Override
public void onAcknowledgePurchaseResponse(BillingResult billingResult)
{
Log.d(TAG, "Purchase acknowledged ");
QLog.d(TAG, "Purchase acknowledged ");
}
}
);
@@ -199,9 +210,9 @@ public class InAppPurchase implements PurchasesUpdatedListener
}
public void queryDetails(final String[] productIds) {
Log.d(TAG, "queryDetails: start");
QLog.d(TAG, "queryDetails: start");
int index = 0;
Log.d(TAG, "queryDetails: productIds.length " + productIds.length);
QLog.d(TAG, "queryDetails: productIds.length " + productIds.length);
while (index < productIds.length) {
List<String> productIdList = new ArrayList<>();
for (int i = index; i < Math.min(index + 20, productIds.length); ++i) {
@@ -209,31 +220,44 @@ public class InAppPurchase implements PurchasesUpdatedListener
}
index += productIdList.size();
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(productIdList).setType(TYPE_SUBS);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> skuDetailsList) {
List<QueryProductDetailsParams.Product> productList = new ArrayList<>();
for (String productId : productIdList) {
productList.add(
QueryProductDetailsParams.Product.newBuilder()
.setProductId(productId)
.setProductType(TYPE_SUBS)
.build());
}
QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
.setProductList(productList)
.build();
billingClient.queryProductDetailsAsync(params,
(billingResult, productDetailsResult) -> {
List<ProductDetails> productDetailsList = productDetailsResult.getProductDetailsList();
int responseCode = billingResult.getResponseCode();
Log.d(TAG, "onSkuDetailsResponse: responseCode " + responseCode);
QLog.d(TAG, "onProductDetailsResponse: responseCode " + responseCode);
if (responseCode != RESULT_OK) {
Log.e(TAG, "queryDetails: Couldn't retrieve sku details.");
QLog.e(TAG, "queryDetails: Couldn't retrieve product details.");
return;
}
if (skuDetailsList == null) {
Log.e(TAG, "queryDetails: No details list in response.");
if (productDetailsList == null || productDetailsList.isEmpty()) {
QLog.e(TAG, "queryDetails: No details list in response.");
return;
}
Log.d(TAG, "onSkuDetailsResponse: skuDetailsList " + skuDetailsList);
for (SkuDetails skuDetails : skuDetailsList) {
QLog.d(TAG, "onProductDetailsResponse: productDetailsList " + productDetailsList);
for (ProductDetails productDetails : productDetailsList) {
try {
String queriedProductId = skuDetails.getSku();
String queriedPrice = skuDetails.getPrice();
String queriedTitle = skuDetails.getTitle();
String queriedDescription = skuDetails.getDescription();
String queriedProductId = productDetails.getProductId();
String queriedPrice = "";
String queriedTitle = productDetails.getTitle();
String queriedDescription = productDetails.getDescription();
// Get price from subscription offer details
if (productDetails.getSubscriptionOfferDetails() != null && !productDetails.getSubscriptionOfferDetails().isEmpty()) {
queriedPrice = productDetails.getSubscriptionOfferDetails().get(0).getPricingPhases().getPricingPhaseList().get(0).getFormattedPrice();
}
registerProduct(m_nativePointer,
queriedProductId,
queriedPrice,
@@ -243,7 +267,6 @@ public class InAppPurchase implements PurchasesUpdatedListener
e.printStackTrace();
}
}
}
});
@@ -255,33 +278,51 @@ public class InAppPurchase implements PurchasesUpdatedListener
public void launchBillingFlow(String identifier, final int requestCode){
purchaseRequestCode = requestCode;
List<String> skuList = new ArrayList<>();
skuList.add(identifier);
SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(TYPE_SUBS);
billingClient.querySkuDetailsAsync(params.build(),
new SkuDetailsResponseListener() {
@Override
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> skuDetailsList) {
List<QueryProductDetailsParams.Product> productList = new ArrayList<>();
productList.add(
QueryProductDetailsParams.Product.newBuilder()
.setProductId(identifier)
.setProductType(TYPE_SUBS)
.build());
QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
.setProductList(productList)
.build();
billingClient.queryProductDetailsAsync(params,
(billingResult, productDetailsResult) -> {
List<ProductDetails> productDetailsList = productDetailsResult.getProductDetailsList();
if (billingResult.getResponseCode() != RESULT_OK) {
Log.e(TAG, "Unable to launch Google Play purchase screen");
QLog.e(TAG, "Unable to launch Google Play purchase screen. Response code: " + billingResult.getResponseCode() + ", Debug message: " + billingResult.getDebugMessage());
String errorString = getErrorString(requestCode);
purchaseFailed(requestCode, FAILUREREASON_ERROR, errorString);
return;
}
else if (skuDetailsList == null){
else if (productDetailsList == null || productDetailsList.isEmpty()){
purchaseFailed(purchaseRequestCode, FAILUREREASON_ERROR, "Data missing from result");
return;
}
ProductDetails productDetails = productDetailsList.get(0);
BillingFlowParams.ProductDetailsParams.Builder productDetailsParamsBuilder = BillingFlowParams.ProductDetailsParams.newBuilder()
.setProductDetails(productDetails);
// For subscriptions, we need to set the offer token
if (productDetails.getSubscriptionOfferDetails() != null && !productDetails.getSubscriptionOfferDetails().isEmpty()) {
String offerToken = productDetails.getSubscriptionOfferDetails().get(0).getOfferToken();
QLog.d(TAG, "Setting offer token for subscription: " + offerToken);
productDetailsParamsBuilder.setOfferToken(offerToken);
} else {
QLog.w(TAG, "No subscription offer details found for product: " + identifier);
}
BillingFlowParams.ProductDetailsParams productDetailsParams = productDetailsParamsBuilder.build();
BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
.setSkuDetails(skuDetailsList.get(0))
.setProductDetailsParamsList(java.util.Arrays.asList(productDetailsParams))
.build();
//Results will be delivered to onPurchasesUpdated
billingClient.launchBillingFlow((Activity) m_context, purchaseParams);
}
});
}
@@ -291,7 +332,7 @@ public class InAppPurchase implements PurchasesUpdatedListener
@Override
public void onConsumeResponse(BillingResult billingResult, String purchaseToken) {
if (billingResult.getResponseCode() != RESULT_OK) {
Log.e(TAG, "Unable to consume purchase. Response code: " + billingResult.getResponseCode());
QLog.e(TAG, "Unable to consume purchase. Response code: " + billingResult.getResponseCode());
}
}
};
@@ -312,7 +353,7 @@ public class InAppPurchase implements PurchasesUpdatedListener
@Override
public void onAcknowledgePurchaseResponse(BillingResult billingResult) {
if (billingResult.getResponseCode() != RESULT_OK){
Log.e(TAG, "Unable to acknowledge purchase. Response code: " + billingResult.getResponseCode());
QLog.e(TAG, "Unable to acknowledge purchase. Response code: " + billingResult.getResponseCode());
}
}
};
@@ -321,18 +362,21 @@ public class InAppPurchase implements PurchasesUpdatedListener
public void queryPurchasedProducts(final List<String> productIdList) {
billingClient.queryPurchasesAsync(TYPE_INAPP, new PurchasesResponseListener() {
QueryPurchasesParams queryPurchasesParams = QueryPurchasesParams.newBuilder()
.setProductType(TYPE_SUBS)
.build();
billingClient.queryPurchasesAsync(queryPurchasesParams, new PurchasesResponseListener() {
@Override
public void onQueryPurchasesResponse(BillingResult billingResult, List<Purchase> list) {
for (Purchase purchase : list) {
if (productIdList.contains(purchase.getSkus().get(0))) {
if (productIdList.contains(purchase.getProducts().get(0))) {
registerPurchased(m_nativePointer,
purchase.getSkus().get(0),
purchase.getProducts().get(0),
purchase.getSignature(),
purchase.getOriginalJson(),
purchase.getPurchaseToken(),
purchase.getDeveloperPayload(),
"", // getDeveloperPayload() is deprecated
purchase.getPurchaseTime());
}
}

View File

@@ -17,7 +17,7 @@
package org.qtproject.qt.android.purchasing;
import android.text.TextUtils;
import android.util.Log;
import org.cagnulen.qdomyoszwift.QLog;
import org.json.JSONException;
import org.json.JSONObject;
@@ -58,7 +58,7 @@ public class Security {
*/
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (signedData == null) {
Log.e(TAG, "data is null");
QLog.e(TAG, "data is null");
return false;
}
@@ -67,7 +67,7 @@ public class Security {
PublicKey key = Security.generatePublicKey(base64PublicKey);
verified = Security.verify(key, signedData, signature);
if (!verified) {
Log.w(TAG, "signature does not match data.");
QLog.w(TAG, "signature does not match data.");
return false;
}
}
@@ -89,10 +89,10 @@ public class Security {
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
QLog.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
QLog.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
}
@@ -113,18 +113,18 @@ public class Security {
sig.initVerify(publicKey);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
QLog.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
QLog.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
QLog.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
QLog.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
QLog.e(TAG, "Base64 decoding failed.");
}
return false;
}

42
src/androidqlog.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include <QDebug>
#ifdef Q_OS_ANDROID
#include <QAndroidJniObject>
#include <jni.h>
extern "C" JNIEXPORT void JNICALL
Java_org_cagnulen_qdomyoszwift_QLog_sendToQt(JNIEnv *env, jclass clazz,
jint level, jstring tag, jstring message) {
const char *tagChars = env->GetStringUTFChars(tag, nullptr);
const char *msgChars = env->GetStringUTFChars(message, nullptr);
QString tagStr = QString::fromUtf8(tagChars);
QString msgStr = QString::fromUtf8(msgChars);
// Converti i livelli di log Android in livelli Qt
switch (level) {
case 2: // VERBOSE
qDebug() << "[VERBOSE:" << tagStr << "]" << msgStr;
break;
case 3: // DEBUG
qDebug() << "[DEBUG:" << tagStr << "]" << msgStr;
break;
case 4: // INFO
qInfo() << "[INFO:" << tagStr << "]" << msgStr;
break;
case 5: // WARN
qWarning() << "[WARN:" << tagStr << "]" << msgStr;
break;
case 6: // ERROR
qCritical() << "[ERROR:" << tagStr << "]" << msgStr;
break;
case 7: // ASSERT/WTF
qCritical() << "[ASSERT:" << tagStr << "]" << msgStr;
break;
default:
qDebug() << "[LOG:" << tagStr << "(" << level << ")]" << msgStr;
}
env->ReleaseStringUTFChars(tag, tagChars);
env->ReleaseStringUTFChars(message, msgChars);
}
#endif

64
src/androidstatusbar.cpp Normal file
View File

@@ -0,0 +1,64 @@
#include "androidstatusbar.h"
#include <QQmlEngine>
#include <QDebug>
#ifdef Q_OS_ANDROID
#include <QtAndroid>
#include <QAndroidJniEnvironment>
#endif
AndroidStatusBar* AndroidStatusBar::m_instance = nullptr;
AndroidStatusBar::AndroidStatusBar(QObject *parent) : QObject(parent)
{
m_instance = this;
}
AndroidStatusBar* AndroidStatusBar::instance()
{
return m_instance;
}
void AndroidStatusBar::registerQmlType()
{
qmlRegisterSingletonType<AndroidStatusBar>("AndroidStatusBar", 1, 0, "AndroidStatusBar",
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* {
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
return new AndroidStatusBar();
});
}
int AndroidStatusBar::apiLevel() const
{
#ifdef Q_OS_ANDROID
return QAndroidJniObject::callStaticMethod<jint>("org/cagnulen/qdomyoszwift/CustomQtActivity", "getApiLevel", "()I");
#else
return 0;
#endif
}
void AndroidStatusBar::onInsetsChanged(int top, int bottom, int left, int right)
{
if (m_top != top || m_bottom != bottom || m_left != left || m_right != right) {
m_top = top;
m_bottom = bottom;
m_left = left;
m_right = right;
qDebug() << "Insets changed - Top:" << m_top << "Bottom:" << m_bottom << "Left:" << m_left << "Right:" << m_right;
emit insetsChanged();
}
}
#ifdef Q_OS_ANDROID
// JNI method with standard naming convention
extern "C" JNIEXPORT void JNICALL
Java_org_cagnulen_qdomyoszwift_CustomQtActivity_onInsetsChanged(JNIEnv *env, jobject thiz, jint top, jint bottom, jint left, jint right)
{
Q_UNUSED(env);
Q_UNUSED(thiz);
if (AndroidStatusBar::instance()) {
AndroidStatusBar::instance()->onInsetsChanged(top, bottom, left, right);
}
}
#endif

43
src/androidstatusbar.h Normal file
View File

@@ -0,0 +1,43 @@
#ifndef ANDROIDSTATUSBAR_H
#define ANDROIDSTATUSBAR_H
#include <QObject>
#include <QQmlEngine>
class AndroidStatusBar : public QObject
{
Q_OBJECT
Q_PROPERTY(int height READ height NOTIFY insetsChanged)
Q_PROPERTY(int navigationBarHeight READ navigationBarHeight NOTIFY insetsChanged)
Q_PROPERTY(int leftInset READ leftInset NOTIFY insetsChanged)
Q_PROPERTY(int rightInset READ rightInset NOTIFY insetsChanged)
Q_PROPERTY(int apiLevel READ apiLevel CONSTANT)
public:
explicit AndroidStatusBar(QObject *parent = nullptr);
static void registerQmlType();
static AndroidStatusBar* instance();
int height() const { return m_top; }
int navigationBarHeight() const { return m_bottom; }
int leftInset() const { return m_left; }
int rightInset() const { return m_right; }
int apiLevel() const;
public slots:
void onInsetsChanged(int top, int bottom, int left, int right);
signals:
void insetsChanged();
private:
int m_top = 0;
int m_bottom = 0;
int m_left = 0;
int m_right = 0;
static AndroidStatusBar* m_instance;
};
#endif // ANDROIDSTATUSBAR_H

View File

@@ -0,0 +1,6 @@
#ifndef BLUETOOTHDEVICETYPE_H
#define BLUETOOTHDEVICETYPE_H
enum BLUETOOTH_TYPE { UNKNOWN = 0, TREADMILL, BIKE, ROWING, ELLIPTICAL, JUMPROPE, STAIRCLIMBER };
#endif // BLUETOOTHDEVICETYPE_H

1
src/build-qrc-qml.sh Executable file
View File

@@ -0,0 +1 @@
/Users/cagnulein/Qt/5.15.2/ios/bin/rcc qml.qrc -o ../build-qdomyos-zwift-Qt_5_15_2_for_iOS-Debug/qrc_qml.cpp

View File

@@ -0,0 +1,23 @@
#include "characteristicnotifier0002.h"
#include "bike.h"
#include <QDebug>
#include <QList>
CharacteristicNotifier0002::CharacteristicNotifier0002(bluetoothdevice *bike, QObject *parent)
: CharacteristicNotifier(0x0002, parent) {
Bike = bike;
answerList = QList<QByteArray>(); // Initialize empty list
}
void CharacteristicNotifier0002::addAnswer(const QByteArray &newAnswer) {
answerList.append(newAnswer);
}
int CharacteristicNotifier0002::notify(QByteArray &value) {
if(!answerList.isEmpty()) {
value.append(answerList.first()); // Get first item
answerList.removeFirst(); // Remove it from list
return CN_OK;
}
return CN_INVALID;
}

View File

@@ -0,0 +1,19 @@
#ifndef CHARACTERISTICNOTIFIER0002_H
#define CHARACTERISTICNOTIFIER0002_H
#include "bluetoothdevice.h"
#include "characteristicnotifier.h"
#include <QList>
class CharacteristicNotifier0002 : public CharacteristicNotifier {
Q_OBJECT
bluetoothdevice* Bike = nullptr;
QList<QByteArray> answerList;
public:
explicit CharacteristicNotifier0002(bluetoothdevice *bike, QObject *parent = nullptr);
int notify(QByteArray &value) override;
void addAnswer(const QByteArray &newAnswer);
};
#endif // CHARACTERISTICNOTIFIER0002_H

View File

@@ -0,0 +1,23 @@
#include "characteristicnotifier0004.h"
#include "bike.h"
#include <QDebug>
#include <QList>
CharacteristicNotifier0004::CharacteristicNotifier0004(bluetoothdevice *bike, QObject *parent)
: CharacteristicNotifier(0x0004, parent) {
Bike = bike;
answerList = QList<QByteArray>();
}
void CharacteristicNotifier0004::addAnswer(const QByteArray &newAnswer) {
answerList.append(newAnswer);
}
int CharacteristicNotifier0004::notify(QByteArray &value) {
if(!answerList.isEmpty()) {
value.append(answerList.first());
answerList.removeFirst();
return CN_OK;
}
return CN_INVALID;
}

View File

@@ -0,0 +1,19 @@
#ifndef CHARACTERISTICNOTIFIER0004_H
#define CHARACTERISTICNOTIFIER0004_H
#include "bluetoothdevice.h"
#include "characteristicnotifier.h"
#include <QList>
class CharacteristicNotifier0004 : public CharacteristicNotifier {
Q_OBJECT
bluetoothdevice* Bike = nullptr;
QList<QByteArray> answerList;
public:
explicit CharacteristicNotifier0004(bluetoothdevice *bike, QObject *parent = nullptr);
int notify(QByteArray &value) override;
void addAnswer(const QByteArray &newAnswer);
};
#endif // CHARACTERISTICNOTIFIER0004_H

View File

@@ -5,7 +5,7 @@ CharacteristicNotifier2A53::CharacteristicNotifier2A53(bluetoothdevice *Bike, QO
: CharacteristicNotifier(0x2a53, parent), Bike(Bike) {}
int CharacteristicNotifier2A53::notify(QByteArray &value) {
bluetoothdevice::BLUETOOTH_TYPE dt = Bike->deviceType();
BLUETOOTH_TYPE dt = Bike->deviceType();
value.append(0x02); // total distance
uint16_t speed = Bike->currentSpeed().value() / 3.6 * 256;
uint32_t distance = Bike->odometer() * 10000.0;

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