From 4323356c114601fff5b7787482234daee3455854 Mon Sep 17 00:00:00 2001 From: "Irene Siu (Apple)" Date: Mon, 14 Mar 2022 14:58:50 -0700 Subject: [PATCH] Change CLI option behavior for OTA-R and OTA-P to revert back to the success case after using the CLI supplied values (#16095) * Issue #15656 [ota-provider-app] Add counters for various QueryImageResponse and ApplyImageResponse commands - For OTA-P, make -q, -a, and -u be applied just once and then revert back to the success case. * - Remove debug logs - Remove counters and just revert behavior to success case after first use - Fix userConsentState ignore once case * - Update ReadMes and CLI comments. * - Remove debug code. - Remove count variables. * scripts/helpers/restyle-diff.sh * Resolve spellcheck errors. * Code review changes. - Update comments. * scripts/helpers/restyle-diff.sh * Code review changes. - Split -t command line arg into -t and -p. * scripts/helpers/restyle-diff.sh * Code review changes. - Update readme and CLI info texts. --- .github/.wordlist.txt | 3 +- .../esp32/main/OTAProviderCommands.cpp | 3 +- examples/ota-provider-app/linux/README.md | 27 ++++----- examples/ota-provider-app/linux/main.cpp | 56 ++++++++++++------- .../DefaultUserConsentProvider.cpp | 5 +- .../OTAProviderExample.cpp | 23 ++++++-- .../ota-provider-common/OTAProviderExample.h | 6 +- examples/ota-requestor-app/linux/README.md | 11 ++-- examples/ota-requestor-app/linux/main.cpp | 2 + .../DefaultOTARequestorUserConsentProvider.h | 6 +- 10 files changed, 92 insertions(+), 50 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index ef7265d8085079..c9d72a3179beee 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -326,7 +326,8 @@ DefaultSuccess definedValue DehumidificationControl DelayedActionTime -delayedActionTimeSec +delayedApplyActionTimeSec +delayedQueryActionTimeSec delayQuery demangle deployable diff --git a/examples/ota-provider-app/esp32/main/OTAProviderCommands.cpp b/examples/ota-provider-app/esp32/main/OTAProviderCommands.cpp index 58bf1ee1320f16..695e9518e699a0 100644 --- a/examples/ota-provider-app/esp32/main/OTAProviderCommands.cpp +++ b/examples/ota-provider-app/esp32/main/OTAProviderCommands.cpp @@ -34,7 +34,8 @@ CHIP_ERROR DelayedActionTimeHandler(int argc, char ** argv) VerifyOrReturnError(exampleOTAProvider != nullptr, CHIP_ERROR_INCORRECT_STATE); const uint32_t delay = strtoul(argv[0], nullptr, 10); - exampleOTAProvider->SetDelayedActionTimeSec(delay); + exampleOTAProvider->SetDelayedQueryActionTimeSec(delay); + exampleOTAProvider->SetDelayedApplyActionTimeSec(delay); return CHIP_NO_ERROR; } diff --git a/examples/ota-provider-app/linux/README.md b/examples/ota-provider-app/linux/README.md index 2de22c0ef6deec..b9693154bc1305 100644 --- a/examples/ota-provider-app/linux/README.md +++ b/examples/ota-provider-app/linux/README.md @@ -13,19 +13,20 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c ## Usage -| Command Line Options | Description | -| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| -f/--filepath | Path to a file containing an OTA image | -| -o/--otaImageList | Path to a file containing a list of OTA images | -| -q/--queryImageStatus | Value for the Status field in the QueryImageResponse | -| -x/--ignoreQueryImage | The number of times to ignore the QueryImage Command and not send a response | | -| -y/--ignoreApplyUpdate | The number of times to ignore the ApplyUpdate Request and not send a response | -| -a/--applyUpdateAction | Value for the Action field in the ApplyUpdateResponse | -| -t/--delayedActionTimeSec