-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OTA Requestor Refactoring -- Part 1 (#12119)
* Introduce ota-requestor.h containing Requestor API declarations * Split OTA Requestor class declarations into multiple headers * Restyled by whitespace * Restyled by clang-format * Clean up comments and function names * Misc API format changes based on PR comments * Restyled by clang-format * First take at moving the core Requestor logic out of the Linux example * Further OTA Requestor refactoring -- moving logic out of Linux example app * Further changes for OTA Rerquestor refactoring * More OTA Requestor refactoring changes * Refactoring OTA Requestor. Code compiles and links with this commit * Further OTA Requestor refactoring. Requestor and chip-tool build successfully. The top-level build fails for all-cluster app. * OTA Refactor:Only build clusters/ota-requestor in the context of Requestor app Update .gn files so that clusters/ota-requestor is not built for all example apps (this is different from the rest of the clusters). Instead, explicitly specify clusters/ota-requestor sources in the OTA-Requestor example app * OTA-Requestor: Initialize mOtaStartDelayMs * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Push submodule pointers * Clean up an extra statement introduced by mistake * Remove ExampleOTARequestor.cpp/h as they are replaced by the OTARequestor.cpp/h * Add OTA Requestor README * OTARequestor refactoring. With this the image transfer scenario works on Linux: rm -r /tmp/chip_* ./out/debug/chip-ota-provider-app -f /tmp/ota.txt ./out/chip-tool pairing onnetwork 1 20202021 ./out/debug/chip-ota-requestor-app -u 5560 -d 42 -i ::1 ./out/chip-tool pairing onnetwork-long 2 20202021 42 ./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 2 0 * Requestor refactoring: Enable automatic ImageQuery in Test Mode * OTA Requestor refactoring -- add LinuxOTARequestorDriver.cpp, comments * Requestor refactor: Rename and clean up files * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * OTA Requestor changes * Remove unused variable Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
1 parent
7e99454
commit 42d842c
Showing
20 changed files
with
809 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* This file contains the decalarions for the Linux implementation of the | ||
* the OTAImageProcessorDriver interface class | ||
*/ | ||
|
||
#include "app/clusters/ota-requestor/OTAImageProcessor.h" | ||
|
||
class LinuxOTAImageProcessor : public OTAImageProcessorDriver | ||
{ | ||
|
||
// Virtuial functions from OTAImageProcessorDriver -- start | ||
// Open file, find block of space in persistent memory, or allocate a buffer, etc. | ||
CHIP_ERROR PrepareDownload() { return CHIP_NO_ERROR; } | ||
|
||
// Must not be a blocking call to support cases that require IO to elements such as // external peripherals/radios | ||
CHIP_ERROR ProcessBlock(chip::ByteSpan & data) { return CHIP_NO_ERROR; } | ||
|
||
// Close file, close persistent storage, etc | ||
CHIP_ERROR Finalize() { return CHIP_NO_ERROR; } | ||
|
||
chip::Optional<uint8_t> PercentComplete() { return chip::Optional<uint8_t>(0); } | ||
|
||
// Clean up the download which could mean erasing everything that was written, | ||
// releasing buffers, etc. | ||
CHIP_ERROR Abort() { return CHIP_NO_ERROR; } | ||
|
||
// Virtuial functions from OTAImageProcessorDriver -- end | ||
}; |
34 changes: 34 additions & 0 deletions
34
examples/ota-requestor-app/linux/LinuxOTARequestorDriver.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* This file contains the Linux implementation of the OTAImageProcessorDriver | ||
* interface class | ||
*/ | ||
|
||
#include "LinuxOTARequestorDriver.h" | ||
|
||
// A call into the application logic to give it a chance to allow or stop the Requestor | ||
// from proceeding with actual image download. Returning TRUE will allow the download | ||
// to proceed, returning FALSE will abort the download process. | ||
bool LinuxOTARequestorDriver::CheckImageDownloadAllowed() | ||
{ | ||
return true; | ||
} | ||
|
||
// Notify the application that the download is complete and the image can be applied | ||
void LinuxOTARequestorDriver::ImageDownloadComplete() {} |
38 changes: 38 additions & 0 deletions
38
examples/ota-requestor-app/linux/LinuxOTARequestorDriver.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* This file contains the decalarions for the Linux implementation of the | ||
* the OTARequestorDriver interface class | ||
*/ | ||
#include "app/clusters/ota-requestor/OTARequestorDriver.h" | ||
|
||
class LinuxOTARequestorDriver : public OTARequestorDriver | ||
{ | ||
|
||
// Virtual functions from OTARequestorDriver -- start | ||
|
||
// A call into the application logic to give it a chance to allow or stop the Requestor | ||
// from proceeding with actual image download. Returning TRUE will allow the download | ||
// to proceed, returning FALSE will abort the download process. | ||
bool CheckImageDownloadAllowed(); | ||
|
||
// Notify the application that the download is complete and the image can be applied | ||
void ImageDownloadComplete(); | ||
|
||
// Virtual functions from OTARequestorDriver -- end | ||
}; |
Oops, something went wrong.