Skip to content

Commit

Permalink
Merge branch 'main' into clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Nov 16, 2023
2 parents 5c92650 + 26151e4 commit 31a5299
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib/genericaccessservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
13 changes: 5 additions & 8 deletions src/lib/statusservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,11 @@ 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)) {
if (!checkSize(QLatin1String("Status"), value, 5, 8)) {
return status;
}

Expand All @@ -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<StatusService::SwitchPosition>(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<StatusService::ChargingStatus>(value.at(7));
}
qCDebug(lc).noquote() << tr("Device status: %1 (%2)")
Expand Down Expand Up @@ -702,7 +699,7 @@ std::optional<StatusService::ButtonStatus> 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.
*/
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lib/teststatusservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,]*$)")));
}
Expand Down

0 comments on commit 31a5299

Please sign in to comment.