From 01294b2a493aac7c68d1e810e2552e7117367f21 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Mon, 13 Nov 2023 20:00:00 +1100 Subject: [PATCH 1/5] Update some docs re the charging status byte --- src/lib/statusservice.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/statusservice.cpp b/src/lib/statusservice.cpp index 572880535..84223ac29 100644 --- a/src/lib/statusservice.cpp +++ b/src/lib/statusservice.cpp @@ -637,11 +637,8 @@ StatusService::Status StatusServicePrivate::parseStatus(const QByteArray &value) /*! * \pokitApi Pokit API 0.02 says the `Status` characteristic is 5 bytes. API 1.00 then added an * additional byte for `Battery Status`, for 6 bytes in total. However, Pokit Pro devices return - * 8 bytes here. The purpose of those last 2 bytes are not currently known. Note also, Pokit - * Meter only uses the first 5 bytes - ie `Battery Status` is not present. - * - * Update: it appears that the first of those 2 extra bytes is used to indicate the phycical switch - * position. + * 8 bytes here. It appears that the first of those 2 extra bytes is used to indicate the physical + * switch position, while the other extra byte indicates the device's current charging status. */ if (!checkSize(QLatin1String("Status"), value, 5, 6)) { @@ -656,7 +653,7 @@ StatusService::Status StatusServicePrivate::parseStatus(const QByteArray &value) if (value.size() >= 7) { // Switch Position - as yet, undocumented by Pokit Innovations. status.switchPosition = static_cast(value.at(6)); } - if (value.size() >= 8) { // Switch Position - as yet, undocumented by Pokit Innovations. + if (value.size() >= 8) { // Charging Status - as yet, undocumented by Pokit Innovations. status.chargingStatus = static_cast(value.at(7)); } qCDebug(lc).noquote() << tr("Device status: %1 (%2)") @@ -702,7 +699,7 @@ std::optional StatusServicePrivate::parseButtonPres * \pokitApi The button event is the second byte, but no idea what the first byte is. In all examples * I've see it's always `0x02`. It appears that the Pokit Android app only ever looks at `bytes[1]`. * - * \pokitApi Note, we can actually write to the Button Press characteristic too. If we do, the whatever + * \pokitApi Note, we can actually write to the Button Press characteristic too. If we do, then whatever * we set as the first byte persists, and (unsurprisingly) the second byte reverts to the current * button state. So still no idea what that first byte is for. */ From bc43371d284adcfb2340961358e3d7af03738928 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Mon, 13 Nov 2023 20:01:02 +1100 Subject: [PATCH 2/5] No longer warn about the extra two status bytes Since we're pretty confident we know what they are now, even though Pokit Innovations still has not provided any documentation for them. --- src/lib/statusservice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/statusservice.cpp b/src/lib/statusservice.cpp index 84223ac29..aef146136 100644 --- a/src/lib/statusservice.cpp +++ b/src/lib/statusservice.cpp @@ -641,7 +641,7 @@ StatusService::Status StatusServicePrivate::parseStatus(const QByteArray &value) * switch position, while the other extra byte indicates the device's current charging status. */ - if (!checkSize(QLatin1String("Status"), value, 5, 6)) { + if (!checkSize(QLatin1String("Status"), value, 5, 8)) { return status; } From f7fb3e67f4bd3fef061be14c4537f0b4ec304928 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Mon, 13 Nov 2023 20:02:19 +1100 Subject: [PATCH 3/5] Update unit test broken by previous commit ie commit bc43371d284adcfb2340961358e3d7af03738928. --- test/unit/lib/teststatusservice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/lib/teststatusservice.cpp b/test/unit/lib/teststatusservice.cpp index dc1f21e17..3e6234fda 100644 --- a/test/unit/lib/teststatusservice.cpp +++ b/test/unit/lib/teststatusservice.cpp @@ -534,7 +534,7 @@ void TestStatusService::parseStatus() QTest::ignoreMessage(QtWarningMsg, QRegularExpression(QStringLiteral( R"(^Status requires \d+ byte/s, but only \d+ present: 0x[a-zA-Z0-9,]*$)"))); } - if (value.size() > 6) { + if (value.size() > 8) { QTest::ignoreMessage(QtWarningMsg, QRegularExpression(QStringLiteral( R"(^Status has \d+ extraneous byte/s: 0x[a-zA-Z0-9,]*$)"))); } From 0b7638569136e215265b18371ff8953b24ea1ad0 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Wed, 15 Nov 2023 21:45:59 +1100 Subject: [PATCH 4/5] Correct a minor spelling mistake --- src/lib/genericaccessservice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/genericaccessservice.cpp b/src/lib/genericaccessservice.cpp index 5a4d36245..adc6e02cc 100644 --- a/src/lib/genericaccessservice.cpp +++ b/src/lib/genericaccessservice.cpp @@ -18,7 +18,7 @@ * * \cond internal * \pokitApi Pokit API 1.00 (and 0.02) claims support for the `Generic Access` (`0x1800`) service, - * however the neither the Pokit Meter, nor the Pokit Pro eport any support for this service, but + * however the neither the Pokit Meter, nor the Pokit Pro report any support for this service, but * both report support for an undocumented `Generic Attribute` (`0x1801`) service instead. * \endcond */ From 26151e494a8c15eac9acbf895ff2f16eff614124 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Thu, 16 Nov 2023 21:57:29 +1100 Subject: [PATCH 5/5] Show the built CLI's version on Windows too We have to do this in a Bash shell, since in the cmd shell Qt will show the version in a message box (which is, debatably, poor Qt behaviour; eg https://bugreports.qt.io/browse/QTBUG-114530). --- .github/workflows/build.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 64f818d97..bdc239117 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -367,8 +367,12 @@ jobs: copy /v /b src\cli\dokit.exe /b portable cd portable windeployqt --compiler-runtime --release --verbose 2 dokit.exe ${{ matrix.dll }} - :: dokit.exe --version + :: dokit.exe --version # This would hang the job, because Qt will show a message box. working-directory: ${{ runner.temp }} + - name: Check portable version + if: matrix.arch != 'arm64' + shell: bash + run: '"$RUNNER_TEMP/portable/dokit.exe" --version' - name: Setup artifacts shell: bash run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV