Compare commits

..

4 Commits

839 changed files with 74471 additions and 190314 deletions

2
.github/FUNDING.yml vendored
View File

@@ -7,6 +7,6 @@ ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: cagnulein
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.buymeacoffee.com/cagnulein'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

17
.github/stale.yml vendored
View File

@@ -1,17 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 15
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
#closeComment: false

View File

@@ -13,181 +13,13 @@ on:
branches: [ master, github-workflow-playground ]
pull_request:
branches: [ master ]
# schedule:
# - cron: "0 */12 * * *"
schedule:
- cron: "0 */12 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
window-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: cagnulein/qmdnsengine
path: "src/qmdnsengine/"
ref: "zwift"
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: microsoft/MSIX-Toolkit
path: "src/MSIX-Toolkit/"
ref: b82af826d29e93e4c85d34fad8a405b6c49905e7
- uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-toolchain
msystem: mingw64
release: false
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.20.x'
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
host: 'windows'
modules: 'qtnetworkauth qtcharts'
target: "desktop"
arch: win64_mingw81
dir: "${{github.workspace}}/qt/"
install-deps: "true"
- name: Build
run: |
qmake
cd src
echo "#define STRAVA_SECRET_KEY ${{ secrets.strava_secret_key }}" > secret.h
echo "#define SMTP_USERNAME ${{ secrets.smtp_username }}" >> secret.h
echo "#define SMTP_PASSWORD ${{ secrets.smtp_password }}" >> secret.h
echo "#define SMTP_SERVER ${{ secrets.smtp_server }}" >> secret.h
cd ..
make -j8
cd src/debug
mkdir output
mkdir appx
cp qdomyos-zwift.exe output/
cd output
windeployqt --qmldir ../../ qdomyos-zwift.exe
cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libwinpthread-1.dll" .
cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libgcc_s_seh-1.dll" .
cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libstdc++-6.dll" .
cp ../../../icons/iOS/iTunesArtwork@2x.png .
cp ../../AppxManifest.xml .
mkdir adb
cp ../../adb/* adb/
cd ..
cd appx
#../../MSIX-Toolkit/WindowsSDK/10/10.0.20348.0/x64/makeappx.exe pack /d ../output/ /p qz
- name: Archive windows binary
uses: actions/upload-artifact@v2
with:
name: windows-binary
path: src/debug/output
# window-steam-build:
# runs-on: windows-latest
#
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodule repo
# uses: actions/checkout@v2
# with:
# repository: bluetiger9/SmtpClient-for-Qt
# path: "src/smtpclient/"
# ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
#
# - uses: actions/checkout@v2
# - name: Checkout submodule repo
# uses: actions/checkout@v2
# with:
# repository: cagnulein/qmdnsengine
# path: "src/qmdnsengine/"
# ref: "zwift"
#
# - uses: msys2/setup-msys2@v2
# with:
# install: mingw-w64-x86_64-toolchain
# msystem: mingw64
# release: false
#
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.20.x'
#
# - name: Install Qt
# uses: jurplel/install-qt-action@v2
# with:
# version: '5.15.2'
# host: 'windows'
# modules: 'qtnetworkauth qtcharts'
# target: "desktop"
# arch: win64_mingw81
# dir: "${{github.workspace}}/qt/"
# install-deps: "true"
#
# - name: Build
# run: |
# qmake
# cd src
# echo "#define STRAVA_SECRET_KEY ${{ secrets.strava_secret_key }}" > secret.h
# echo "#define SMTP_USERNAME ${{ secrets.smtp_username }}" >> secret.h
# echo "#define SMTP_PASSWORD ${{ secrets.smtp_password }}" >> secret.h
# echo "#define SMTP_SERVER ${{ secrets.smtp_server }}" >> secret.h
# echo "#define STEAM_STORE" >> secret.h
# cd ..
# make -j8
# cd src/debug
# mkdir output
# mkdir appx
# cp qdomyos-zwift.exe output/
# cd output
# windeployqt --qmldir ../../ qdomyos-zwift.exe
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libwinpthread-1.dll" .
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libgcc_s_seh-1.dll" .
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libstdc++-6.dll" .
#
# - uses: game-ci/steam-deploy@v1
# with:
# username: ${{ secrets.STEAM_USERNAME }}
# password: ${{ secrets.STEAM_PASSWORD }}
# configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
# ssfnFileName: ${{ secrets.STEAM_SSFN_FILE_NAME }}
# ssfnFileContents: ${{ secrets.STEAM_SSFN_FILE_CONTENTS }}
# appId: 2267200
# buildDescription: 2.12
# rootPath: src/debug/output
# depot1Path: ./
# #depot2Path: StandaloneLinux64
# releaseBranch: prerelease
# This workflow contains a single job called "build"
linux-x86-build:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
@@ -210,7 +42,7 @@ jobs:
- name: Xvfb install and run
run: |
sudo apt-get install -y xvfb
Xvfb -ac ${{ env.DISPLAY }} -screen 0 1280x780x24 &
Xvfb -ac ${{ env.DISPLAY }} -screen 0 1280x780x24 &
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
@@ -219,52 +51,18 @@ jobs:
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: cagnulein/qmdnsengine
path: "src/qmdnsengine/"
ref: "zwift"
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"
- name: Install packages required to run QZ inside workflow
run: sudo apt update -y && sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
host: 'linux'
modules: 'qtnetworkauth qtcharts'
run: sudo apt update -y && sudo apt-get install -y qt5-default libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-default libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
- name: Compile Linux Desktop
run: qmake; make -j8
run: cd src; qmake; make -j8
- name: Archive linux-desktop binary
uses: actions/upload-artifact@v2
with:
name: linux-desktop-binary
path: src/qdomyos-zwift
- name: Test
run: cd tst; GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ./qdomyos-zwift-tests; cd ..
- name: Upload test results
uses: actions/upload-artifact@v2
if: failure()
with:
name: test_results_xml
path: tst/test-results/**/*.xml
path: src/qdomyos-zwift
# - name: Test Peloton API
# if: github.event_name == 'push' || github.event_name == 'schedule'
@@ -305,7 +103,7 @@ jobs:
# modules: 'qtcharts debug_info'
# dir: '${{ github.workspace }}/output/android/'
# cached: ${{ steps.cache-qt-android.outputs.cache-hit }}
# - name: Compile Android
# run: cd src; qmake; make -j4
@@ -317,124 +115,6 @@ jobs:
# target: 'desktop'
# modules: 'qtcharts debug_info'
# dir: '${{ github.workspace }}/output/macos/'
# - name: Compile MacOS
# run: cd src; qmake; make -j4
# This workflow contains a single job called "build"
android-build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# - name: Cache Qt Linux Desktop
# id: cache-qt-linux-desktop
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/linux-desktop/'
# key: ${{ runner.os }}-QtCache-Linux-Desktop
# - name: Cache Qt Linux Android
# id: cache-qt-android
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/android/'
# key: ${{ runner.os }}-QtCache-Android
- name: Xvfb install and run
run: |
sudo apt-get install -y xvfb
Xvfb -ac ${{ env.DISPLAY }} -screen 0 1280x780x24 &
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: cagnulein/qmdnsengine
path: "src/qmdnsengine/"
ref: "zwift"
- uses: actions/checkout@v2
- name: Checkout submodule repo
uses: actions/checkout@v2
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"
- name: Install packages required to run QZ inside workflow
run: sudo apt update -y && sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
# - name: Test Peloton API
# if: github.event_name == 'push' || github.event_name == 'schedule'
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-peloton -peloton-username ${{ secrets.peloton_username }} -peloton-password ${{ secrets.peloton_password }}
# timeout-minutes: 2
# - name: Test Home Fitness Buddy API
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-hfb
# timeout-minutes: 2
# - uses: actions/checkout@v2
# with:
# repository: nttld/setup-ndk
# path: setup-ndk
# The packages.json in nttld/setup-ndk has already been updated,
# https://github.com/nttld/setup-ndk/commit/831db5b02a0f0cab80614619efe461a3dcc140e6
# but `dist/*` has not been rebuilt yet. Build it.
# https://github.com/nttld/setup-ndk/tree/main/dist
# - name: Locally rebuilt setup-ndk
# run: |
# npm -prefix ./setup-ndk install
# npm -prefix ./setup-ndk run all
# Install using locally rebuilt setup-ndk
# - name: Setup Android NDK r21d
# uses: ./setup-ndk
#- uses: nttld/setup-ndk@v1
# with:
# ndk-version: r21d
# waiting github.com/jurplel/install-qt-action/issues/63
- name: Install Qt Android
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
host: 'linux'
target: 'android'
arch: 'android'
modules: 'qtcharts qtnetworkauth'
dir: '${{ github.workspace }}/output/android/'
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '11'
- name: Set Android NDK 21 && build
run: |
# Install NDK 21 after GitHub update
# https://github.com/actions/virtual-environments/issues/5595
ANDROID_ROOT="/usr/local/lib/android"
ANDROID_SDK_ROOT="${ANDROID_ROOT}/sdk"
SDKMANAGER="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager"
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
export ANDROID_NDK="${ANDROID_SDK_ROOT}/ndk-bundle"
export ANDROID_NDK_ROOT="${ANDROID_NDK}"
ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK
rm -rf /usr/local/lib/android/sdk/ndk/25.1.8937393
qmake -spec android-clang 'ANDROID_ABIS=armeabi-v7a arm64-v8a x86 x86_64' 'ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/21.4.7075529' && make -j4 && make INSTALL_ROOT=${{ github.workspace }}/output/android/ install
- name: Build APK (not usable for production due to unpatched QT library)
run: cd src; androiddeployqt --input android-qdomyos-zwift-deployment-settings.json --output ${{ github.workspace }}/output/android/ --android-platform android-31 --gradle --aab

16
.gitignore vendored
View File

@@ -18,15 +18,9 @@ src/build/*
src/debug-*
src/secret.h
*.swo
*.swp
build-qdomyos-zwift-Android_Qt_5_15_2_Clang_Multi_Abi-Debug/*
**/node_modules/*
*.pro.user
template-examples/youtube-viewer/node_modules/*
template-examples/youtube-viewer/*.json
template-examples/youtube-viewer/.eslintrc.js
@@ -39,13 +33,3 @@ template-examples/train-program-saver/*.json
template-examples/train-program-saver/.eslintrc.js
template-examples/train-program-saver/.jshintrc
template-examples/train-program-saver/debug.js
google_test/*
# Qt-es
*.pro.user
*build-*
!build-qdomyos-zwift-Qt_*_for_iOS-Debug # Needed for Apple Watch
src/inner_templates/googlemaps/cesium-key.js
*.autosave
.vscode/settings.json

11
.gitmodules vendored
View File

@@ -3,13 +3,4 @@
url = https://github.com/KDAB/android_openssl.git
[submodule "src/smtpclient"]
path = src/smtpclient
url = https://github.com/cagnulein/SmtpClient-for-Qt.git
branch = cagnulein-patch-2
[submodule "src/qmdnsengine"]
path = src/qmdnsengine
url = https://github.com/cagnulein/qmdnsengine.git
branch = zwift
[submodule "tst/googletest"]
path = tst/googletest
url = https://github.com/google/googletest.git
branch = tags/release-1.12.1
url = https://github.com/bluetiger9/SmtpClient-for-Qt.git

View File

@@ -54,10 +54,8 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/qdomyoszwift">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "876E4E102594747F00BD5714"
@@ -65,7 +63,7 @@
BlueprintName = "watchkit"
ReferencedContainer = "container:qdomyoszwift.xcodeproj">
</BuildableReference>
</RemoteRunnable>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -73,10 +71,8 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/qdomyoszwift">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "876E4E102594747F00BD5714"
@@ -84,16 +80,7 @@
BlueprintName = "watchkit"
ReferencedContainer = "container:qdomyoszwift.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "876E4E102594747F00BD5714"
BuildableName = "watchkit.app"
BlueprintName = "watchkit"
ReferencedContainer = "container:qdomyoszwift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@@ -193,38 +193,6 @@
endingLineNumber = "57"
landmarkName = "BLEPeripheralManager"
landmarkType = "3">
<Locations>
<Location
uuid = "16D24B27-D0FB-4EC3-BAE8-56101FE7949B - 1c798ec95ff8d4b7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "qdomyoszwift.BLEPeripheralManager.crankRevolutions.modify : Swift.Optional&lt;Swift.UInt16&gt;"
moduleName = "qdomyoszwift"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/cagnulein/qdomyos-zwift/build-qdomyos-zwift-Qt_5_15_2_for_iOS-Debug/%3Ccompiler-generated%3E"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "0"
endingLineNumber = "0"
offsetFromSymbolStart = "16">
</Location>
<Location
uuid = "16D24B27-D0FB-4EC3-BAE8-56101FE7949B - 5ebbef0dc9913f07"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "qdomyoszwift.BLEPeripheralManager.init() -&gt; qdomyoszwift.BLEPeripheralManager"
moduleName = "qdomyoszwift"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/cagnulein/qdomyos-zwift/src/ios/BLEPeripheralManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "57"
endingLineNumber = "57"
offsetFromSymbolStart = "132">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
@@ -367,7 +335,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "38"
endingLineNumber = "38"
landmarkName = "lockscreen::stepCadence()"
landmarkName = "lockscreen::virtualbike_setHeartRate(heartRate)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
@@ -375,7 +343,7 @@
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "FE5697FF-F44C-43C2-A98D-C400EE56F047"
shouldBeEnabled = "No"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../src/ios/lockscreen.mm"
@@ -383,8 +351,8 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
landmarkName = "unknown"
landmarkType = "0">
landmarkName = "lockscreen::virtualbike_setCadence(crankRevolutions, lastCrankEventTime)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
@@ -399,7 +367,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "37"
endingLineNumber = "37"
landmarkName = "lockscreen::stepCadence()"
landmarkName = "lockscreen::virtualbike_setHeartRate(heartRate)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
@@ -407,7 +375,7 @@
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3DBE0495-050A-4979-85D4-28B78676F212"
shouldBeEnabled = "No"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "../src/ios/lockscreen.mm"
@@ -415,7 +383,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
landmarkName = "lockscreen::setKcal(kcal)"
landmarkName = "lockscreen::virtualbike_setCadence(crankRevolutions, lastCrankEventTime)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
@@ -431,7 +399,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "32"
endingLineNumber = "32"
landmarkName = "lockscreen::heartRate()"
landmarkName = "lockscreen::virtualbike_ios()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
@@ -463,7 +431,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "35"
endingLineNumber = "35"
offsetFromSymbolStart = "32">
offsetFromSymbolStart = "22">
</Location>
<Location
uuid = "18F27065-9FB2-44A2-99D0-7D41061141A3 - 4daffae51fb2d733"
@@ -478,7 +446,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "35"
endingLineNumber = "35"
offsetFromSymbolStart = "36">
offsetFromSymbolStart = "28">
</Location>
</Locations>
</BreakpointContent>

View File

@@ -1,62 +0,0 @@
{
"identifier" : "2816EB89",
"nonRenewingSubscriptions" : [
],
"products" : [
],
"settings" : {
},
"subscriptionGroups" : [
{
"id" : "F012E388",
"localizations" : [
],
"name" : "Swag Bag",
"subscriptions" : [
{
"adHocOffers" : [
],
"codeOffers" : [
],
"displayPrice" : "1.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "F108BD35",
"introductoryOffer" : null,
"localizations" : [
{
"description" : "Swag Bag",
"displayName" : "Swag Bag",
"locale" : "en_US"
},
{
"description" : "Swag Bag",
"displayName" : "Swag Bag",
"locale" : "en_GB"
},
{
"description" : "Swag Bag",
"displayName" : "Swag Bag",
"locale" : "it"
}
],
"productID" : "org.cagnulein.qdomyoszwift.swagbag",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "SwagBag",
"subscriptionGroupID" : "F012E388",
"type" : "RecurringSubscription"
}
]
}
],
"version" : {
"major" : 1,
"minor" : 2
}
}

View File

@@ -1,25 +1,21 @@
{
"images" : [
{
"filename" : "circular38mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"filename" : "circular40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "circular42mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"filename" : "circular44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,25 +1,21 @@
{
"images" : [
{
"filename" : "extra-large38mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"filename" : "extra-large40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "extra-large42mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"filename" : "extra-large44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,13 +1,11 @@
{
"images" : [
{
"filename" : "graphic-bezel40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "graphic-bezel44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,13 +1,11 @@
{
"images" : [
{
"filename" : "graphic-circular40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "graphic-circular44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,13 +1,11 @@
{
"images" : [
{
"filename" : "graphic-corner40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "graphic-corner44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,25 +1,21 @@
{
"images" : [
{
"filename" : "graphic-extra-large38mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"filename" : "graphic-extra-large40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "graphic-extra-large42mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"filename" : "graphic-extra-large44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,13 +1,11 @@
{
"images" : [
{
"filename" : "graphic-large-rectangular40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "graphic-large-rectangular44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,25 +1,21 @@
{
"images" : [
{
"filename" : "modular38mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"filename" : "modular40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "modular42mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"filename" : "modular44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -1,25 +1,21 @@
{
"images" : [
{
"filename" : "utility38mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"filename" : "utility40mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">161"
},
{
"filename" : "utility42mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
},
{
"filename" : "utility44mm@2x.png",
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">183"

View File

@@ -13,59 +13,6 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
// MARK: - Timeline Configuration
private func templateForComplication(complication: CLKComplication) -> CLKComplicationTemplate? {
// Init default output:
var template: CLKComplicationTemplate? = nil
// Graphic Complications are only availably since watchOS 5.0:
if #available(watchOSApplicationExtension 5.0, *) {
// NOTE: Watch faces that support graphic templates are available only on Apple Watch Series 4 or later. So the binary on older devices (e.g. Watch Series 3) will not contain the images.
if complication.family == .graphicCircular {
let imageTemplate = CLKComplicationTemplateGraphicCircularImage()
// Check if asset exists, to prevent crash on non-supported devices:
if let fullColorImage = UIImage(named: "Complication/Graphic Circular") {
let imageProvider = CLKFullColorImageProvider.init(fullColorImage: fullColorImage)
imageTemplate.imageProvider = imageProvider
template = imageTemplate
}
}
else if complication.family == .graphicCorner {
let imageTemplate = CLKComplicationTemplateGraphicCornerCircularImage()
// Check if asset exists, to prevent crash on non-supported devices:
if let fullColorImage = UIImage(named: "Complication/Graphic Corner") {
let imageProvider = CLKFullColorImageProvider.init(fullColorImage: fullColorImage)
imageTemplate.imageProvider = imageProvider
template = imageTemplate
}
}
}
// For all watchOS versions:
if complication.family == .circularSmall {
let imageTemplate = CLKComplicationTemplateCircularSmallSimpleImage()
let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "Complication/Circular")!)
imageProvider.tintColor = UIColor.blue
imageTemplate.imageProvider = imageProvider
template = imageTemplate
}
else if complication.family == .modularSmall {
let imageTemplate = CLKComplicationTemplateModularSmallSimpleImage()
let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "Complication/Modular")!)
imageProvider.tintColor = UIColor.blue
imageTemplate.imageProvider = imageProvider
template = imageTemplate
}
else if complication.family == .utilitarianSmall {
let imageTemplate = CLKComplicationTemplateUtilitarianSmallSquare()
let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "Complication/Utilitarian")!)
imageProvider.tintColor = UIColor.blue
imageTemplate.imageProvider = imageProvider
template = imageTemplate
}
return template
}
func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) {
handler([.forward, .backward])
}
@@ -86,9 +33,7 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
// Call the handler with the current timeline entry
let template = templateForComplication(complication: complication)
let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template!)
handler(timelineEntry)
handler(nil)
}
func getTimelineEntries(for complication: CLKComplication, before date: Date, limit: Int, withHandler handler: @escaping ([CLKComplicationTimelineEntry]?) -> Void) {
@@ -101,15 +46,11 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
handler(nil)
}
func getPlaceholderTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
// This method will be called once per supported complication, and the results will be cached
handler(templateForComplication(complication: complication))
}
// MARK: - Placeholder Templates
func getLocalizableSampleTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
// This method will be called once per supported complication, and the results will be cached
handler(templateForComplication(complication: complication))
handler(nil)
}
}

View File

@@ -8,8 +8,6 @@
<string>watchkit Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>NSMotionUsageDescription</key>
<string>access to step cadence in order to show it in the application</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -24,21 +22,6 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>CLKComplicationSupportedFamilies</key>
<array>
<string>CLKComplicationFamilyModularSmall</string>
<string>CLKComplicationFamilyModularLarge</string>
<string>CLKComplicationFamilyUtilitarianSmall</string>
<string>CLKComplicationFamilyUtilitarianSmallFlat</string>
<string>CLKComplicationFamilyUtilitarianLarge</string>
<string>CLKComplicationFamilyCircularSmall</string>
<string>CLKComplicationFamilyExtraLarge</string>
<string>CLKComplicationFamilyGraphicCorner</string>
<string>CLKComplicationFamilyGraphicBezel</string>
<string>CLKComplicationFamilyGraphicCircular</string>
<string>CLKComplicationFamilyGraphicRectangular</string>
<string>CLKComplicationFamilyGraphicExtraLarge</string>
</array>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

View File

@@ -8,56 +8,26 @@
import WatchKit
import HealthKit
import CoreMotion
class MainController: WKInterfaceController {
@IBOutlet weak var userNameLabel: WKInterfaceLabel!
@IBOutlet weak var stepCountsLabel: WKInterfaceLabel!
@IBOutlet weak var caloriesLabel: WKInterfaceLabel!
@IBOutlet weak var distanceLabel: WKInterfaceLabel!
@IBOutlet weak var heartRateLabel: WKInterfaceLabel!
@IBOutlet weak var startButton: WKInterfaceButton!
@IBOutlet weak var cmbSports: WKInterfacePicker!
static var start: Bool! = false
let pedometer = CMPedometer()
var sport: Int = 0
override func awake(withContext context: Any?) {
super.awake(withContext: context)
let sports: [WKPickerItem] = [WKPickerItem(),WKPickerItem(),WKPickerItem(),WKPickerItem(),WKPickerItem()]
sports[0].title = "Bike"
sports[1].title = "Run"
sports[2].title = "Walk"
sports[3].title = "Elliptical"
sports[4].title = "Rowing"
cmbSports.setItems(sports)
sport = UserDefaults.standard.value(forKey: "sport") as? Int ?? 0
cmbSports.setSelectedItemIndex(sport)
// Configure interface objects here.
print("AWAKE")
}
@IBAction func changeSport(_ value: Int) {
self.sport = value
UserDefaults.standard.set(value, forKey: "sport")
UserDefaults.standard.synchronize()
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
print("WILL ACTIVE")
WorkoutTracking.shared.fetchStepCounts()
if CMPedometer.isStepCountingAvailable() {
pedometer.startUpdates(from: Date()) { pedometerData, error in
guard let pedometerData = pedometerData, error == nil else { return }
self.stepCountsLabel.setText("\(Int(((pedometerData.currentCadence?.doubleValue ?? 0) * 60.0 / 2.0))) STEP CAD.")
WatchKitConnection.stepCadence = Int(((pedometerData.currentCadence?.doubleValue ?? 0) * 60.0 / 2.0))
WatchKitConnection.shared.sendMessage(message: ["stepCadence":
"\(WatchKitConnection.stepCadence)" as AnyObject])
}
}
}
override func didDeactivate() {
@@ -74,7 +44,6 @@ extension MainController {
MainController.start = true
startButton.setTitle("Stop")
WorkoutTracking.authorizeHealthKit()
WorkoutTracking.shared.setSport(sport)
WorkoutTracking.shared.startWorkOut()
WorkoutTracking.shared.delegate = self
@@ -90,7 +59,6 @@ extension MainController {
}
extension MainController: WorkoutTrackingDelegate {
func didReceiveHealthKitDistanceCycling(_ distanceCycling: Double) {
}
@@ -104,21 +72,10 @@ extension MainController: WorkoutTrackingDelegate {
"\(heartRate)" as AnyObject])
WorkoutTracking.distance = WatchKitConnection.distance
WorkoutTracking.kcal = WatchKitConnection.kcal
if Locale.current.measurementSystem != "Metric" {
self.distanceLabel.setText("Distance \(String(format:"%.2f", WorkoutTracking.distance))")
} else {
self.distanceLabel.setText("Distance \(String(format:"%.2f", WorkoutTracking.distance * 1.60934))")
}
self.caloriesLabel.setText("KCal \(Int(WorkoutTracking.kcal))")
//WorkoutTracking.cadenceSteps = pedometer.
}
func didReceiveHealthKitStepCounts(_ stepCounts: Double) {
//stepCountsLabel.setText("\(stepCounts) STEPS")
}
func didReceiveHealthKitStepCadence(_ stepCadence: Double) {
stepCountsLabel.setText("\(stepCounts) STEPS")
}
}
@@ -127,11 +84,3 @@ extension MainController: WatchKitConnectionDelegate {
userNameLabel.setText(userName)
}
}
extension Locale
{
var measurementSystem : String?
{
return (self as NSLocale).object(forKey: NSLocale.Key.measurementSystem) as? String
}
}

View File

@@ -23,7 +23,6 @@ class WatchKitConnection: NSObject {
static let shared = WatchKitConnection()
public static var distance = 0.0
public static var kcal = 0.0
public static var stepCadence = 0
weak var delegate: WatchKitConnectionDelegate?
private override init() {

View File

@@ -12,7 +12,6 @@ import HealthKit
protocol WorkoutTrackingDelegate: class {
func didReceiveHealthKitHeartRate(_ heartRate: Double)
func didReceiveHealthKitStepCounts(_ stepCounts: Double)
func didReceiveHealthKitStepCadence(_ stepCadence: Double)
func didReceiveHealthKitDistanceCycling(_ distanceCycling: Double)
func didReceiveHealthKitActiveEnergyBurned(_ activeEnergyBurned: Double)
}
@@ -28,10 +27,6 @@ class WorkoutTracking: NSObject {
static let shared = WorkoutTracking()
public static var distance = Double()
public static var kcal = Double()
public static var cadenceTimeStamp = NSDate().timeIntervalSince1970
public static var cadenceLastSteps = Double()
public static var cadenceSteps = 0
var sport: Int = 0
let healthStore = HKHealthStore()
let configuration = HKWorkoutConfiguration()
var workoutSession: HKWorkoutSession!
@@ -84,13 +79,7 @@ extension WorkoutTracking {
if let sum = result.sumQuantity() {
resultCount = sum.doubleValue(for: HKUnit.count())
let now = NSDate().timeIntervalSince1970
let deltaT = now - WorkoutTracking.cadenceTimeStamp
let deltaC = resultCount - WorkoutTracking.cadenceLastSteps
WorkoutTracking.cadenceLastSteps = resultCount
WorkoutTracking.cadenceTimeStamp = now
weakSelf.delegate?.didReceiveHealthKitStepCounts(resultCount)
weakSelf.delegate?.didReceiveHealthKitStepCadence((deltaC / deltaT) * 60)
} else {
print("Failed to fetch steps rate 2")
}
@@ -102,23 +91,8 @@ extension WorkoutTracking {
}
}
func setSport(_ sport: Int) {
self.sport = sport
}
private func configWorkout() {
var activityType = HKWorkoutActivityType.cycling
if self.sport == 1 {
activityType = HKWorkoutActivityType.running
} else if self.sport == 2 {
activityType = HKWorkoutActivityType.walking
} else if self.sport == 3 {
activityType = HKWorkoutActivityType.elliptical
} else if self.sport == 4 {
activityType = HKWorkoutActivityType.rowing
}
configuration.activityType = activityType
configuration.activityType = .cycling
configuration.locationType = .indoor
do {
@@ -150,7 +124,6 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
HKSampleType.quantityType(forIdentifier: .stepCount)!,
HKSampleType.quantityType(forIdentifier: .heartRate)!,
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.workoutType()
])
@@ -176,10 +149,6 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
if let error = error {
print(error)
}
if self.sport > 0 {
self.workoutBuilder.dataSource?.enableCollection(for: HKQuantityType.quantityType(forIdentifier: .distanceWalkingRunning)!, predicate: nil)
}
}
}
@@ -204,72 +173,29 @@ extension WorkoutTracking: WorkoutTrackingProtocol {
end: Date())
workoutBuilder.add([sample]) {(success, error) in}
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceCycling) else {
return
}
let unitDistance = HKUnit.mile()
let miles = WorkoutTracking.distance
let quantityMiles = HKQuantity(unit: unitDistance,
doubleValue: miles)
if(sport == 0) {
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceCycling) else {
return
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: workoutSession.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")
}
}
}
} else {
guard let quantityTypeDistance = HKQuantityType.quantityType(
forIdentifier: .distanceWalkingRunning) else {
return
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: workoutSession.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")
}
}
}
}
let sampleDistance = HKCumulativeQuantitySeriesSample(type: quantityTypeDistance,
quantity: quantityMiles,
start: workoutSession.startDate!,
end: Date())
workoutBuilder.add([sample]) {(success, error) in}
workoutBuilder.add([sampleDistance]) {(success, error) in}
workoutBuilder.endCollection(withEnd: Date()) { (success, error) in
}
workoutBuilder.finishWorkout{ (success, error) in }
}
func fetchStepCounts() {

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="20037" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Tpn-rd-UUX">
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="17506" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Tpn-rd-UUX">
<device id="watch38"/>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="20006"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="17500"/>
</dependencies>
<scenes>
<!--Main-->
@@ -12,26 +12,16 @@
<objects>
<controller identifier="Main" hidesWhenLoading="NO" id="Tpn-rd-UUX" customClass="MainController" customModule="watchkit_Extension">
<items>
<label width="136" alignment="left" text="QZ Fitness" textAlignment="center" id="SlU-M7-WGB"/>
<label width="136" alignment="left" text="qdomyos-zwift" textAlignment="center" id="SlU-M7-WGB"/>
<label width="136" alignment="left" text="Heart Rate" id="Nda-m1-XRw"/>
<label width="136" alignment="left" text="Step Counts" id="HpA-e9-6YV"/>
<button width="1" alignment="left" title="Start" id="vZg-X8-uY5">
<connections>
<action selector="startWorkout" destination="Tpn-rd-UUX" id="UaW-pR-tn6"/>
</connections>
</button>
<label width="136" alignment="left" text="Heart Rate" id="Nda-m1-XRw"/>
<label width="136" alignment="left" text="Step Counts" id="HpA-e9-6YV"/>
<label width="136" alignment="left" text="Calories" id="Szi-Jp-J3S"/>
<label width="136" alignment="left" text="Distance" id="eRf-NJ-6If"/>
<picker height="100" alignment="left" id="OTR-HF-vYb">
<connections>
<action selector="changeSport:" destination="Tpn-rd-UUX" id="3vY-lq-IhZ"/>
</connections>
</picker>
</items>
<connections>
<outlet property="caloriesLabel" destination="Szi-Jp-J3S" id="trd-YS-bJy"/>
<outlet property="cmbSports" destination="OTR-HF-vYb" id="Ws5-w9-ZT8"/>
<outlet property="distanceLabel" destination="eRf-NJ-6If" id="ZE2-OB-jqN"/>
<outlet property="heartRateLabel" destination="Nda-m1-XRw" id="1la-8R-3jG"/>
<outlet property="startButton" destination="vZg-X8-uY5" id="pJc-09-kfV"/>
<outlet property="stepCountsLabel" destination="HpA-e9-6YV" id="Z88-ej-6oG"/>

View File

@@ -1,14 +0,0 @@
QT += gui bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia
QTPLUGIN += qavfmediaplayer
QT+= charts
unix:android: QT += androidextras gui-private
android: include(android_openssl/openssl.pri)
INCLUDEPATH += $$PWD/src/qmdnsengine/src/include
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/src/android
ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64

View File

@@ -1,24 +1,10 @@
FROM ubuntu:latest
FROM debian:stable
MAINTAINER cagnulein
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Moscow
ENV MAKEFLAGS -j8
WORKDIR /usr/local/src
RUN apt-get update && apt-get install -y tzdata
# utils
RUN apt -y update
RUN apt -y upgrade
RUN apt update -y && apt-get install -y git qt5-default libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-default libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev build-essential
RUN git clone https://github.com/cagnulein/qdomyos-zwift.git
WORKDIR /usr/local/src/qdomyos-zwift
RUN git submodule update --init src/smtpclient/
RUN git submodule update --init src/qmdnsengine/
WORKDIR /usr/local/src/qdomyos-zwift/src
RUN qmake
RUN make -j4
WORKDIR /usr/local/src/qdomyos-zwift/src
CMD ["./qdomyos-zwift","-no-gui"]
RUN apt -y install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-default

View File

@@ -4,20 +4,17 @@ QDomyos-Zwift can be installed from source on MacOs, Linux, Android and IOS.
Once you've installed QDomyos-Zwift, you can access the [operation guide](30_usage.md) for more information.
These instructions build the app itself, not the test project.
## On a Linux System (from source)
```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 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 sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev
$ git clone https://github.com/cagnulein/qdomyos-zwift.git
$ cd qdomyos-zwift
$ git submodule update --init src/smtpclient/
$ git submodule update --init src/qmdnsengine/
$ git submodule update --init tst/googletest/
$ cd src
$ qmake qdomyos-zwift.pro
$ qmake
$ make -j4
$ sudo ./qdomyos-zwift
```
@@ -28,13 +25,13 @@ $ sudo ./qdomyos-zwift
You will need to (at a minimum) to install the xcode Command Line Tools (CLI) thanks to @richardwait
https://developer.apple.com/download/more/?=xcode
Download and install http://download.qt.io/official_releases/qt/5.12/5.12.9/qt-opensource-mac-x64-5.12.9.dmg and simply run the qdomyos-zwift release for MacOs
Download and install http://download.qt.io/official_releases/qt/5.12/5.12.9/qt-opensource-mac-x64-5.12.9.dmg and simply run the qdomyos-zwift relase for MacOs
## On Raspberry Pi Zero W
![raspi](../docs/img/raspi-bike.jpg)
This guide will walk you through steps to setup an autonomous, headless raspberry bridge.
This guide will walk you through steps to setup an autonomous, headless raspberry brigde.
### Initial System Preparation
@@ -105,17 +102,15 @@ This operation takes a moment to complete.
#### Install qdomyos-zwift from sources
```bash
sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-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
git clone https://github.com/cagnulein/qdomyos-zwift.git
cd qdomyos-zwift
git submodule update --init src/smtpclient/
git submodule update --init src/qmdnsengine/
git submodule update --init tst/googletest/
cd src
qmake qdomyos-zwift.pro
make
```
`sudo apt install git libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 qt5-assistant libqt5networkauth5-dev libqt5websockets5-dev`
`git clone https://github.com/cagnulein/qdomyos-zwift.git`
`cd qdomyos-zwift`
`git submodule update --init src/smtpclient/`
`git submodule update --init src/qmdnsengine/`
`cd src`
`qmake`
`make`
Please note :
- Don't build the application with `-j4` option (this will fail)

View File

@@ -11,12 +11,26 @@ This list is not exhaustive. Please report any application known to be working w
|[Fulgaz](21_applications_detail.md#fulgaz)|![bike](img/20_bike.png)|![IOS](img/20_apple.png) ![Android](img/20_android.png) ![PC](img/20_windows.png)|Yes|Yes|Yes|Yes, no FTMS support (see note)|Yes (see note) |
# Supported devices
Check the full list https://github.com/cagnulein/qdomyos-zwift/wiki/Equipment-Compatibility
This list is not exhaustive.
Try the qdomyos app with your fitness appliance and report how it is going.
If it's not working, you can [ask for your device to be supported](#ask-for-device-support)
## Supported bikes
|Manufacturer|Model|Speed|RPM|Power|HRM|Resistence Control|
|------------|-----|------------|---|-----|---|------------------|
|[Echelon](22_devices_detail.md#echelon)|Connect Sport|Yes|Yes|Yes|Yes|N/A|
|[Sportstech](22_devices_detail.md#sportstech)|ESX500|Yes|Yes|Yes|Yes|Yes|
## Supported treadmills
|Manufacturer|Model|Speed|HRM|Inclinaison Control| Speed control|
|------------|-----|------------|---|-------------------|--------------|
|Domyos|Intense Run|Yes|Yes|Yes|Yes|
|Domyos|T900c|Yes|Yes|Yes|Yes|
|Toorx|TRX Route Key|Yes|Yes|Yes|Yes|
# Ask for device support
You can ask for supporting a device by opening an issue and following these steps.
@@ -36,7 +50,7 @@ An android device is required for this operation.
8. Disable the option Enable Bluetooth HCI snoop log
9. in Developer Options: Bug report->Full report
10. wait a random amount of time (10-20 seconds)
11. A notification will appear at the top of the device. Click on it, share, email it to yourself. If it doesn't appear you need to use ADB to pull the file from the phone itself
11. A notification will appear at the top of the device. Click on it, share, email it to yourself
12. You'll get a zip file with the entire report. In the FS/Data/Log/bt directory of the zipfile is the file you want.
13. attach the log file in a new issue with a short description of the steps you did in the app when you used it

View File

@@ -26,5 +26,5 @@ You can have ae true 4k video stream while you ride ("extreme quality" setting)
The application do not read the FTMS value. It is required to start the application with `-heart-service` or `bike_heartrate_service: true` in settings.
### Resistance management
You can adjust resistance using arrows [up and down](img/21_zwift-resistance-buttons.jpg) rom the riding screen.
You can adjust resistence using arrows [up and down](img/21_zwift-resistance-buttons.jpg) rom the riding screen.

View File

@@ -21,34 +21,32 @@ Please refer to this article for more information under [QML Operations](https:/
This is the list of settings available in the application. These settings needs to be appended to the binary command line.
*Example :* `sudo ./qdomyos-zwift -no-gui` for disabling any graphical interface.
| **Option** | **Type** | **Default** | **Function** |
|:------------------------------|:---------|:------------|:-----------------------------------------------------------------------------|
| -no-gui | Boolean | False | Disable GUI |
| -qml | Boolean | True | Enables the QML interface |
| -noqml | Boolean | False | Enables the NativeQT interface |
| -miles | Boolean | False | Switches to Imperial Units System |
| -no-console | Boolean | False | Not in use |
| -test-resistance | Boolean | False | |
| -no-log | Boolean | False | Disable Logging |
| -no-write-resistance | Boolean | False | Disable resistance instructions from QZ to your fitness equipment |
| -no-heart-service | Boolean | False | Do not simulate external HR monitor, use only FTMS |
| -heart-service | Boolean | True | Simulate HR service (required for applications not reading FTMS) |
| -only-virtualbike | Boolean | False | |
| -only-virtualtreadmill | Boolean | False | |
| -no-reconnection | Boolean | False | QZ will not try to reconnect your fitness equipement if enabled |
| -bluetooth-relaxed | Boolean | False | In case of deconnections from QZ to your fitness equipement |
| -bike-cadence-sensor | Boolean | False | |
| -bike-power-sensor | Boolean | False | |
| -battery-service | Boolean | False | |
| -service-changed | Boolean | False | |
| -bike-wheel-revs | Boolean | False | |
| -run-cadence-sensor | Boolean | False | |
| -nordictrack-10-treadmill | Boolean | False | Enable NordicTrack compatibility mode |
| -train | String | | Force training program |
| -name | String | | Force bluetooth device name (if QZ struggles finding your fitness equipment) |
| -poll-device-time | Int | 200 (ms) | Frequency to refresh information from QZ to Fitness equipment |
| -bike-resistance-gain | Int | | Adjust resistance from the fitness application |
| -bike-resistance-offset | Int | | Set another resistance point than default |
| **Option** | **Type** | **Default** | **Function** |
|:------------------------|:---------|:------------|:-----------------------------------------------------------------------------|
| -no-gui | Boolean | False | Disable GUI |
| -qml | Boolean | False | Enables the QML interface |
| -miles | Boolean | False | Swithes to Imperial Units System |
| -no-console | Boolean | False | Not in use |
| -test-resistance | Boolean | False | |
| -no-log | Boolean | False | Disable Logging |
| -no-write-resistance | Boolean | False | Disable resistance instructions from QZ to your fitness equipment |
| -no-heart-service | Boolean | False | Do not simulate external HR monitor, use only FTMS |
| -heart-service | Boolean | True | Simulate HR service (required for applications not reading FTMS) |
| -only-virtualbike | Boolean | False | |
| -only-virtualtreadmill | Boolean | False | |
| -no-reconnection | Boolean | False | QZ will not try to reconnect your fitness equipement if enabled |
| -bluetooth-relaxed | Boolean | False | In case of deconnections from QZ to your fitness equipement |
| -bike-cadence-sensor | Boolean | False | |
| -bike-power-sensor | Boolean | False | |
| -battery-service | Boolean | False | |
| -service-changed | Boolean | False | |
| -bike-wheel-revs | Boolean | False | |
| -run-cadence-sensor | Boolean | False | |
| -train | String | | Force training program |
| -name | String | | Force bluetooth device name (if QZ struggles finding your fitness equipment) |
| -poll-device-time | Int | 200 (ms) | Frequency to refresh informations from QZ to Fitness equipment |
| -bike-resistance-gain | Int | | Adjust resistance from the fitness application |
| -bike-resistance-offset | Int | | Set another resistance point than default |

View File

@@ -1,365 +0,0 @@
# QDomyos-Zwift WebSocket API Installation & Operation guide
# Installation
## About
The QDomyos-Zwift WebSocket API can be installed from source on Linux, Raspberry Pi (4, 3, zero W), macOS, Android and IOS.
However, this guide will only focus on the Linux (Debian 11) Installation and Raspberry Pi cause there are the most useful case in headless control.
If you already install the Web Socket, feel free to [skip to the Usage section](#usage).
## Requirement
To Install QDomyos-Zwift with WebSocket API you will need Qt 5.12.2+ and the following modules :
- Qt Bluetooth
- Qt Widgets
- Qt Positioning
- Qt XML
- Qt Charts
- Qt Network
- Qt Network Authorization
- Qt WebSockets
- Qt Assistant
Unfortunately under Debian 11 (or Raspbian 11) the Qt 5 packages are not recent enough for compilation however this guide will explain how to manually compile the latest version of Qt (5.12.12)
If you already had Qt 5.12.2 or more, feel free to [skip to Install Qt Httpserver](#install-qt-httpserver).
## Install Qt 5.12.2
*If you compile for a Raspberry Pi Zero, it's* ***faster and easy*** *to do all the Raspberry Pi task on a Raspberry Pi 4 and after copy compiled binary files toe the Raspberry Pi Zero*
For more info on the steps [please refer to the source](#source)
Before do anything. Make sure all your packages are updated :
```bash
apt update && apt upgrade # this is very important on raspberry pi: you need the bluetooth firmware updated!
```
After download last version of Qt Source and extract them :
```bash
wget https://download.qt.io/official_releases/qt/5.12/5.12.12/single/qt-everywhere-src-5.12.12.tar.xz
```
If you compile for a Raspberry Pi you will need the Raspberry Pi Qt Configuration for raspberry pi and install it in the source :
```bash
git clone https://github.com/oniongarlic/qt-raspberrypi-configuration.git
cd qt-raspberrypi-configuration && make install DESTDIR=../qt-everywhere-src-5.12.12
```
Install the bare minimum required development packages for building Qt 5 with apt :
```bash
apt install build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libinput-dev libxkbcommon-dev libsqlite3-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev
```
*For raspberry Pi install `libraspberrypi-dev` package* :
```bash
apt install libraspberrypi-dev
```
Now install all required development packages for building all Qt 5 modules:
```bash
apt install bluez libgbm-dev
apt install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver
apt install libegl1-mesa libegl1-mesa-dev libgles2-mesa libgles2-mesa-dev
apt install wiringpi libnfc-bin libnfc-dev fonts-texgyre libts-dev
apt install libbluetooth-dev bluez-tools gstreamer1.0-plugins* libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libopenal-data libopenal1 libopenal-dev pulseaudio
apt install libgstreamer*-dev
apt install gstreamer*-dev
apt install libasound2-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools libgstreamer-plugins-*
apt install qtdeclarative5-dev
apt install libvlc-dev
```
On Raspbian Stretch/Buster/Bullseye the OpenGL library files have been renamed so that they wouldn't conflict with Mesa installed ones. Unfortunately Qt configure script is still looking for the old names.
So ***on your target Raspberry Pi*** you need to symlink those file to make sure Qt run correctly.
```bash
ln -s /usr/lib/arm-linux-gnueabihf/libGLESv2.so /usr/lib/libbrcmGLESv2.so
ln -s /usr/lib/arm-linux-gnueabihf/libEGL.so /usr/lib/libbrcmEGL.so
```
Now all dependency are installed. It's time to create build folder and compiled.
```bash
mkdir build
cd build
# For Raspberry Pi Zero or 3
PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig ../qt-everywhere-src-5.12.12/configure -platform linux-rpi-g++ -v -opengl es2 -eglfs -no-gtk -opensource -confirm-license -release -reduce-exports -force-pkg-config -nomake examples -no-compile-examples -skip qtwayland -skip qtwebengine -no-feature-geoservices_mapboxgl -qt-pcre -no-pch -ssl -evdev -system-freetype -fontconfig -glib -prefix /opt/Qt/5.12.12 -qpa eglfs
CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" make -j3 # Remove -j3 if you compiled directly on Raspberry Pi Zero
# For Raspberry Pi 4
PKG_CONFIG_LIBDIR=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig ../qt-everywhere-src-5.12.12/configure -platform linux-rpi4-v3d-g++ -v -opengl es2 -eglfs -no-gtk -opensource -confirm-license -release -reduce-exports -force-pkg-config -nomake examples -no-compile-examples -skip qtwayland -skip qtwebengine -no-feature-geoservices_mapboxgl -qt-pcre -no-pch -ssl -evdev -system-freetype -fontconfig -glib -prefix /opt/Qt/5.12.12 -qpa eglfs
CFLAGS="-march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8" make -j3
# For Debian 11 x64 (Not tested)
../qt-everywhere-src-5.12.12/configure -v -opengl es2 -eglfs -no-gtk -opensource -confirm-license -release -reduce-exports -force-pkg-config -nomake examples -no-compile-examples -skip qtwayland -skip qtwebengine -no-feature-geoservices_mapboxgl -qt-pcre -no-pch -ssl -evdev -system-freetype -fontconfig -glib -prefix /opt/Qt/5.12.12 -qpa eglfs
make
```
Finally, if you cross compiled you can transfer the build folder to other machine and then just run as root in the build folder :
```bash
make install
```
# Install Qt Httpserver
Like explain in PR #252, to make work the Http Server you will need to manually compile `qthttpserver` module.
For that just run following commands in your home directory :
```bash
cd ~
git clone https://github.com/qt-labs/qthttpserver
cd ~/qthttpserver/src/3rdparty/http-parser
wget https://raw.githubusercontent.com/nodejs/http-parser/main/http_parser.h
wget https://raw.githubusercontent.com/nodejs/http-parser/main/http_parser.c
cd ~/qthttpserver/src
qmake # Please note if you compiled Qt you need to specify /opt/Qt/5.12.12/bin/qmake
make
# Wait...
sudo make install
```
***You have successfully installed Qt Httpserver***
# Install QDomyos-Zwift
If you already compile QDomyos-Zwift and you just compiled a new version of Qt.
Please delete the whole QDomyos-Zwift folder and restart from scratch to prevent linking issues.
```bash
cd ~
git clone https://github.com/cagnulein/qdomyos-zwift.git
cd ~/qdomyos-zwift
git submodule update --init ~/qdomyos-zwift/src/smtpclient/
cd ~/qdomyos-zwift/src
qmake # Please note if you compiled Qt you need to specify /opt/Qt/5.12.12/bin/qmake
make -j4 # Remove -j4 if you compiled on Raspberry Pi Zero
```
Now installed you need to compile like say in PR #252 and issue #572 template/debug in the same directory of source file of QDomyos-Zwift.
```bash
cp -r ~/qdomyos-zwift/src/templates/debug ~/qdomyos-zwift/src/.
cp -r ~/qdomyos-zwift/src/templates/debug/* ~/qdomyos-zwift/src/.
```
Last if you can't run QML version (probably because you don't had a X11 Server.) you need to manually edit the configuration file in `/root/.config/Roberto Viola/qDomyos-Zwift.conf` and add :
```
template_inner_QZWS_enabled=true
template_inner_QZWS_folders=:/inner_templates//chartjs
template_inner_QZWS_ips=192.168.1.42
template_inner_QZWS_port=34107
template_inner_QZWS_type=WebServer
```
In this config file we open an HTTP Server on port 34107 with bind to 192.168.1.42 but feel free to change these values.
Finally, ***do not move `qdomyos-zwift` from src folder*** and run it as Root
# Usage
The way that [WebSocket](https://developer.mozilla.org/docs/Web/API/WebSockets_API) work in QDomyos-Zwift is by sending commands and listen events.
## Workout Event
The workout Event is the default message send almost every second by QDomyos-Zwift to inform you which state is your equipment.
Here what is look like :
```json
{
"BIKE_TYPE": 2,
"ELLIPTICAL_TYPE": 4,
"ROWING_TYPE": 3,
"TREADMILL_TYPE": 1,
"UNKNOWN_TYPE": 0,
"deviceId": "0B:54:49:D1:BC:DA",
"deviceName": "Domyos-TC-0314",
"deviceRSSI": 0,
"deviceType": 1,
"deviceConnected": false,
"devicePaused": false,
"elapsed_s": 0,
"elapsed_m": 0,
"elapsed_h": 0,
"pace_s": 0,
"pace_m": 0,
"pace_h": 0,
"moving_s": 0,
"moving_m": 0,
"moving_h": 0,
"speed": 0,
"speed_avg": 0,
"calories": 0,
"distance": 0,
"heart": 0,
"heart_avg": 0,
"heart_max": 0,
"jouls": 0,
"elevation": 0,
"difficult": 1,
"watts": 0,
"watts_avg": 0,
"watts_max": 0,
"kgwatts": 0,
"kgwatts_avg": 0,
"kgwatts_max": 0,
"workoutName": "",
"workoutStartDate": "",
"instructorName": "",
"latitude": null,
"longitude": null,
"nickName": "N/A",
"inclination": 0,
"inclination_avg": 0
}
```
## Commands
To send commands you will need to send a socket message in JSON format like :
```json
{
"msg": "pause"
}
```
which `msg` is always the name of the command. Command also return on WebSocket message like to acknowledge command :
```json
{
"msg": "R_pause"
}
```
Here is a list of the most "useful" commands
### Start
#### Description :
Allows you to start the bike / treadmill (Reset Timer if bike / treadmill is stopped)
#### Send :
```json
{
"msg": "start"
}
```
#### Response :
```json
{
"msg": "R_start"
}
```
### Pause
#### Description :
Allows you to stop (pause) the bike / treadmill without reset timer.
#### Send :
```json
{
"msg": "pause"
}
```
#### Response :
```json
{
"msg": "R_pause"
}
```
### Stop
#### Description :
Allows you to stop the bike / treadmill and reset timer.
#### Send :
```json
{
"msg": "stop"
}
```
#### Response :
```json
{
"msg": "R_stop"
}
```
### SetSpeed
#### Description :
Allows you to control the treadmill speed.
#### Send :
```json
{
"msg": "setspeed",
"content": {
"value": 8.0
}
}
```
#### Response :
```json
{
"msg": "R_setspeed",
"content": {
"value": 8.0
}
}
```
### SetResistance
#### Description :
Allows you to control the resistance bike or the treadmill incline.
#### Send :
```json
{
"msg": "setresistance",
"content": {
"value": 8.0
}
}
```
#### Response :
```json
{
"msg": "R_setresistance",
"content": {
"value": 8.0
}
}
```
### SetFanSpeed
#### Description :
Allows you to control the fan bike / treadmill speed.
#### Send :
```json
{
"msg": "setfanspeed",
"content": {
"value": 8.0
}
}
```
#### Response :
```json
{
"msg": "R_setfanspeed",
"content": {
"value": 8.0
}
}
```
# Source
How compile Qt 5.12.10 on Raspberry Pi : https://www.tal.org/tutorials/building-qt-512-raspberry-pi
How cross compile Qt 5.12.5 on Raspberry Pi (in French) : https://wiki.logre.eu/index.php/Cross-compilation_Qt_5.12.5_pour_Raspberry_Pi
Issue [REQ] Add to qdomyos an API for remote access to treadmill #572
PR "Templated" connections and Web server #252

View File

@@ -1,272 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2017 Bluetooth SIG, Inc. All rights reserved.-->
<Characteristic xsi:noNamespaceSchemaLocation="http://schemas.bluetooth.org/Documents/characteristic.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Cross Trainer Data"
type="org.bluetooth.characteristic.cross_trainer_data" uuid="2ACE"
last-modified="2017-02-14" approved="Yes">
<InformativeText>
<Summary>The Cross Trainer Data characteristic is used to send
training-related data to the Client from a cross trainer
(Server).</Summary>
</InformativeText>
<Value>
<Field name="Flags">
<Requirement>Mandatory</Requirement>
<Format>24bit</Format>
<BitField>
<Bit index="0" size="1" name="More Data">
<Enumerations>
<Enumeration key="0" value="False" requires="C1" />
<Enumeration key="1" value="True" />
</Enumerations>
</Bit>
<Bit index="1" size="1" name="Average Speed present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C2" />
</Enumerations>
</Bit>
<Bit index="2" size="1" name="Total Distance Present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C3" />
</Enumerations>
</Bit>
<Bit index="3" size="1" name="Step Count present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C4" />
</Enumerations>
</Bit>
<Bit index="4" size="1" name="Stride Count present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C5" />
</Enumerations>
</Bit>
<Bit index="5" size="1" name="Elevation Gain present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C6" />
</Enumerations>
</Bit>
<Bit index="6" size="1"
name="Inclination and Ramp Angle Setting present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C7" />
</Enumerations>
</Bit>
<Bit index="7" size="1" name="Resistance Level Present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C8" />
</Enumerations>
</Bit>
<Bit index="8" size="1" name="Instantaneous Power present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C9" />
</Enumerations>
</Bit>
<Bit index="9" size="1" name="Average Power present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C10" />
</Enumerations>
</Bit>
<Bit index="10" size="1" name="Expended Energy present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C11" />
</Enumerations>
</Bit>
<Bit index="11" size="1" name="Heart Rate present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C12" />
</Enumerations>
</Bit>
<Bit index="12" size="1"
name="Metabolic Equivalent present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C13" />
</Enumerations>
</Bit>
<Bit index="13" size="1" name="Elapsed Time present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C14" />
</Enumerations>
</Bit>
<Bit index="14" size="1" name="Remaining Time present">
<Enumerations>
<Enumeration key="0" value="False" />
<Enumeration key="1" value="True" requires="C15" />
</Enumerations>
</Bit>
<Bit index="15" size="1" name="Movement Direction">
<Enumerations>
<Enumeration key="0" value="Forward" />
<Enumeration key="1" value="Backward" />
</Enumerations>
</Bit>
<ReservedForFutureUse index="16" size="8" />
</BitField>
</Field>
<Field name="Instantaneous Speed">
<InformativeText>Kilometer per hour with a resolution of
0.01</InformativeText>
<Requirement>C1</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.velocity.kilometre_per_hour</Unit>
<DecimalExponent>-2</DecimalExponent>
</Field>
<Field name="Average Speed">
<InformativeText>Kilometer per hour with a resolution of
0.01</InformativeText>
<Requirement>C2</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.velocity.kilometre_per_hour</Unit>
<DecimalExponent>-2</DecimalExponent>
</Field>
<Field name="Total Distance">
<InformativeText>Meters with a resolution of
1</InformativeText>
<Requirement>C3</Requirement>
<Format>uint24</Format>
<Unit>org.bluetooth.unit.length.metre</Unit>
</Field>
<Field name="Step Per Minute">
<InformativeText>Step/minute with a resolution of
1</InformativeText>
<Requirement>C4</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.step_per_minute</Unit>
</Field>
<Field name="Average Step Rate">
<InformativeText>Step/minute with a resolution of
1</InformativeText>
<Requirement>C4</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.step_per_minute</Unit>
</Field>
<Field name="Stride Count">
<InformativeText>Unitless with a resolution of
0.1</InformativeText>
<Requirement>C5</Requirement>
<Format>uint16</Format>
<DecimalExponent>-1</DecimalExponent>
<Unit>org.bluetooth.unit.unitless</Unit>
</Field>
<Field name="Positive Elevation Gain">
<InformativeText>Meters with a resolution of
1</InformativeText>
<Requirement>C6</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.length.metre</Unit>
</Field>
<Field name="Negative Elevation Gain">
<InformativeText>Meters with a resolution of
1</InformativeText>
<Requirement>C6</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.length.metre</Unit>
</Field>
<Field name="Inclination">
<InformativeText>Percent with a resolution of
0.1</InformativeText>
<Requirement>C7</Requirement>
<Format>sint16</Format>
<Unit>org.bluetooth.unit.percentage</Unit>
<DecimalExponent>-1</DecimalExponent>
</Field>
<Field name="Ramp Angle Setting">
<InformativeText>Degree with a resolution of
0.1</InformativeText>
<Requirement>C7</Requirement>
<Format>sint16</Format>
<Unit>org.bluetooth.unit.plane_angle.degree</Unit>
<DecimalExponent>-1</DecimalExponent>
</Field>
<Field name="Resistance Level">
<InformativeText>Unitless with a resolution of
0.1</InformativeText>
<Requirement>C8</Requirement>
<Format>sint16</Format>
<DecimalExponent>-1</DecimalExponent>
<Unit>org.bluetooth.unit.unitless</Unit>
</Field>
<Field name="Instantaneous Power">
<InformativeText>Watts with a resolution of
1</InformativeText>
<Requirement>C9</Requirement>
<Format>sint16</Format>
<Unit>org.bluetooth.unit.power.watt</Unit>
</Field>
<Field name="Average Power">
<InformativeText>Watts with a resolution of
1</InformativeText>
<Requirement>C10</Requirement>
<Format>sint16</Format>
<Unit>org.bluetooth.unit.power.watt</Unit>
</Field>
<Field name="Total Energy">
<InformativeText>Kilo Calorie with a resolution of
1</InformativeText>
<Requirement>C11</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.energy.kilogram_calorie</Unit>
</Field>
<Field name="Energy Per Hour">
<InformativeText>Kilo Calorie with a resolution of
1</InformativeText>
<Requirement>C11</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.energy.kilogram_calorie</Unit>
</Field>
<Field name="Energy Per Minute">
<InformativeText>Kilo Calorie with a resolution of
1</InformativeText>
<Requirement>C11</Requirement>
<Format>uint8</Format>
<Unit>org.bluetooth.unit.energy.kilogram_calorie</Unit>
</Field>
<Field name="Heart Rate">
<InformativeText>Beats per minute with a resolution of
1</InformativeText>
<Requirement>C12</Requirement>
<Format>uint8</Format>
<Unit>org.bluetooth.unit.period.beats_per_minute</Unit>
</Field>
<Field name="Metabolic Equivalent">
<InformativeText>Metabolic Equivalent with a resolution of
0.1</InformativeText>
<Requirement>C13</Requirement>
<Format>uint8</Format>
<DecimalExponent>-1</DecimalExponent>
<Unit>org.bluetooth.unit.metabolic_equivalent</Unit>
</Field>
<Field name="Elapsed Time">
<InformativeText>Second with a resolution of
1</InformativeText>
<Requirement>C14</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.time.second</Unit>
</Field>
<Field name="Remaining Time">
<InformativeText>Second with a resolution of
1</InformativeText>
<Requirement>C15</Requirement>
<Format>uint16</Format>
<Unit>org.bluetooth.unit.time.second</Unit>
</Field>
</Value>
<Note>The fields in the above table, reading from top to bottom,
are shown in the order of LSO to MSO, where LSO = Least
Significant Octet and MSO = Most Significant Octet. The Least
Significant Octet represents the eight bits numbered 0 to
7.</Note>
</Characteristic>

View File

@@ -1,6 +0,0 @@
copy icons\iOS\iTunesArtwork@2x.png build-qdomyos-zwift-Qt_5_15_2_for_UWP_64bit_MSVC_2019-Release\release
del build-qdomyos-zwift-Qt_5_15_2_for_UWP_64bit_MSVC_2019-Release\release\qz.appx
cd build-qdomyos-zwift-Qt_5_15_2_for_UWP_64bit_MSVC_2019-Release\release
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\makeappx.exe" pack /d . /p qz
explorer build-qdomyos-zwift-Qt_5_15_2_for_UWP_64bit_MSVC_2019-Release\release
pause

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -3,5 +3,5 @@ QMAKE_PRO_INPUT = httpserver.pro
QMAKE_PRL_TARGET = libQt5HttpServer_arm64-v8a.so
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-21 shared cross_compile shared release android linux unix posix gcc clang llvm copy_dir_files cross_compile compile_examples enable_new_dtags neon precompile_header prefix_build force_independent force_bootstrap builtin_testdata utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib arm64-v8a Arm64-v8aBuild Arm64-v8a build_pass qtquickcompiler arm64-v8a Arm64-v8aBuild Arm64-v8a build_pass relative_qt_rpath git_build target_qt c++11 strict_c++ c++14 c++1z c99 c11 hide_symbols qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath qt_android_deps no_linker_version_script create_pc create_libtool arm64-v8a Arm64-v8aBuild Arm64-v8a build_pass have_target dll armeabi-v7a_and_arm64-v8a_and_x86_and_x86_64 build_all exclusive_builds multi_android_abi no_autoqmake thread moc resources
QMAKE_PRL_VERSION = 5.12.0
QMAKE_PRL_LIBS = C:/Qt/5.15.2/android/lib/libQt5SslServer_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Network_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Core_arm64-v8a.so
QMAKE_PRL_LIBS_FOR_CMAKE = C:/Qt/5.15.2/android/lib/libQt5SslServer_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Network_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Core_arm64-v8a.so;
QMAKE_PRL_LIBS = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Network_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_arm64-v8a.so C:/Qt/5.15.2/android/lib/libQt5Core_arm64-v8a.so
QMAKE_PRL_LIBS_FOR_CMAKE = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Network_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_arm64-v8a.so;C:/Qt/5.15.2/android/lib/libQt5Core_arm64-v8a.so;

View File

@@ -3,5 +3,5 @@ QMAKE_PRO_INPUT = httpserver.pro
QMAKE_PRL_TARGET = libQt5HttpServer_armeabi-v7a.so
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-21 shared cross_compile shared release android linux unix posix gcc clang llvm copy_dir_files cross_compile compile_examples enable_new_dtags neon precompile_header prefix_build force_independent force_bootstrap builtin_testdata utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib armeabi-v7a Armeabi-v7aBuild Armeabi-v7a build_pass optimize_size qtquickcompiler armeabi-v7a Armeabi-v7aBuild Armeabi-v7a build_pass relative_qt_rpath git_build target_qt c++11 strict_c++ c++14 c++1z c99 c11 hide_symbols qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath qt_android_deps no_linker_version_script create_pc create_libtool armeabi-v7a Armeabi-v7aBuild Armeabi-v7a build_pass have_target dll armeabi-v7a_and_arm64-v8a_and_x86_and_x86_64 build_all exclusive_builds multi_android_abi no_autoqmake thread moc resources
QMAKE_PRL_VERSION = 5.12.0
QMAKE_PRL_LIBS = C:/Qt/5.15.2/android/lib/libQt5SslServer_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Network_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Core_armeabi-v7a.so
QMAKE_PRL_LIBS_FOR_CMAKE = C:/Qt/5.15.2/android/lib/libQt5SslServer_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Network_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Core_armeabi-v7a.so;
QMAKE_PRL_LIBS = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Network_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_armeabi-v7a.so C:/Qt/5.15.2/android/lib/libQt5Core_armeabi-v7a.so
QMAKE_PRL_LIBS_FOR_CMAKE = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Network_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_armeabi-v7a.so;C:/Qt/5.15.2/android/lib/libQt5Core_armeabi-v7a.so;

View File

@@ -3,5 +3,5 @@ QMAKE_PRO_INPUT = httpserver.pro
QMAKE_PRL_TARGET = libQt5HttpServer_x86.so
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-21 shared cross_compile shared release android linux unix posix gcc clang llvm copy_dir_files cross_compile compile_examples enable_new_dtags neon precompile_header prefix_build force_independent force_bootstrap builtin_testdata utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib x86 X86Build X86 build_pass qtquickcompiler x86 X86Build X86 build_pass relative_qt_rpath git_build target_qt c++11 strict_c++ c++14 c++1z c99 c11 hide_symbols qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath qt_android_deps no_linker_version_script create_pc create_libtool x86 X86Build X86 build_pass have_target dll armeabi-v7a_and_arm64-v8a_and_x86_and_x86_64 build_all exclusive_builds multi_android_abi no_autoqmake thread moc resources
QMAKE_PRL_VERSION = 5.12.0
QMAKE_PRL_LIBS = C:/Qt/5.15.2/android/lib/libQt5SslServer_x86.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86.so C:/Qt/5.15.2/android/lib/libQt5Network_x86.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86.so C:/Qt/5.15.2/android/lib/libQt5Core_x86.so
QMAKE_PRL_LIBS_FOR_CMAKE = C:/Qt/5.15.2/android/lib/libQt5SslServer_x86.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86.so;C:/Qt/5.15.2/android/lib/libQt5Network_x86.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86.so;C:/Qt/5.15.2/android/lib/libQt5Core_x86.so;
QMAKE_PRL_LIBS = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_x86.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86.so C:/Qt/5.15.2/android/lib/libQt5Network_x86.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86.so C:/Qt/5.15.2/android/lib/libQt5Core_x86.so
QMAKE_PRL_LIBS_FOR_CMAKE = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_x86.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86.so;C:/Qt/5.15.2/android/lib/libQt5Network_x86.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86.so;C:/Qt/5.15.2/android/lib/libQt5Core_x86.so;

View File

@@ -3,5 +3,5 @@ QMAKE_PRO_INPUT = httpserver.pro
QMAKE_PRL_TARGET = libQt5HttpServer_x86_64.so
QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl android_install unversioned_soname unversioned_libname plugin_with_soname android_deployment_settings clang_pch_style android-21 shared cross_compile shared release android linux unix posix gcc clang llvm copy_dir_files cross_compile compile_examples enable_new_dtags neon precompile_header prefix_build force_independent force_bootstrap builtin_testdata utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions explicitlib x86_64 X86_64Build X86_64 build_pass qtquickcompiler x86_64 X86_64Build X86_64 build_pass relative_qt_rpath git_build target_qt c++11 strict_c++ c++14 c++1z c99 c11 hide_symbols qt_install_headers need_fwd_pri qt_install_module create_cmake compiler_supports_fpmath qt_android_deps no_linker_version_script create_pc create_libtool x86_64 X86_64Build X86_64 build_pass have_target dll armeabi-v7a_and_arm64-v8a_and_x86_and_x86_64 build_all exclusive_builds multi_android_abi no_autoqmake thread moc resources
QMAKE_PRL_VERSION = 5.12.0
QMAKE_PRL_LIBS = C:/Qt/5.15.2/android/lib/libQt5SslServer_x86_64.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Network_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Core_x86_64.so
QMAKE_PRL_LIBS_FOR_CMAKE = C:/Qt/5.15.2/android/lib/libQt5SslServer_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Network_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Core_x86_64.so;
QMAKE_PRL_LIBS = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_x86_64.so C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Network_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86_64.so C:/Qt/5.15.2/android/lib/libQt5Core_x86_64.so
QMAKE_PRL_LIBS_FOR_CMAKE = D:/Dati/GoogleDrive/cpp/build-qthttpserver-Android_Qt_5_15_2_Clang_Multi_Abi-Release/lib/libQt5SslServer_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5WebSockets_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Network_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Concurrent_x86_64.so;C:/Qt/5.15.2/android/lib/libQt5Core_x86_64.so;

View File

@@ -1,18 +0,0 @@
TEMPLATE = subdirs
CONFIG+=ordered
!android: {
SUBDIRS = \
src/qdomyos-zwift-lib.pro \
src/qdomyos-zwift.pro \
tst/qdomyos-zwift-tests.pro
tst.depends = src/qdomyos-zwift-lib.pro
}
android: {
SUBDIRS = \
src/qdomyos-zwift.pro
}

View File

@@ -1018,7 +1018,7 @@ public class QtBluetoothLE {
/*
* Already executed in GattCallback so executed by the HandlerThread. No need to
* post it to the Handler.
* post it to the Hander.
*/
private void scheduleMtuExchange() {
ReadWriteJob newJob = new ReadWriteJob();

View File

@@ -385,11 +385,11 @@ QT_USE_NAMESPACE
}
[uuids addObject:nsUuid];
// With the latest CoreBluetooth, we can synchronously retrieve peripherals:
// With the latest CoreBluetooth, we can synchronously retrive peripherals:
QT_BT_MAC_AUTORELEASEPOOL;
NSArray *const peripherals = [manager retrievePeripheralsWithIdentifiers:uuids];
if (!peripherals || peripherals.count != 1) {
qCWarning(QT_BT_OSX) << "failed to retrieve a peripheral";
qCWarning(QT_BT_OSX) << "failed to retrive a peripheral";
if (notifier)
emit notifier->CBManagerError(QLowEnergyController::UnknownRemoteDeviceError);
return;
@@ -648,7 +648,7 @@ QT_USE_NAMESPACE
servicesToDiscoverDetails.removeAll(serviceUuid);
const NSUInteger nHandles = qt_countGATTEntries(service);
Q_ASSERT_X(nHandles, Q_FUNC_INFO, "unexpected number of GATT entries");
Q_ASSERT_X(nHandles, Q_FUNC_INFO, "unexpected number of GATT entires");
const QLowEnergyHandle maxHandle = std::numeric_limits<QLowEnergyHandle>::max();
if (nHandles >= maxHandle || lastValidHandle > maxHandle - nHandles) {
@@ -1058,7 +1058,7 @@ QT_USE_NAMESPACE
// TODO: test that we NEVER have the same characteristic twice in array!
// At the moment I just protect against this by iterating in a reverse
// order (at least avoiding a potential infinite loop with '-indexOfObject:').
// order (at least avoiding a potential inifite loop with '-indexOfObject:').
NSArray *const cs = service.characteristics;
if (cs.count == 1)
return nil;
@@ -1091,7 +1091,7 @@ QT_USE_NAMESPACE
// TODO: test that we NEVER have the same characteristic twice in array!
// At the moment I just protect against this by iterating in a reverse
// order (at least avoiding a potential infinite loop with '-indexOfObject:').
// order (at least avoiding a potential inifite loop with '-indexOfObject:').
NSArray *const cs = service.characteristics;
if (cs.count == 1)
return nil;
@@ -1597,8 +1597,8 @@ QT_USE_NAMESPACE
} else {
// This is (probably) the result of update notification.
// It's very possible we can have an invalid handle here (0) -
// if something else is wrong (we subscribed for a notification),
// disconnected (but other application is connected) and still receiving
// if something esle is wrong (we subscribed for a notification),
// disconnected (but other application is connected) and still receiveing
// updated values ...
// TODO: this must be properly tested.
if (!chHandle) {

View File

@@ -1,30 +0,0 @@
<Package xmlns=\"http://schemas.microsoft.com/appx/manifest/foundation/windows10\" xmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\" xmlns:uap=\"http://schemas.microsoft.com/appx/manifest/uap/windows10\" xmlns:uap3=\"http://schemas.microsoft.com/appx/manifest/uap/windows10/3\" xmlns:mobile=\"http://schemas.microsoft.com/appx/manifest/mobile/windows10\" xmlns:iot=\"http://schemas.microsoft.com/appx/manifest/iot/windows10\" IgnorableNamespaces=\"uap uap3 mp mobile iot\">
<Identity Name=\"35433QZdiRobertoViola.QZFitness\" Publisher=\"CN=CA24F902-6882-40DF-B1E3-2E1B81CD730C\" Version=\"2.10.83.0\" ProcessorArchitecture=\"x64\"/>
<Properties>
<DisplayName>QZ Fitness</DisplayName>
<PublisherDisplayName>QZ di Roberto Viola</PublisherDisplayName>
<Description>QZ Fitness syncs fitness bikes, ellipticals, rowers, and treadmills to training apps like Echelon, Peloton, Zwift and Strava providing you with an unparalleled level of connectivity that keeps you informed and in control of your workouts</Description>
<Logo>50.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.19041.0\" MaxVersionTested=\"10.0.19041.0\"/>
<PackageDependency Name=\"Microsoft.VCLibs.140.00\" MinVersion=\"14.0.0.0\" Publisher=\"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US\"/>
</Dependencies>
<Resources>
<Resource Language=\"en\"/>
</Resources>
<Applications>
<Application Id=\"App\" Executable=\"qdomyos-zwift.exe\" EntryPoint=\"qdomyos-zwift.App\">
<uap:VisualElements DisplayName=\"qdomyos-zwift\" Description=\"Default package description\" BackgroundColor=\"green\" Square150x150Logo=\"150.png\" Square44x44Logo=\"44.png\">
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name=\"internetClient\"/>
<Capability Name=\"internetClientServer\"/>
<Capability Name=\"privateNetworkClientServer\"/>
<DeviceCapability Name=\"bluetooth.genericAttributeProfile\"/>
<DeviceCapability Name=\"bluetooth.rfcomm\"/>
<DeviceCapability Name=\"location\"/>
</Capabilities>
</Package>

View File

@@ -19,19 +19,11 @@ ColumnLayout {
url: "http://localhost:" + settings.value("template_inner_QZWS_port") + "/chartjs/chart.htm"
visible: true
onLoadingChanged: {
if (loadRequest.errorString) {
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

File diff suppressed because it is too large Load Diff

View File

@@ -1,215 +0,0 @@
/*
* Copyright (c) 2009 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// I have consciously avoided putting things like data logging, lap marking,
// intervals or any load management functions in this class. It is restricted
// to controlling an reading telemetry from the device
//
// I expect higher order classes to implement such functions whilst
// other devices (e.g. ANT+ devices) may be implemented with the same basic
// interface
//
// I have avoided a base abstract class at this stage since I am uncertain
// what core methods would be required by say, ANT+ or Tacx devices
#ifndef _Computrainer_h
#define _Computrainer_h 1
#include <QDebug>
#include <QFile>
#include <QMutex>
#include <QString>
#include <QThread>
#ifdef WIN32
#include <windef.h>
#endif
#ifdef WIN32
#include <winbase.h>
#include <windows.h>
#else
#include <sys/ioctl.h>
#include <termios.h> // unix!!
#include <unistd.h> // unix!!
#ifndef N_TTY // for OpenBSD, this is a hack XXX
#define N_TTY 0
#endif
#endif
#ifdef Q_OS_ANDROID
#include "keepawakehelper.h"
#include <QAndroidJniObject>
#endif
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
/* Some CT Microcontroller / Protocol Constants */
/* read timeouts in microseconds */
#define CT_READTIMEOUT 1000
#define CT_WRITETIMEOUT 2000
// message type
#define CT_SPEED 0x01
#define CT_POWER 0x02
#define CT_HEARTRATE 0x03
#define CT_CADENCE 0x06
#define CT_RRC 0x09
#define CT_SENSOR 0x0b
// buttons
#define CT_RESET 0x01
#define CT_F1 0x02
#define CT_F3 0x04
#define CT_PLUS 0x08
#define CT_F2 0x10
#define CT_MINUS 0x20
#define CT_SSS 0x40 // spinscan sync is not a button!
#define CT_NONE 0x80
/* Device operation mode */
#define CT_ERGOMODE 0x01
#define CT_SSMODE 0x02
#define CT_CALIBRATE 0x04
/* UI operation mode */
#define UI_MANUAL 0x01 // using +/- keys to adjust
#define UI_ERG 0x02 // running an erg file!
/* Control status */
#define CT_RUNNING 0x01
#define CT_PAUSED 0x02
/* default operation mode */
#define DEFAULT_MODE CT_ERGOMODE
#define DEFAULT_LOAD 100.00
#define DEFAULT_GRADIENT 2.00
class Computrainer : public QThread {
public:
Computrainer(QObject *parent = 0, QString deviceFilename = 0); // pass device
~Computrainer();
QObject *parent;
// HIGH-LEVEL FUNCTIONS
int start(); // Calls QThread to start
int restart(); // restart after paused
int pause(); // pauses data collection, inbound telemetry is discarded
int stop(); // stops data collection thread
int quit(int error); // called by thread before exiting
bool discover(QString deviceFilename); // confirm CT is attached to device
// SET
void setDevice(QString deviceFilename); // setup the device filename
void setLoad(double load); // set the load to generate in ERGOMODE
void setGradient(double gradient); // set the load to generate in SSMODE
void setMode(int mode,
double load = DEFAULT_LOAD, // set mode to CT_ERGOMODE or CT_SSMODE
double gradient = DEFAULT_GRADIENT);
// GET TELEMETRY AND STATUS
// direct access to class variables is not allowed because we need to use wait conditions
// to sync data read/writes between the run() thread and the main gui thread
bool isCalibrated();
bool isHRConnected();
bool isCADConnected();
void getTelemetry(double &Power, double &HeartRate, double &Cadence, double &Speed, double &RRC, bool &calibration,
int &Buttons, uint8_t *ss, int &Status);
void getSpinScan(double spinData[]);
int getMode();
double getGradient();
double getLoad();
private:
void run(); // called by start to kick off the CT comtrol thread
// 56 bytes comprise of 8 7byte command messages, where
// the last is the set load / gradient respectively
uint8_t ERGO_Command[56], SS_Command[56];
// Utility and BG Thread functions
int openPort();
int closePort();
// Protocol encoding
void prepareCommand(int mode, double value); // sets up the command packet according to current settings
int sendCommand(int mode); // writes a command to the device
int calcCRC(int value); // calculates the checksum for the current command
// Protocol decoding
int readMessage();
void unpackTelemetry(int &b1, int &b2, int &b3, int &buttons, int &type, int &value8, int &value12);
// Mutex for controlling accessing private data
QMutex pvars;
// INBOUND TELEMETRY - all volatile since it is updated by the run() thread
volatile double devicePower; // current output power in Watts
volatile double deviceHeartRate; // current heartrate in BPM
volatile double deviceCadence; // current cadence in RPM
volatile double deviceSpeed; // current speed in KPH
volatile double deviceRRC; // calibrated Rolling Resistance
volatile bool deviceCalibrated; // is it calibrated?
volatile uint8_t spinScan[24]; // SS values only in SS_MODE
volatile int deviceButtons; // Button status
volatile bool deviceHRConnected; // HR jack is connected
volatile bool deviceCADConnected; // Cadence jack is connected
volatile int deviceStatus; // Device status running, paused, disconnected
// OUTBOUND COMMANDS - all volatile since it is updated by the GUI thread
volatile int mode;
volatile double load;
volatile double gradient;
// i/o message holder
uint8_t buf[7];
// device port
QString deviceFilename;
#ifdef WIN32
HANDLE devicePort; // file descriptor for reading from com3
DCB deviceSettings; // serial port settings baud rate et al
#else
int devicePort; // unix!!
struct termios deviceSettings; // unix!!
#endif
// raw device utils
int rawWrite(uint8_t *bytes, int size); // unix!!
int rawRead(uint8_t *bytes, int size); // unix!!
#ifdef Q_OS_ANDROID
QList<jbyte> bufRX;
bool cleanFrame = false;
#endif
};
class CTsleeper : public QThread {
public:
static void msleep(unsigned long msecs); // inherited from QThread
};
#endif // _GC_Computrainer_h

View File

@@ -1,165 +0,0 @@
#include "CrossQFile.h"
#include <QFileInfo>
#ifdef __ANDROID__
#include <jni.h>
#include <QtAndroidExtras/QtAndroid>
#include <QtAndroidExtras/qandroidjnienvironment.h>
#endif
#include <QCoreApplication>
CrossQFile::CrossQFile(const QString& nameOrUri, const bool isUri) : QFile(nameOrUri), isWorkingWithUri(isUri){
#ifdef __ANDROID__
mainActivityObj = QtAndroid::androidActivity();
contentResolverObj = mainActivityObj.callObjectMethod
("getContentResolver","()Landroid/content/ContentResolver;");
checkJenvExceptions();
#endif
}
#ifdef __ANDROID__
bool CrossQFile::checkJenvExceptions() const{
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
env->ExceptionClear();
return true;
}
return false;
}
QAndroidJniObject CrossQFile::parseUriString(const QString& uriString) const{
return QAndroidJniObject::callStaticObjectMethod
("android/net/Uri" , "parse",
"(Ljava/lang/String;)Landroid/net/Uri;",
QAndroidJniObject::fromString(uriString).object());
}
#endif
void CrossQFile::setFileName(const QString& nameOrUri, bool isUri){
QFile::setFileName(nameOrUri);
isWorkingWithUri = isUri;
}
qint64 CrossQFile::size() const{
#ifdef __ANDROID__
if(isWorkingWithUri){
QAndroidJniObject cursorObj {contentResolverObj.callObjectMethod
("query",
"(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;",
parseUriString(fileName()).object(), QAndroidJniObject().object(), QAndroidJniObject().object()
, QAndroidJniObject().object(), QAndroidJniObject().object())};
int sizeIndex {cursorObj.callMethod<jint>
("getColumnIndex","(Ljava/lang/String;)I",
QAndroidJniObject::getStaticObjectField<jstring>
("android/provider/OpenableColumns","SIZE").object())};
cursorObj.callMethod<jboolean>("moveToFirst");
qint64 ret {cursorObj.callMethod<jlong>("getLong","(I)J",sizeIndex)};
if(checkJenvExceptions()){
ret = 0;
}
return ret;
}
#endif
return QFile::size();
}
bool CrossQFile::open(CrossQFile::OpenMode openMode){
#ifdef __ANDROID__
if(isWorkingWithUri){
QAndroidJniObject jopenMode {QAndroidJniObject::fromString("rw")};
switch (openMode){
case QFile::ReadOnly:
jopenMode = QAndroidJniObject::fromString("r");
break;
case QFile::WriteOnly:
jopenMode = QAndroidJniObject::fromString("w");
break;
default:
jopenMode = QAndroidJniObject::fromString("rw");
}
QAndroidJniObject pfdObj{contentResolverObj.callObjectMethod
("openFileDescriptor", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/os/ParcelFileDescriptor;",
parseUriString(fileName()).object(), jopenMode.object())};
int fd{pfdObj.callMethod<jint>("detachFd")};
bool ret {false};
if(QFile::open(fd, openMode)){
ret = true;
}
if(checkJenvExceptions()){
ret = false;
}
return ret;
}
#endif
return QFile::open(openMode);
}
QString CrossQFile::displayName(){
#ifdef __ANDROID__
if(isWorkingWithUri){
QAndroidJniObject cursorObj {contentResolverObj.callObjectMethod
("query",
"(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;",
parseUriString(fileName()).object(), QAndroidJniObject().object(), QAndroidJniObject().object(),
QAndroidJniObject().object(), QAndroidJniObject().object())};
cursorObj.callMethod<jboolean>("moveToFirst");
QAndroidJniObject retObj{cursorObj.callObjectMethod
("getString","(I)Ljava/lang/String;", cursorObj.callMethod<jint>
("getColumnIndex","(Ljava/lang/String;)I",
QAndroidJniObject::getStaticObjectField<jstring>
("android/provider/OpenableColumns","DISPLAY_NAME").object()))};
QString ret {retObj.toString()};
if(checkJenvExceptions()){
ret = "";
}
return ret;
}
#endif
QFileInfo fileInfo(fileName());
return fileInfo.fileName();
}
bool CrossQFile::remove(){
#ifdef __ANDROID__
if(isWorkingWithUri){
bool ret {static_cast<bool>(QAndroidJniObject::callStaticMethod<jboolean>
("android/provider/DocumentsContract", "deleteDocument",
"(Landroid/content/ContentResolver;Landroid/net/Uri;)Z",
contentResolverObj.object(), parseUriString(fileName()).object()))};
if(checkJenvExceptions()){
ret = false;
}
return ret;
}
#endif
return QFile::remove();
}
bool CrossQFile::rename(const QString& newName){
if(!isWorkingWithUri){
return QFile::rename(newName);
}else{
return false;
}
}
bool CrossQFile::exists() const{
#ifdef __ANDROID__
if(isWorkingWithUri){
bool ret {static_cast<bool>(QAndroidJniObject::callStaticMethod<jboolean>
("android/provider/DocumentsContract", "isDocumentUri",
"(Landroid/content/Context;Landroid/net/Uri;)Z",
mainActivityObj.object(), parseUriString(fileName()).object()))};
if(checkJenvExceptions()){
ret = false;
}
return ret;
}
#endif
return QFile::exists();
}

View File

@@ -1,40 +0,0 @@
#ifndef CROSSQFILE_H
#define CROSSQFILE_H
#include <QObject>
#include <QFile>
#include <QSharedPointer>
#ifdef __ANDROID__
#include <QtAndroidExtras/QAndroidJniObject>
#endif
class CrossQFile : public QFile
{
public:
CrossQFile(const QString& nameOrUri, const bool isUri = false);
virtual qint64 size() const override;
//if working with uri, it uses QAndroidjniObject to open the file using the uri.
//otherwise it would act like a normal QFile.
bool open(CrossQFile::OpenMode openMode) override;
bool remove();
//if working with uri, it does nothing.
//otherwise it would act like a normal QFile.
bool rename(const QString& newName);
bool exists() const;
//returns the display name of the file.
QString displayName();
void setFileName(const QString& nameOrUri, bool isUri = false);
private:
bool isWorkingWithUri{false};
#ifdef __ANDROID__
QAndroidJniObject mainActivityObj;
QAndroidJniObject contentResolverObj;
bool checkJenvExceptions() const;
QAndroidJniObject parseUriString(const QString& uriString) const;
#endif
};
#endif // CROSSQFILE_H

View File

@@ -1,267 +0,0 @@
import QtQuick 2.7
import Qt.labs.folderlistmodel 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.0
import QtQuick.Dialogs 1.0
import QtCharts 2.2
import Qt.labs.settings 1.0
import QtPositioning 5.5
import QtLocation 5.6
ColumnLayout {
signal trainprogram_open_clicked(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)
trainprogram_open_clicked(fileDialogTrainProgram.fileUrl)
fileDialogTrainProgram.close()
}
onRejected: {
console.log("Canceled")
fileDialogTrainProgram.close()
}
}
RowLayout{
spacing: 2
anchors.top: parent.top
anchors.fill: parent
ColumnLayout {
spacing: 0
anchors.top: parent.top
anchors.fill: parent
Row
{
spacing: 5
Text
{
text:"Filter"
color: "white"
verticalAlignment: Text.AlignVCenter
}
TextField
{
function updateFilter()
{
var text = filterField.text
var filter = "*"
for(var i = 0; i<text.length; i++)
filter+= "[%1%2]".arg(text[i].toUpperCase()).arg(text[i].toLowerCase())
filter+="*"
print(filter)
folderModel.nameFilters = [filter + ".gpx"]
}
id: filterField
onTextChanged: updateFilter()
}
Button {
anchors.left: mainRect.right
anchors.leftMargin: 5
text: "←"
onClicked: folderModel.folder = folderModel.parentFolder
}
}
ListView {
Layout.fillWidth: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
Layout.maximumWidth: row.left
Layout.minimumHeight: 150
Layout.preferredHeight: parent.height
ScrollBar.vertical: ScrollBar {}
id: list
FolderListModel {
id: folderModel
nameFilters: ["*.gpx"]
folder: "file://" + rootItem.getWritableAppDir() + 'gpx'
showDotAndDotDot: false
showDirs: true
sortField: "Name"
showDirsFirst: true
}
model: folderModel
delegate: Component {
Rectangle {
property alias textColor: fileTextBox.color
width: parent.width
height: 40
color: Material.backgroundColor
z: 1
Item {
id: root
property alias text: fileTextBox.text
property int spacing: 30
width: fileTextBox.width + spacing
height: fileTextBox.height
clip: true
Text {
id: fileTextBox
color: (!folderModel.isFolder(index)?Material.color(Material.Grey):Material.color(Material.Orange))
font.pixelSize: Qt.application.font.pixelSize * 1.6
text: fileName.substring(0, fileName.length-4)
NumberAnimation on x {
Component.onCompleted: {
if(fileName.length > 30) {
running: true;
} else {
stop();
}
}
from: 0; to: -root.width; duration: 20000; loops: Animation.Infinite
}
Text {
x: root.width
text: fileTextBox.text
color: Material.color(Material.Grey)
font.pixelSize: Qt.application.font.pixelSize * 1.6
}
}
}
MouseArea {
anchors.fill: parent
z: 100
onClicked: {
console.log('onclicked ' + index+ " count "+list.count);
if (index == list.currentIndex) {
let fileUrl = folderModel.get(list.currentIndex, 'fileUrl') || folderModel.get(list.currentIndex, 'fileURL');
if (fileUrl && !folderModel.isFolder(list.currentIndex)) {
trainprogram_open_clicked(fileUrl);
popup.open()
} else {
folderModel.folder = fileURL
}
}
else {
if (list.currentItem)
list.currentItem.textColor = Material.color(Material.Grey)
list.currentIndex = index
}
}
}
}
}
highlight: Rectangle {
color: Material.color(Material.Green)
z:3
radius: 5
opacity: 0.4
focus: true
}
focus: true
onCurrentItemChanged: {
let fileUrl = folderModel.get(list.currentIndex, 'fileUrl') || folderModel.get(list.currentIndex, 'fileURL');
if (fileUrl) {
list.currentItem.textColor = Material.color(Material.Yellow)
console.log(fileUrl + ' selected');
trainprogram_preview(fileUrl)
}
}
Component.onCompleted: {
}
}
}
ScrollView {
anchors.top: parent.top
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
//contentHeight: map.height
Layout.preferredHeight: parent.height
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 100
Layout.preferredWidth: 200
Row {
id: row
anchors.fill: parent
Text {
id: distance
width: parent.width
text: rootItem.previewWorkoutDescription
font.pixelSize: 16
color: "white"
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.horizontalCenter: parent.horizontalCenter
}
Plugin {
id: osmMapPlugin
name: "osm"
PluginParameter { name: "osm.useragent"; value: "QZ Fitness" }
}
Map {
height: parent.height - distance.height
width: parent.width
id: map
anchors.top: distance.bottom
plugin: osmMapPlugin
zoomLevel: 14
center: pathController.center
visible: true
MapPolyline {
id: pl
line.width: 3
line.color: 'red'
}
Component.onCompleted: {
console.log("Dimensions: ", width, height)
}
}
function loadPath(){
var lines = []
var elevationGain = 0
var offsetElevation = 0
for(var i = 0; i < pathController.geopath.size(); i++){
if(i > 0 && pathController.geopath.coordinateAt(i).altitude > pathController.geopath.coordinateAt(i-1).altitude)
elevationGain = elevationGain + (pathController.geopath.coordinateAt(i).altitude - pathController.geopath.coordinateAt(i-1).altitude)
lines[i] = pathController.geopath.coordinateAt(i)
}
distance.text = "Distance " + (pathController.geopath.length() / 1000.0).toFixed(1) + " km Elevation Gain: " + elevationGain.toFixed(1) + " meters"
return lines;
}
Connections{
target: pathController
onGeopathChanged: {
pl.path = row.loadPath();
}
onCenterChanged: {
map.center = pathController.center;
}
}
Component.onCompleted: pl.path = loadPath()
}
}
}
Button {
id: searchButton
height: 50
width: parent.width
text: "Other folders"
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'gpx')
fileDialogTrainProgram.visible = true
}
anchors {
bottom: parent.bottom
}
}
}

View File

@@ -1,44 +0,0 @@
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
property string maps_type: "3D"
}
WebView {
id: webView
anchors.fill: parent
url: "http://localhost:" + settings.value("template_inner_QZWS_port") + "/" + (settings.value("maps_type") === "3D" ? "googlemaps" : "maps2d") + "/maps.htm"
visible: true
onLoadingChanged: {
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
}
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

@@ -5,7 +5,6 @@ import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
import QtMultimedia 5.15
HomeForm{
objectName: "home"
@@ -13,10 +12,8 @@ HomeForm{
signal stop_clicked;
signal lap_clicked;
signal peloton_start_workout;
signal peloton_abort_workout;
signal plus_clicked(string name)
signal minus_clicked(string name)
signal largeButton_clicked(string name)
Settings {
id: settings
@@ -29,7 +26,7 @@ HomeForm{
informativeText: "Do you want to follow the resistance? " + rootItem.pelotonProvider
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {rootItem.pelotonAskStart = false; peloton_start_workout();}
onNoClicked: {rootItem.pelotonAskStart = false; peloton_abort_workout();}
onNoClicked: rootItem.pelotonAskStart = false;
visible: rootItem.pelotonAskStart
}
@@ -68,13 +65,8 @@ HomeForm{
onTriggered: popupLap.close();
}
Timer {
id: checkStartStopFromWeb
interval: 200; running: true; repeat: true
onTriggered: {if(rootItem.stopRequested) {rootItem.stopRequested = false; inner_stop(); }}
}
function inner_stop() {
start.onClicked: { start_clicked(); }
stop.onClicked: {
stop_clicked();
rootItem.save_screenshot();
if(CHARTJS)
@@ -82,254 +74,171 @@ HomeForm{
else
stackView.push("ChartsEndWorkout.qml")
}
start.onClicked: { start_clicked(); }
stop.onClicked: {
inner_stop();
}
lap.onClicked: { lap_clicked(); popupLap.open(); popupLapAutoClose.running = true; }
Component.onCompleted: { console.log("completed"); }
GridView {
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: parent
cellWidth: 175 * settings.ui_zoom / 100
cellHeight: 130 * settings.ui_zoom / 100
focus: true
model: appModel
leftMargin: { if(OS_VERSION === "Android") (Screen.width % cellWidth) / 2; else (parent.width % cellWidth) / 2; }
anchors.topMargin: (!window.lockTiles ? rootItem.topBarHeight + 30 : 0)
id: gridView
objectName: "gridview"
onMovementEnded: { headerToolbar.visible = (contentY == 0) || window.lockTiles; }
Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.PortraitOrientation
Screen.onPrimaryOrientationChanged:{
if(OS_VERSION === "Android")
gridView.leftMargin = (Screen.width % cellWidth) / 2;
else
gridView.leftMargin = (parent.width % cellWidth) / 2;
}
// highlight: Rectangle {
// width: 150
// height: 150
// color: "lightsteelblue"
// }
delegate: Item {
id: id1
width: 170 * settings.ui_zoom / 100
height: 125 * settings.ui_zoom / 100
visible: visibleItem
Component.onCompleted: console.log("completed " + objectName)
Behavior on x {
enabled: id1.state != "active"
NumberAnimation { duration: 400; easing.type: Easing.OutBack }
}
Behavior on y {
enabled: id1.state != "active"
NumberAnimation { duration: 400; easing.type: Easing.OutBack }
}
SequentialAnimation on rotation {
NumberAnimation { to: 2; duration: 60 }
NumberAnimation { to: -2; duration: 120 }
NumberAnimation { to: 0; duration: 60 }
running: loc.currentId !== -1 && id1.state !== "active" && window.lockTiles
loops: Animation.Infinite; alwaysRunToEnd: true
}
states: State {
name: "active"; when: loc.currentId === gridId && window.lockTiles
PropertyChanges { target: id1; x: loc.mouseX - gridView.x - width/2; y: loc.mouseY - gridView.y - height/2; scale: 0.5; z: 10 }
}
transitions: Transition { NumberAnimation { property: "scale"; duration: 200} }
Rectangle {
width: 168 * settings.ui_zoom / 100
height: 123 * settings.ui_zoom / 100
radius: 3
border.width: 1
border.color: "purple"
color: Material.backgroundColor
id: rect
}
DropShadow {
anchors.fill: rect
cached: true
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 16
color: Material.color(Material.Purple)
source: rect
}
Timer {
id: toggleIconTimer
interval: 500; running: true; repeat: true
onTriggered: { if(identificator === "inclination" && rootItem.autoInclinationEnabled()) myIcon.visible = !myIcon.visible; else myIcon.visible = true; }
}
Image {
id: myIcon
x: 5
anchors {
bottom: id1.bottom
}
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
source: icon
visible: !largeButton
}
Text {
objectName: "value"
id: myValue
color: valueFontColor
y: 0
anchors {
horizontalCenter: parent.horizontalCenter
}
text: value
horizontalAlignment: Text.AlignHCenter
font.pointSize: valueFontSize * settings.ui_zoom / 100
font.bold: true
visible: !largeButton
}
Text {
objectName: "secondLine"
id: secondLineText
color: "white"
y: myValue.bottom
anchors {
top: myValue.bottom
horizontalCenter: parent.horizontalCenter
}
text: secondLine
horizontalAlignment: Text.AlignHCenter
font.pointSize: 12 * settings.ui_zoom / 100
font.bold: false
visible: !largeButton
}
Text {
id: myText
anchors {
top: myIcon.top
}
font.bold: true
font.pointSize: labelFontSize
color: "white"
text: name
anchors.left: parent.left
anchors.leftMargin: 55 * settings.ui_zoom / 100
anchors.topMargin: 20 * settings.ui_zoom / 100
visible: !largeButton
}
RoundButton {
objectName: minusName
autoRepeat: true
text: "-"
onClicked: minus_clicked(objectName)
visible: writable && !largeButton
anchors.top: myValue.top
anchors.left: parent.left
anchors.leftMargin: 2
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
}
RoundButton {
autoRepeat: true
objectName: plusName
text: "+"
onClicked: plus_clicked(objectName)
visible: writable && !largeButton
anchors.top: myValue.top
anchors.right: parent.right
anchors.rightMargin: 2
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
}
RoundButton {
autoRepeat: true
objectName: identificator
text: largeButtonLabel
onClicked: largeButton_clicked(objectName)
visible: largeButton
anchors.fill: rect
background: Rectangle {
color: largeButtonColor
radius: 20
}
font.pointSize: 20 * settings.ui_zoom / 100
//width: 48 * settings.ui_zoom / 100
//height: 48 * settings.ui_zoom / 100
}
/*MouseArea {
anchors.fill: parent
onClicked: parent.GridView.view.currentIndex = index
}*/
}
GridView {
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: parent
cellWidth: 175 * settings.ui_zoom / 100
cellHeight: 130 * settings.ui_zoom / 100
focus: true
model: appModel
leftMargin: { if(OS_VERSION === "Android") (Screen.width % cellWidth) / 2; else (parent.width % cellWidth) / 2; }
anchors.topMargin: (!window.lockTiles ? rootItem.topBarHeight + 30 : 0)
id: gridView
objectName: "gridview"
onMovementEnded: { headerToolbar.visible = (contentY == 0) || window.lockTiles; }
Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.PortraitOrientation
Screen.onPrimaryOrientationChanged:{
if(OS_VERSION === "Android")
gridView.leftMargin = (Screen.width % cellWidth) / 2;
else
gridView.leftMargin = (parent.width % cellWidth) / 2;
}
footer:
Rectangle {
objectName: "footerrectangle"
visible: rootItem.videoVisible
anchors.top: gridView.bottom
width: parent.width
height: parent.height / 2
// highlight: Rectangle {
// width: 150
// height: 150
// color: "lightsteelblue"
// }
delegate: Item {
id: id1
width: 170 * settings.ui_zoom / 100
height: 125 * settings.ui_zoom / 100
Timer {
id: pauseTimer
interval: 1000; running: true; repeat: true
onTriggered: { if(visible == true) { (rootItem.currentSpeed > 0 ?
videoPlaybackHalf.play() :
videoPlaybackHalf.pause()) } }
}
visible: visibleItem
Component.onCompleted: console.log("completed " + objectName)
onVisibleChanged: {
if(visible === true) {
console.log("mediaPlayer onCompleted: " + rootItem.videoPath)
console.log("videoRate: " + rootItem.videoRate)
videoPlaybackHalf.source = rootItem.videoPath
//videoPlaybackHalf.playbackRate = rootItem.videoRate
videoPlaybackHalf.seek(rootItem.videoPosition)
videoPlaybackHalf.play()
videoPlaybackHalf.muted = true
} else {
videoPlaybackHalf.stop()
}
}
MediaPlayer {
id: videoPlaybackHalf
objectName: "videoplaybackhalf"
autoPlay: false
playbackRate: rootItem.videoRate
onError: {
if (videoPlaybackHalf.NoError !== error) {
console.log("[qmlvideo] VideoItem.onError error " + error + " errorString " + errorString)
}
}
}
VideoOutput {
id:videoPlayer
anchors.fill: parent
source: videoPlaybackHalf
}
Behavior on x {
enabled: id1.state != "active"
NumberAnimation { duration: 400; easing.type: Easing.OutBack }
}
Behavior on y {
enabled: id1.state != "active"
NumberAnimation { duration: 400; easing.type: Easing.OutBack }
}
SequentialAnimation on rotation {
NumberAnimation { to: 2; duration: 60 }
NumberAnimation { to: -2; duration: 120 }
NumberAnimation { to: 0; duration: 60 }
running: loc.currentId !== -1 && id1.state !== "active" && window.lockTiles
loops: Animation.Infinite; alwaysRunToEnd: true
}
states: State {
name: "active"; when: loc.currentId === gridId && window.lockTiles
PropertyChanges { target: id1; x: loc.mouseX - gridView.x - width/2; y: loc.mouseY - gridView.y - height/2; scale: 0.5; z: 10 }
}
transitions: Transition { NumberAnimation { property: "scale"; duration: 200} }
Rectangle {
width: 168 * settings.ui_zoom / 100
height: 123 * settings.ui_zoom / 100
radius: 3
border.width: 1
border.color: "purple"
color: Material.backgroundColor
id: rect
}
DropShadow {
anchors.fill: rect
cached: true
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 16
color: Material.color(Material.Purple)
source: rect
}
Image {
id: myIcon
x: 5
anchors {
bottom: id1.bottom
}
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
source: icon
}
Text {
objectName: "value"
id: myValue
color: valueFontColor
y: 0
anchors {
horizontalCenter: parent.horizontalCenter
}
text: value
horizontalAlignment: Text.AlignHCenter
font.pointSize: valueFontSize * settings.ui_zoom / 100
font.bold: true
}
Text {
objectName: "secondLine"
id: secondLineText
color: "white"
y: myValue.bottom
anchors {
top: myValue.bottom
horizontalCenter: parent.horizontalCenter
}
text: secondLine
horizontalAlignment: Text.AlignHCenter
font.pointSize: 12 * settings.ui_zoom / 100
font.bold: false
}
Text {
id: myText
anchors {
top: myIcon.top
}
font.bold: true
font.pointSize: labelFontSize
color: "white"
text: name
anchors.left: parent.left
anchors.leftMargin: 55 * settings.ui_zoom / 100
anchors.topMargin: 20 * settings.ui_zoom / 100
}
RoundButton {
objectName: minusName
autoRepeat: true
text: "-"
onClicked: minus_clicked(objectName)
visible: writable
anchors.top: myValue.top
anchors.left: parent.left
anchors.leftMargin: 2
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
}
RoundButton {
autoRepeat: true
objectName: plusName
text: "+"
onClicked: plus_clicked(objectName)
visible: writable
anchors.top: myValue.top
anchors.right: parent.right
anchors.rightMargin: 2
width: 48 * settings.ui_zoom / 100
height: 48 * settings.ui_zoom / 100
}
/*MouseArea {
anchors.fill: parent
onClicked: parent.GridView.view.currentIndex = index
}*/
}
}
MouseArea {
property int currentId: -1 // Original position in model
property int newIndex // Current Position in model

View File

@@ -5,7 +5,7 @@ import QtGraphicalEffects 1.12
Page {
title: qsTr("QZ Fitness")
title: qsTr("qDomyos-Zwift")
id: page
property alias start: start
@@ -157,7 +157,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 connects to your bike/treadmill. <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 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 issue, please, feel free to contact me to roberto.viola83@gmail.com.<br><br><b>Have a nice ride!</b><br>Roberto Viola"
wrapMode: Label.WordWrap
visible: rootItem.labelHelp
}

View File

@@ -1,57 +0,0 @@
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
property string accordionContent: ""
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
}
Text {
y:13
anchors.right: parent.right
anchors.rightMargin: 20
width: 30; height: 30
id: indicatImg
text: ">"
font.pixelSize: 24
color: "white"
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
stackView.push(accordionContent)
}
}
}
}

View File

@@ -1,39 +0,0 @@
#include <wobjectimpl.h>
#include "PathController.h"
#include <QtDebug>
W_OBJECT_IMPL(PathController)
PathController::PathController(QObject *parent)
: QObject(parent)
{
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
if (source) {
auto sourceName = source->sourceName();
auto objectName = source->objectName();
qDebug() << "Found QGeoPositionInfoSource: sourceName:" << sourceName
<< ", objectName:"<<objectName;
QGeoCoordinate const coordinate = source->lastKnownPosition().coordinate();
if(coordinate.isValid()) {
this->setCenter(coordinate);
} else {
// This has been known to happen.
// The Trixter X-Dream V1 bike using a Prolific PL2303HXA Serial to USB converter
// is identified by QGeoPositionInfoSource in Qt 5.15.2 as a source, but it delivers
// invalid data.
qDebug() << "Last known coordinate was not valid. Ignoring device.";
delete source;
}
}
}

View File

@@ -1,52 +0,0 @@
#ifndef APPLICATION_PATHCONTROLLER_H
#define APPLICATION_PATHCONTROLLER_H
#include <wobjectdefs.h>
#include <QGeoPath>
#include <QGeoPositionInfoSource>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
class PathController : public QObject {
// Q_OBJECT
W_OBJECT(PathController)
public:
PathController(QObject *parent = 0);
QGeoPath geoPath() const { return mGeoPath; }
void setGeoPath(const QGeoPath &geoPath) {
if (geoPath == mGeoPath) {
return;
}
mGeoPath = geoPath;
emit geopathChanged();
}
void geopathChanged() W_SIGNAL(geopathChanged)
QGeoCoordinate center() const {
return mCenter;
}
void setCenter(const QGeoCoordinate &center) {
if (center == mCenter) {
return;
}
mCenter = center;
emit centerChanged();
}
void centerChanged() W_SIGNAL(centerChanged)
private : QGeoPath mGeoPath;
QGeoCoordinate mCenter;
W_PROPERTY(QGeoPath, geopath READ geoPath WRITE setGeoPath NOTIFY geopathChanged)
W_PROPERTY(QGeoCoordinate, center READ center WRITE setCenter NOTIFY centerChanged)
};
#endif // APPLICATION_PATHCONTROLLER_H

View File

@@ -37,7 +37,6 @@ ColumnLayout {
folder: "file://" + rootItem.getWritableAppDir() + 'settings'
showDotAndDotDot: false
showDirs: true
sortReversed: true
}
model: folderModel
delegate: Component {

View File

@@ -1,129 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
Item {
id: button
property string text: ""
property color buttonColor: "white"
property color textColor: "black"
property bool available: true
property alias fontPointSize: buttonText.font.pointSize
signal clicked()
state: "NORMAL"
Rectangle {
id: buttonRect
anchors.fill: parent
radius: 10
color: buttonColor
visible: button.available
Text {
id: buttonText
anchors.fill: parent
anchors.rightMargin: parent.width * 0.05
anchors.leftMargin: parent.width * 0.05
anchors.bottomMargin: parent.height * 0.20
anchors.topMargin: parent.height * 0.20
text: button.text
color: textColor
fontSizeMode: Text.Fit
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
minimumPointSize: 8
font.pointSize: 64
font.family: "Helvetica"
font.weight: Font.Light
}
}
MouseArea {
anchors.fill: parent
onClicked: {
button.clicked();
}
onPressed: {
button.state = "PRESSED";
}
onReleased: {
button.state = "NORMAL";
}
}
states: [
State {
name: "NORMAL"
PropertyChanges {
target: buttonRect
color: button.buttonColor
border.color: "transparent"
}
PropertyChanges {
target: buttonText
color: button.textColor
}
},
State {
name: "PRESSED"
PropertyChanges {
target: buttonRect
color: "transparent"
border.color: button.buttonColor
}
PropertyChanges {
target: buttonText
color: button.buttonColor
}
}
]
}

View File

@@ -1,185 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.15
import org.cagnulein.qdomyoszwift 1.0
Rectangle {
id: storeItem
property Product product: undefined
state: "NORMAL"
visible: product.status == Product.Registered
radius: 10
color: "white"
height: titleText.contentHeight + descriptionText.contentHeight + 2
// ![0]
Text {
id: titleText
text: product.title
font.bold: true
anchors.right: priceText.left
anchors.top: parent.top
anchors.left: parent.left
}
Text {
id: descriptionText
text: product.description
anchors.right: priceText.left
anchors.left: parent.left
anchors.top: titleText.bottom
wrapMode: Text.WordWrap
}
Text {
id: priceText
text: product.price
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
pendingRect.visible = true;
spinBox.visible = true;
statusText.text = "Purchasing...";
storeItem.state = "PURCHASING";
product.purchase();
}
onPressed: {
storeItem.state = "PRESSED";
}
onReleased: {
storeItem.state = "NORMAL";
}
}
// ![0]
Rectangle {
id: pendingRect
anchors.fill: parent
opacity: 0.0
color: "white"
radius: parent.radius
Text {
id: statusText
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: spinBox.left
verticalAlignment: Text.AlignVCenter
}
BusyIndicator {
id: spinBox
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: height
}
Connections {
target: product
function onPurchaseSucceeded() {
statusText.text = "Purchase Succeeded";
spinBox.visible = false;
}
function onPurchaseFailed() {
statusText.text = "Purchase Failed";
spinBox.visible = false;
storeItem.state = "NORMAL";
}
}
}
states: [
State {
name: "NORMAL"
PropertyChanges {
target: storeItem
color: "white"
border.color: "transparent"
}
PropertyChanges {
target: pendingRect
opacity: 0.0
}
},
State {
name: "PRESSED"
PropertyChanges {
target: storeItem
color: "transparent"
border.color: "white"
}
},
State {
name: "PURCHASING"
PropertyChanges {
target: pendingRect
opacity: 1.0
}
}
]
transitions: [
Transition {
from: "PURCHASING"
to: "NORMAL"
NumberAnimation { target: pendingRect; property: "opacity"; duration: 2000; easing.type: Easing.InExpo }
}
]
}

View File

@@ -1,107 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import org.cagnulein.qdomyoszwift 1.0
Item {
Text {
padding: 5
id: description
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
color: "white"
font.pointSize: 22
wrapMode: TextArea.Wrap
text: qsTr("Hi! Do you know that QZ is just an Open Source Indie App?<br><br>No Big Companies are running this!<br>The \"Swag Bag\" is a way to support the ongoing development, maintenance and support of QZ Fitness!")
}
Column {
//anchors.top: description.bottom + 10
anchors.top: description.bottom
//anchors.bottom: restoreButton.top
anchors.right: parent.right
anchors.left: parent.left
id: itemSwagBag
SwagBagItem {
product: productUnlockVowels
width: parent.width
}
}
Text {
anchors {
top: itemSwagBag.bottom
horizontalCenter: parent.horizontalCenter
}
padding: 5
id: appleDescription
width: parent.width
color: "white"
font.pointSize: 8
wrapMode: TextArea.Wrap
text: qsTr("<html><style type='text/css'></style>Swag bag feature:<br>• an auto-renewable subscription<br>• 1 month ($1.99)<br>• Your subscription will be charged to your iTunes account at confirmation of purchase and will automatically renew (at the duration selected) unless auto-renew is turned off at least 24 hours before the end of the current period.<br>• Current subscription may not be cancelled during the active subscription period; however, you can manage your subscription and/or turn off auto-renewal by visiting your iTunes Account Settings after purchase.<br>• Privacy policy: <a href='https://robertoviola.cloud/privacy-policy-qdomyos-zwift/'>https://robertoviola.cloud/privacy-policy-qdomyos-zwift/</a><br>• Licensed Application end user license agreement: <a href='https://www.apple.com/legal/internet-services/itunes/dev/stdeula/'>https://www.apple.com/legal/internet-services/itunes/dev/stdeula/</a><br></html>")
onLinkActivated: Qt.openUrlExternally(link)
}
/*Button {
id: restoreButton
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width * .5
text: "Restore Purchases"
onClicked: {
console.log("restoring...");
iapStore.restorePurchases();
}
}*/
}

View File

@@ -32,7 +32,7 @@ ColumnLayout {
horizontalAlignment: Text.AlignRight
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
//inputMethodHints: Qt.ImhFormattedNumbersOnly
inputMethodHints: Qt.ImhFormattedNumbersOnly
onAccepted: hostRow.doSaveHost(text)
}
Button {

View File

@@ -4,12 +4,9 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.0
import QtQuick.Dialogs 1.0
import QtCharts 2.2
import Qt.labs.settings 1.0
ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_preview(url name)
FileDialog {
id: fileDialogTrainProgram
title: "Please choose a file"
@@ -25,65 +22,21 @@ ColumnLayout {
}
}
RowLayout{
spacing: 2
anchors.top: parent.top
anchors.fill: parent
ColumnLayout {
spacing: 0
anchors.top: parent.top
anchors.fill: parent
Row
{
spacing: 5
Text
{
text:"Filter"
color: "white"
verticalAlignment: Text.AlignVCenter
}
TextField
{
function updateFilter()
{
var text = filterField.text
var filter = "*"
for(var i = 0; i<text.length; i++)
filter+= "[%1%2]".arg(text[i].toUpperCase()).arg(text[i].toLowerCase())
filter+="*"
print(filter)
folderModel.nameFilters = [filter + ".zwo", filter + ".xml"]
}
id: filterField
onTextChanged: updateFilter()
}
Button {
anchors.left: mainRect.right
anchors.leftMargin: 5
text: "←"
onClicked: folderModel.folder = folderModel.parentFolder
}
}
AccordionElement {
title: qsTr("Application Training folder")
indicatRectColor: Material.color(Material.Grey)
textColor: Material.color(Material.Grey)
color: Material.backgroundColor
accordionContent: ColumnLayout {
ListView {
Layout.fillWidth: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
Layout.maximumWidth: row.left
Layout.minimumHeight: 150
Layout.preferredHeight: parent.height
ScrollBar.vertical: ScrollBar {}
id: list
anchors.fill: parent
FolderListModel {
id: folderModel
nameFilters: ["*.xml", "*.zwo"]
folder: "file://" + rootItem.getWritableAppDir() + 'training'
showDotAndDotDot: false
showDotAndDotDot: false
showDirs: true
sortField: "Name"
showDirsFirst: true
}
model: folderModel
delegate: Component {
@@ -91,37 +44,13 @@ ColumnLayout {
property alias textColor: fileTextBox.color
width: parent.width
height: 40
color: Material.backgroundColor
color: Material.backgroundColor
z: 1
Item {
id: root
property alias text: fileTextBox.text
property int spacing: 30
width: fileTextBox.width + spacing
height: fileTextBox.height
clip: true
Text {
id: fileTextBox
color: (!folderModel.isFolder(index)?Material.color(Material.Grey):Material.color(Material.Orange))
font.pixelSize: Qt.application.font.pixelSize * 1.6
text: fileName.substring(0, fileName.length-4)
NumberAnimation on x {
Component.onCompleted: {
if(fileName.length > 30) {
running: true;
} else {
stop();
}
}
from: 0; to: -root.width; duration: 20000; loops: Animation.Infinite
}
Text {
x: root.width
text: fileTextBox.text
color: Material.color(Material.Grey)
font.pixelSize: Qt.application.font.pixelSize * 1.6
}
}
Text {
id: fileTextBox
color: Material.color(Material.Grey)
font.pixelSize: Qt.application.font.pixelSize * 1.6
text: fileName.substring(0, fileName.length-4)
}
MouseArea {
anchors.fill: parent
@@ -130,12 +59,10 @@ ColumnLayout {
console.log('onclicked ' + index+ " count "+list.count);
if (index == list.currentIndex) {
let fileUrl = folderModel.get(list.currentIndex, 'fileUrl') || folderModel.get(list.currentIndex, 'fileURL');
if (fileUrl && !folderModel.isFolder(list.currentIndex)) {
if (fileUrl) {
trainprogram_open_clicked(fileUrl);
popup.open()
} else {
folderModel.folder = fileURL
}
}
}
else {
if (list.currentItem)
@@ -164,124 +91,14 @@ ColumnLayout {
if (fileUrl) {
list.currentItem.textColor = Material.color(Material.Yellow)
console.log(fileUrl + ' selected');
trainprogram_preview(fileUrl)
powerSeries.clear();
for(var i=0;i<rootItem.preview_workout_points;i+=10)
{
powerSeries.append(i * 1000, rootItem.preview_workout_watt[i]);
}
rootItem.update_chart_power(powerChart);
//trainprogram_open_clicked(fileUrl);
//popup.open()
}
}
Component.onCompleted: {
}
}
}
ScrollView {
anchors.top: parent.top
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
contentHeight: date.height + description.height + powerChart.height
Layout.preferredHeight: parent.height
Layout.fillWidth: true
Layout.minimumWidth: 100
Layout.preferredWidth: 200
property alias powerSeries: powerSeries
property alias powerChart: powerChart
Settings {
id: settings
property real ftp: 200.0
}
Row {
id: row
anchors.fill: parent
Text {
id: date
width: parent.width
text: rootItem.previewWorkoutDescription
font.pixelSize: 14
color: "white"
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
anchors.top: date.bottom
id: description
width: parent.width
text: rootItem.previewWorkoutTags
font.pixelSize: 10
wrapMode: Text.WordWrap
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.horizontalCenter: parent.horizontalCenter
}
Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: description.bottom
anchors.bottom: parent.bottom
ChartView {
id: powerChart
objectName: "powerChart"
antialiasing: true
legend.visible: false
height: 400
width: parent.width
title: "Power"
titleFont.pixelSize: 20
DateTimeAxis {
id: valueAxisX
tickCount: 7
min: new Date(0)
max: new Date(rootItem.preview_workout_points * 1000)
format: "mm:ss"
//labelsVisible: false
gridVisible: false
//lineVisible: false
labelsFont.pixelSize: 10
}
ValueAxis {
id: valueAxisY
min: 0
max: rootItem.wattMaxChart
//tickCount: 60
tickCount: 8
labelFormat: "%.0f"
//labelsVisible: false
//gridVisible: false
//lineVisible: false
labelsFont.pixelSize: 10
}
LineSeries {
//name: "Power"
id: powerSeries
visible: true
axisX: valueAxisX
axisY: valueAxisY
color: "black"
width: 1
}
}
}
}
}
}
spacing: 10
Button {
id: searchButton

View File

@@ -1,205 +0,0 @@
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
Item {
signal trainprogram_zwo_loaded(string s)
id: column1
// vedi trainprogram_open_clicked
Settings {
id: settings
}
Button {
id: loadButton
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
enabled: false
text: "Load"
height: Math.max(parent.height * 0.1, 50)
onClicked: {
console.log(webView.rr);
trainprogram_zwo_loaded(webView.rr);
//popupclose();
}
}
WebView {
id: webView
property var rr;
anchors.top: loadButton.bottom
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
url: "https://whatsonzwift.com/workouts"
visible: true
onLoadingChanged: {
if (loadRequest.errorString)
console.error(loadRequest.errorString);
if (loadRequest.status == WebView.LoadSucceededStatus) {
console.error("Procedo");
let loadScr = `
let parsePace = function(s) {
let pace = 2;
if (s=='5k') pace = 1;
else if (s == 'HM') pace = 3;
else if (s == 'M') pace = 4;
return pace;
};
let parseDuration = function(txt) {
let re;
let objout = {
dur: 60,
repeat: 0,
durationType: null,
txt: txt
};
let dur = 60;
let repeat = 0;
if ((txt.indexOf('min') > 0 || txt.indexOf('sec') > 0) && (re = /([0-9]+x +)?([0-9]+min)? *([0-9]+sec)? +/.exec(txt.trim()))) {
let dd = 0;
objout.durationType = 'time';
objout.d_re = re;
for (let i = 1; i<re.length; i++) {
let trm1 = re[i];
if (!trm1) continue;
else if ((trm1 = trm1.trim()).endsWith('x')) {
objout.repeat = parseInt(re[i].substring(0, re[i].length - 1));
}
else if (trm1.endsWith('sec')) {
dd += parseInt(re[i].substring(0, re[i].length - 3));
}
else if (trm1.endsWith('min')) {
dd += parseInt(re[i].substring(0, re[i].length - 3)) * 60;
}
}
if (dd) objout.dur = dd;
objout.txt = txt.substring(re[0].length);
}
else if (re = /(?:([0-9]+)x +)?([0-9]+) +m +/.exec(txt)) {
objout.durationType = 'distance';
if (re[1]) {
objout.repeat = parseInt(re[1]);
}
objout.d_re = re;
objout.dur = parseInt(re[2]);
objout.txt = txt.substring(re[0].length);
}
return objout;
};
let processDOM = function() {
let outobj = {};
let div = document.querySelector('div.overview');
outobj.description = 'N/A';
if (div) {
let nextSibling = div.nextSibling;
while(nextSibling && (nextSibling.nodeType != 1 || nextSibling.tagName != 'P')) {
nextSibling = nextSibling.nextSibling;
}
if (nextSibling) outobj.description = nextSibling.innerText;
}
let durationType = null;
let gli = document.querySelector('h4.glyph-icon');
outobj.name = gli?gli.innerText:'N/A';
outobj.sportType = gli && gli.classList.contains('flaticon-run')?'run':'bike';
outobj.workout = [];
outobj.author = "whatsonzwift.com";
let wll = document.querySelector('.workoutlist');
let pace = null;
if (wll) {
let rexp = /(?:from +([0-9]+) +to +|@ +|)(?:[0-9]+rpm, +)?(?:([0-9]+)% +(?:of +(5k|10k|HM|M) +pace|FTP)|No Incline Walk)/; // fine idx = 2, pace idx = 3 inizio idx = 1
let tbs = wll.querySelectorAll('.textbar');
for (let i = 0; tbs && i<tbs.length; i++) {
let txt = tbs[i].innerText;
let elem = {};
elem.d_pretxt = txt;
let o = parseDuration(txt);
if (o.durationType) {
let dur = o.dur;
let repeat = o.repeat;
let OffDuration = -1;
let OffPower = -1;
let o2;
let re, re2;
elem.d_dur = o;
elem.d_posttxt = o.txt;
txt = o.txt;
if (re = rexp.exec(txt.trim())) {
elem.d_re = re;
let ln = re[0].length;
if (txt.length > ln && txt.charAt(ln) == ',' && (o2 = parseDuration(txt.substring(ln + 1))) && o2.durationType && (re2 = rexp.exec(o2.txt))) {
OffPower = parseInt(re2[2]);
OffDuration = o2.dur;
}
if (re[1]) {
if (i == 0) {
elem.type = "Warmup";
}
else if (i == tbs.length - 1) {
elem.type = "Cooldown";
}
else {
elem.type = "Ramp";
}
elem.Duration = o.dur;
elem.PowerLow = parseInt(re[1]) / 100.0;
elem.PowerHigh = parseInt(re[2]) / 100.0;
}
else if (OffPower >= 0 && OffDuration >= 0) {
elem.type = 'IntervalsT';
if (o.repeat) elem.Repeat = o.repeat; else elem.Repeat = 0;
elem.OnDuration = o.dur;
elem.OnPower = parseInt(re[2]) / 100.0;
elem.OffDuration = OffDuration;
elem.OffPower = OffPower / 100.0;
}
else {
elem.type = "SteadyState";
if (o.repeat) elem.Repeat = o.repeat; else elem.Repeat = 0;
elem.Duration = o.dur;
elem.Power = re[2]?parseInt(re[2]) / 100.0:0.5;
}
if (re[3]) pace = parsePace(re[3]);
if (pace) elem.pace = pace;
}
else if (txt == "free run" || txt == "free ride") {
elem.type = "FreeRide";
elem.Duration = o.dur;
}
if (durationType === null) {
outobj.durationType = o.durationType;
durationType = o.durationType;
}
}
if (elem) outobj.workout.push(elem);
}
}
return outobj;
};
let o = processDOM();
let res = JSON.stringify(o);
res
`;
webView.runJavaScript(loadScr, function(res) {
console.log("AHO1 " + res);
let ro = JSON.parse(res);
if (ro.name && ro.workout && ro.workout.length) {
console.log("AHO2 " + ro);
webView.rr = res;
loadButton.text = 'Load ' + ro.name;
loadButton.enabled = true;
}
});
}
}
}
Component.onCompleted: {
headerToolbar.visible = true;
webView.rr = 'ciao';
}
}

View File

@@ -1,58 +0,0 @@
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 {
anchors.fill: parent
height: parent.height
width: parent.width
visible: true
WebView {
anchors.fill: parent
height: parent.height
width: parent.width
visible: !rootItem.generalPopupVisible
url: rootItem.getStravaAuthUrl
}
Popup {
id: popupStravaConnectedWeb
parent: Overlay.overlay
enabled: rootItem.generalPopupVisible
onEnabledChanged: { if(rootItem.generalPopupVisible) popupStravaConnectedWeb.open() }
onClosed: { rootItem.generalPopupVisible = false; }
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 Strava account is now connected!<br><br>When you will press STOP on QZ a file<br>will be automatically uploaded to Strava!")
}
}
}
}

View File

@@ -1,5 +1,6 @@
#include "activiotreadmill.h"
#include "activiotreadmill.h"
#include "ios/lockscreen.h"
#include "keepawakehelper.h"
#include "virtualtreadmill.h"
@@ -33,7 +34,7 @@ activiotreadmill::activiotreadmill(uint32_t pollDeviceTime, bool noConsole, bool
refresh->start(pollDeviceTime);
}
void activiotreadmill::writeCharacteristic(const QLowEnergyCharacteristic characteristic, uint8_t *data,
void activiotreadmill::writeCharacteristic(const QLowEnergyCharacteristic characteristc, uint8_t *data,
uint8_t data_len, const QString &info, bool disable_log,
bool wait_for_response) {
QEventLoop loop;
@@ -54,7 +55,7 @@ void activiotreadmill::writeCharacteristic(const QLowEnergyCharacteristic charac
return;
}
gattCommunicationChannelService->writeCharacteristic(characteristic, QByteArray((const char *)data, data_len));
gattCommunicationChannelService->writeCharacteristic(characteristc, QByteArray((const char *)data, data_len));
if (!disable_log) {
emit debug(QStringLiteral(" >> ") + QByteArray((const char *)data, data_len).toHex(' ') +
@@ -69,66 +70,11 @@ void activiotreadmill::writeCharacteristic(const QLowEnergyCharacteristic charac
}
void activiotreadmill::forceSpeed(double requestSpeed) {
QSettings settings;
uint8_t writeSpeed[] = {0x03, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00};
writeSpeed[1] = (requestSpeed * 10);
writeSpeed[5] += writeSpeed[1];
if(!settings.value(QZSettings::fitfiu_mc_v460, QZSettings::default_fitfiu_mc_v460).toBool())
writeSpeed[6] = writeSpeed[1] + 1;
else {
switch(writeSpeed[1] & 0x0F) {
case 0x00:
writeSpeed[6] = writeSpeed[1] + 5;
break;
case 0x01:
writeSpeed[6] = writeSpeed[1] + 3;
break;
case 0x02:
writeSpeed[6] = writeSpeed[1] + 1;
break;
case 0x03:
writeSpeed[6] = writeSpeed[1] - 1;
break;
case 0x04:
writeSpeed[6] = writeSpeed[1] + 5;
break;
case 0x05:
writeSpeed[6] = writeSpeed[1] + 3;
break;
case 0x06:
writeSpeed[6] = writeSpeed[1] + 1;
break;
case 0x07:
writeSpeed[6] = writeSpeed[1] - 1;
break;
case 0x08:
writeSpeed[6] = writeSpeed[1] + 5;
break;
case 0x09:
writeSpeed[6] = writeSpeed[1] + 3;
break;
case 0x0A:
writeSpeed[6] = writeSpeed[1] + 1;
break;
case 0x0B:
writeSpeed[6] = writeSpeed[1] - 1;
break;
case 0x0C:
writeSpeed[6] = writeSpeed[1] + 5;
break;
case 0x0D:
writeSpeed[6] = writeSpeed[1] + 3;
break;
case 0x0E:
writeSpeed[6] = writeSpeed[1] + 1;
break;
case 0x0F:
writeSpeed[6] = writeSpeed[1] - 1;
break;
}
}
writeSpeed[6] = writeSpeed[1] + 1;
writeCharacteristic(gattWriteCharacteristic, writeSpeed, sizeof(writeSpeed),
QStringLiteral("forceSpeed speed=") + QString::number(requestSpeed), false, false);
@@ -168,8 +114,8 @@ void activiotreadmill::update() {
QSettings settings;
// ******************************************* virtual treadmill init *************************************
if (!firstInit && !virtualTreadMill && !virtualBike) {
bool virtual_device_enabled = settings.value(QZSettings::virtual_device_enabled, QZSettings::default_virtual_device_enabled).toBool();
bool virtual_device_force_bike = settings.value(QZSettings::virtual_device_force_bike, QZSettings::default_virtual_device_force_bike).toBool();
bool virtual_device_enabled = settings.value("virtual_device_enabled", true).toBool();
bool virtual_device_force_bike = settings.value("virtual_device_force_bike", false).toBool();
if (virtual_device_enabled) {
if (!virtual_device_force_bike) {
debug("creating virtual treadmill interface...");
@@ -190,7 +136,7 @@ void activiotreadmill::update() {
// debug("Domyos Treadmill RSSI " + QString::number(bluetoothDevice.rssi()));
update_metrics(true, watts(settings.value(QZSettings::weight, QZSettings::default_weight).toFloat()));
update_metrics(true, watts(settings.value(QStringLiteral("weight"), 75.0).toFloat()));
{
if (requestSpeed != -1) {
@@ -200,15 +146,13 @@ void activiotreadmill::update() {
}
requestSpeed = -1;
}
if (requestInclination != -100) {
if(requestInclination < 0)
requestInclination = 0;
if (requestInclination != -1) {
if (requestInclination != currentInclination().value() && requestInclination >= 0 &&
requestInclination <= 15) {
emit debug(QStringLiteral("writing incline ") + QString::number(requestInclination));
forceIncline(requestInclination);
}
requestInclination = -100;
requestInclination = -1;
}
if (requestStart != -1) {
emit debug(QStringLiteral("starting..."));
@@ -282,7 +226,7 @@ void activiotreadmill::characteristicChanged(const QLowEnergyCharacteristic &cha
// qDebug() << "characteristicChanged" << characteristic.uuid() << newValue << newValue.length();
QSettings settings;
QString heartRateBeltName =
settings.value(QZSettings::heart_rate_belt_name, QZSettings::default_heart_rate_belt_name).toString();
settings.value(QStringLiteral("heart_rate_belt_name"), QStringLiteral("Disabled")).toString();
Q_UNUSED(characteristic);
QByteArray value = newValue;
@@ -296,14 +240,12 @@ void activiotreadmill::characteristicChanged(const QLowEnergyCharacteristic &cha
// lastState = value.at(0);
double speed = GetSpeedFromPacket(value);
double incline = 1.0; // "fitfiu_mc_v460" has 1.0 fixed inclination
if(!settings.value(QZSettings::fitfiu_mc_v460, QZSettings::default_fitfiu_mc_v460).toBool())
incline = GetInclinationFromPacket(value);
double incline = GetInclinationFromPacket(value);
// double kcal = GetKcalFromPacket(value);
// double distance = GetDistanceFromPacket(value);
#ifdef Q_OS_ANDROID
if (settings.value(QZSettings::ant_heart, QZSettings::default_ant_heart).toBool())
if (settings.value("ant_heart", false).toBool())
Heart = (uint8_t)KeepAwakeHelper::heart();
else
#endif
@@ -330,10 +272,10 @@ void activiotreadmill::characteristicChanged(const QLowEnergyCharacteristic &cha
}
if (!firstCharacteristicChanged) {
if (watts(settings.value(QZSettings::weight, QZSettings::default_weight).toFloat()))
if (watts(settings.value(QStringLiteral("weight"), 75.0).toFloat()))
KCal +=
((((0.048 * ((double)watts(settings.value(QZSettings::weight, QZSettings::default_weight).toFloat())) + 1.19) *
settings.value(QZSettings::weight, QZSettings::default_weight).toFloat() * 3.5) /
((((0.048 * ((double)watts(settings.value(QStringLiteral("weight"), 75.0).toFloat())) + 1.19) *
settings.value(QStringLiteral("weight"), 75.0).toFloat() * 3.5) /
200.0) /
(60000.0 / ((double)lastTimeCharacteristicChanged.msecsTo(
QDateTime::currentDateTime())))); //(( (0.048* Output in watts +1.19) * body weight in

View File

@@ -53,7 +53,7 @@ class activiotreadmill : public treadmill {
void forceSpeed(double requestSpeed);
void forceIncline(double requestIncline);
void btinit(bool startTape);
void writeCharacteristic(const QLowEnergyCharacteristic characteristic, uint8_t *data, uint8_t data_len,
void writeCharacteristic(const QLowEnergyCharacteristic characteristc, uint8_t *data, uint8_t data_len,
const QString &info, bool disable_log = false, bool wait_for_response = false);
void startDiscover();
bool noConsole = false;

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