Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTA Requestor Refactoring -- Part 1 #12119

Merged
merged 38 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
340ac67
Introduce ota-requestor.h containing Requestor API declarations
selissia Nov 9, 2021
69b31ed
Split OTA Requestor class declarations into multiple headers
selissia Nov 10, 2021
5d41f87
Restyled by whitespace
restyled-commits Nov 10, 2021
9d09e67
Restyled by clang-format
restyled-commits Nov 10, 2021
b0090d1
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
selissia Nov 10, 2021
d26a61f
Clean up comments and function names
selissia Nov 10, 2021
f43e100
Merge branch 'requestor_refactoring' into requestor_refactoring_1
selissia Nov 10, 2021
76a0893
Misc API format changes based on PR comments
selissia Nov 11, 2021
04d32ce
Restyled by clang-format
restyled-commits Nov 11, 2021
bac801b
Merge branch 'requestor_refactoring' into requestor_refactoring_1
selissia Nov 11, 2021
8de1c0e
First take at moving the core Requestor logic out of the Linux example
selissia Nov 12, 2021
1d04048
Further OTA Requestor refactoring -- moving logic out of Linux exampl…
selissia Nov 17, 2021
5b4681d
Further changes for OTA Rerquestor refactoring
selissia Nov 18, 2021
b564877
More OTA Requestor refactoring changes
selissia Nov 19, 2021
21b7aeb
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
selissia Nov 19, 2021
28f991b
Refactoring OTA Requestor. Code compiles and links with this commit
selissia Nov 22, 2021
bba6573
Further OTA Requestor refactoring. Requestor and chip-tool build succ…
selissia Nov 23, 2021
a6497dc
OTA Refactor:Only build clusters/ota-requestor in the context of Requ…
selissia Nov 23, 2021
5da0ea2
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
selissia Nov 23, 2021
c0d5276
OTA-Requestor: Initialize mOtaStartDelayMs
selissia Nov 23, 2021
2cd4185
Restyled by whitespace
restyled-commits Nov 23, 2021
be6a674
Restyled by clang-format
restyled-commits Nov 23, 2021
58a9376
Restyled by gn
restyled-commits Nov 23, 2021
74063c2
Push submodule pointers
selissia Nov 24, 2021
d8af129
Clean up an extra statement introduced by mistake
selissia Nov 24, 2021
7b00f09
Remove ExampleOTARequestor.cpp/h as they are replaced by the OTAReque…
selissia Nov 24, 2021
551ae69
Add OTA Requestor README
selissia Nov 24, 2021
19b3ce1
OTARequestor refactoring. With this the image transfer scenario works…
selissia Nov 28, 2021
74628ca
Requestor refactoring: Enable automatic ImageQuery in Test Mode
selissia Nov 29, 2021
92d5411
OTA Requestor refactoring -- add LinuxOTARequestorDriver.cpp, comments
selissia Nov 29, 2021
4d7d549
Requestor refactor: Rename and clean up files
selissia Nov 29, 2021
654328f
Restyled by whitespace
restyled-commits Nov 29, 2021
533d962
Restyled by clang-format
restyled-commits Nov 29, 2021
0356683
Restyled by gn
restyled-commits Nov 29, 2021
8965a65
Restyled by prettier-markdown
restyled-commits Nov 29, 2021
751ab77
OTA Requestor changes
selissia Nov 29, 2021
1543a39
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
selissia Nov 29, 2021
eeb3d43
Remove unused variable
selissia Nov 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ lightin
LightingColor
LightingState
LinkSoftwareAndDocumentationPack
LinuxOTARequestorDriver
LocalConfigDisabled
localhost
localstatedir
Expand Down Expand Up @@ -694,9 +695,13 @@ optionsMask
optionsOverride
orgs
OTA
OTADownloader
OTAImageProcessorDriver
OTAProviderIpAddress
OTAProviderNodeId
OTAProviderSerialPort
OTARequestor
OTARequestorDriver
OTARequesterImpl
OTARequestorSerialPort
OTBR
Expand Down Expand Up @@ -851,7 +856,10 @@ SERIALDEVICE
SerialNumber
ServiceId
SetDns
SetImageProcessorDelegate
SetOtaRequestorDriver
SetpointRaiseLower
SetRequestorInstance
SetUpPINCode
SetupQRCode
sexualized
Expand Down
5 changes: 4 additions & 1 deletion examples/ota-requestor-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

executable("chip-ota-requestor-app") {
sources = [ "main.cpp" ]
sources = [
"LinuxOTARequestorDriver.cpp",
"main.cpp",
]

deps = [
"${chip_root}/examples/ota-requestor-app/ota-requestor-common",
Expand Down
45 changes: 45 additions & 0 deletions examples/ota-requestor-app/linux/LinuxOTAImageProcessor.h
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 examples/ota-requestor-app/linux/LinuxOTARequestorDriver.cpp
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 examples/ota-requestor-app/linux/LinuxOTARequestorDriver.h
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
};
Loading