Skip to content

Commit

Permalink
Change CLI option behavior for OTA-R and OTA-P to revert back to the …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
isiu-apple authored and pull[bot] committed Sep 21, 2023
1 parent 3530458 commit 4323356
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ DefaultSuccess
definedValue
DehumidificationControl
DelayedActionTime
delayedActionTimeSec
delayedApplyActionTimeSec
delayedQueryActionTimeSec
delayQuery
demangle
deployable
Expand Down
3 changes: 2 additions & 1 deletion examples/ota-provider-app/esp32/main/OTAProviderCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
27 changes: 14 additions & 13 deletions examples/ota-provider-app/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <file> | Path to a file containing an OTA image |
| -o/--otaImageList <file> | Path to a file containing a list of OTA images |
| -q/--queryImageStatus <updateAvailable \| busy \| updateNotAvailable> | Value for the Status field in the QueryImageResponse |
| -x/--ignoreQueryImage <num_times_to_ignore> | The number of times to ignore the QueryImage Command and not send a response | |
| -y/--ignoreApplyUpdate <num_times_to_ignore> | The number of times to ignore the ApplyUpdate Request and not send a response |
| -a/--applyUpdateAction <proceed \| awaitNextAction \| discontinue> | Value for the Action field in the ApplyUpdateResponse |
| -t/--delayedActionTimeSec <time> | Value in seconds for the DelayedActionTime field in the QueryImageResponse and ApplyUpdateResponse |
| -u/--userConsentState <granted \| denied \| deferred> | Current user consent state which results in various values for Status field in QueryImageResponse <br> Note that -q/--queryImageStatus overrides this option <li> granted: Status field in QueryImageResponse is set to updateAvailable <li> denied: Status field in QueryImageResponse is set to updateNotAvailable <li> deferred: Status field in QueryImageResponse is set to busy |
| -s/--softwareVersion <version> | Value for the SoftwareVersion field in the QueryImageResponse <br> Note that -o/--otaImageList overrides this option |
| -S/--softwareVersionStr <version string> | Value for the SoftwareVersionString field in the QueryImageResponse <br> Note that -o/--otaImageList overrides this option |
| -c/--UserConsentNeeded | If provided, and value of RequestorCanConsent field in QueryImage Command is true, <br> then value of UserConsentNeeded field in the QueryImageResponse is set to true. <br> Else, value of UserConsentNeeded is false. |
| Command Line Options | Description |
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -f/--filepath <file> | Path to a file containing an OTA image |
| -o/--otaImageList <file> | Path to a file containing a list of OTA images |
| -q/--queryImageStatus <updateAvailable \| busy \| updateNotAvailable> | Value for the Status field in the first QueryImageResponse. <br> For all subsequent responses, the value of updateAvailable will be used. |
| -x/--ignoreQueryImage <num_times_to_ignore> | The number of times to ignore the QueryImage Command and not send a response |
| -y/--ignoreApplyUpdate <num_times_to_ignore> | The number of times to ignore the ApplyUpdate Request and not send a response |
| -a/--applyUpdateAction <proceed \| awaitNextAction \| discontinue> | Value for the Action field in the first ApplyUpdateResponse. <br> For all subsequent responses, the value of proceed will be used. |
| -t/--delayedQueryActionTimeSec <time> | Value in seconds for the DelayedActionTime field in the first QueryImageResponse. <br> Value will revert back to 0 seconds on subsequent QueryImage Responses. |
| -p/--delayedApplyActionTimeSec <time> | Value in seconds for the DelayedActionTime field in the first ApplyUpdateResponse. <br> Value will revert back to 0 seconds on subsequent ApplyUpdate Responses. |
| -u/--userConsentState <granted \| denied \| deferred> | The user consent state for the first QueryImageResponse. For all subsequent responses, the value of granted state will be used. <br> Current user consent state which results in various values for Status field in QueryImageResponse <br> Note that -q/--queryImageStatus overrides this option <li> granted: Status field in QueryImageResponse is set to updateAvailable <li> denied: Status field in QueryImageResponse is set to updateNotAvailable <li> deferred: Status field in QueryImageResponse is set to busy |
| -s/--softwareVersion <version> | Value for the SoftwareVersion field in the QueryImageResponse <br> Note that -o/--otaImageList overrides this option |
| -S/--softwareVersionStr <version string> | Value for the SoftwareVersionString field in the QueryImageResponse <br> Note that -o/--otaImageList overrides this option |
| -c/--UserConsentNeeded | If provided, and value of RequestorCanConsent field in QueryImage Command is true, <br> then value of UserConsentNeeded field in the QueryImageResponse is set to true. <br> Else, value of UserConsentNeeded is false. |

**Using `--filepath` and `--otaImageList`**

Expand Down
Loading

0 comments on commit 4323356

Please sign in to comment.