forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrfconnect] Splitted building with Matter OTA and DFU over SMP
Currently when enabling Matter OTA DFU, the another DFU over Bluetooth LE using SMP configuration is also enabled. It should be available to enable independently. * Enabled Matter OTA by default for lighting-app * Modified cmake BUILD_WITH_DFU option to allow disabling DFU support, enabling Matter OTA DFU and enabling Matter OTA DFU + DFU over Bluetooth LE * Splitted config overlays to extract common DFU parts from SMP specific ones. * Updated examples documentation
- Loading branch information
1 parent
150c479
commit 4f49760
Showing
20 changed files
with
3,289 additions
and
51 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf
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,22 @@ | ||
# | ||
# Copyright (c) 2022 Project CHIP Authors | ||
# | ||
# 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. | ||
# | ||
|
||
CONFIG_BOOTLOADER_MCUBOOT=y | ||
|
||
# QSPI configuration | ||
CONFIG_NORDIC_QSPI_NOR=y | ||
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 | ||
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 |
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
2 changes: 1 addition & 1 deletion
2
...app/overlay-single_image_dfu_support.conf → ...overlay-single_image_smp_dfu_support.conf
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
170 changes: 170 additions & 0 deletions
170
examples/lighting-app/lighting-common/gen-new/CHIPClientCallbacks.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,170 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* | ||
* 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 IS GENERATED BY ZAP | ||
|
||
#include <zap-generated/CHIPClientCallbacks.h> | ||
|
||
#include <cinttypes> | ||
|
||
#include <app-common/zap-generated/enums.h> | ||
#include <app/util/af.h> | ||
#include <app/util/af-enums.h> | ||
#include <app/util/basic-types.h> | ||
#include <app/util/CHIPDeviceCallbacksMgr.h> | ||
#include <lib/core/CHIPEncoding.h> | ||
#include <lib/support/SafeInt.h> | ||
#include <lib/support/TypeTraits.h> | ||
#include <lib/support/logging/CHIPLogging.h> | ||
|
||
using namespace ::chip; | ||
using namespace ::chip::app::DataModel; | ||
|
||
namespace { | ||
[[maybe_unused]] constexpr uint16_t kByteSpanSizeLengthInBytes = 2; | ||
} // namespace | ||
|
||
|
||
#define CHECK_STATUS_WITH_RETVAL(error, retval) \ | ||
if (CHIP_NO_ERROR != error) \ | ||
{ \ | ||
ChipLogError(Zcl, "CHECK_STATUS %s", ErrorStr(error)); \ | ||
if (onFailureCallback != nullptr) \ | ||
{ \ | ||
Callback::Callback<DefaultFailureCallback> * cb = \ | ||
Callback::Callback<DefaultFailureCallback>::FromCancelable(onFailureCallback); \ | ||
cb->mCall(cb->mContext, static_cast<uint8_t>(EMBER_ZCL_STATUS_INVALID_VALUE)); \ | ||
} \ | ||
return retval; \ | ||
} | ||
|
||
#define CHECK_STATUS(error) CHECK_STATUS_WITH_RETVAL(error, true) | ||
#define CHECK_STATUS_VOID(error) CHECK_STATUS_WITH_RETVAL(error, ) | ||
|
||
#define CHECK_MESSAGE_LENGTH_WITH_RETVAL(value, retval) \ | ||
if (!CanCastTo<uint16_t>(value)) \ | ||
{ \ | ||
ChipLogError(Zcl, "CHECK_MESSAGE_LENGTH expects a uint16_t value, got: %d", value); \ | ||
if (onFailureCallback != nullptr) \ | ||
{ \ | ||
Callback::Callback<DefaultFailureCallback> * cb = \ | ||
Callback::Callback<DefaultFailureCallback>::FromCancelable(onFailureCallback); \ | ||
cb->mCall(cb->mContext, static_cast<uint8_t>(EMBER_ZCL_STATUS_INVALID_VALUE)); \ | ||
} \ | ||
return retval; \ | ||
} \ | ||
\ | ||
if (messageLen < value) \ | ||
{ \ | ||
ChipLogError(Zcl, "Unexpected response length: %d", messageLen); \ | ||
if (onFailureCallback != nullptr) \ | ||
{ \ | ||
Callback::Callback<DefaultFailureCallback> * cb = \ | ||
Callback::Callback<DefaultFailureCallback>::FromCancelable(onFailureCallback); \ | ||
cb->mCall(cb->mContext, static_cast<uint8_t>(EMBER_ZCL_STATUS_INVALID_VALUE)); \ | ||
} \ | ||
return retval; \ | ||
} \ | ||
\ | ||
messageLen = static_cast<uint16_t>(messageLen - static_cast<uint16_t>(value)); | ||
|
||
#define CHECK_MESSAGE_LENGTH(value) CHECK_MESSAGE_LENGTH_WITH_RETVAL(value, true) | ||
#define CHECK_MESSAGE_LENGTH_VOID(value) CHECK_MESSAGE_LENGTH_WITH_RETVAL(value, ) | ||
|
||
#define GET_RESPONSE_CALLBACKS(name) \ | ||
Callback::Cancelable * onSuccessCallback = nullptr; \ | ||
Callback::Cancelable * onFailureCallback = nullptr; \ | ||
NodeId sourceId = emberAfCurrentCommand()->SourceNodeId(); \ | ||
uint8_t sequenceNumber = emberAfCurrentCommand()->seqNum; \ | ||
CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceId, sequenceNumber, &onSuccessCallback, &onFailureCallback); \ | ||
\ | ||
if (CHIP_NO_ERROR != err) \ | ||
{ \ | ||
if (onSuccessCallback == nullptr) \ | ||
{ \ | ||
ChipLogDetail(Zcl, "%s: Missing success callback", name); \ | ||
} \ | ||
\ | ||
if (onFailureCallback == nullptr) \ | ||
{ \ | ||
ChipLogDetail(Zcl, "%s: Missing failure callback", name); \ | ||
} \ | ||
\ | ||
return true; \ | ||
} | ||
|
||
|
||
#define GET_CLUSTER_RESPONSE_CALLBACKS(name) \ | ||
Callback::Cancelable * onSuccessCallback = nullptr; \ | ||
Callback::Cancelable * onFailureCallback = nullptr; \ | ||
NodeId sourceIdentifier = reinterpret_cast<NodeId>(commandObj); \ | ||
/* #6559: Currently, we only have one commands for the IMInvokeCommands and to a device, so the seqNum is always set to 0. */ \ | ||
CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceIdentifier, 0, &onSuccessCallback, &onFailureCallback); \ | ||
\ | ||
if (CHIP_NO_ERROR != err) \ | ||
{ \ | ||
if (onSuccessCallback == nullptr) \ | ||
{ \ | ||
ChipLogDetail(Zcl, "%s: Missing success callback", name); \ | ||
} \ | ||
\ | ||
if (onFailureCallback == nullptr) \ | ||
{ \ | ||
ChipLogDetail(Zcl, "%s: Missing failure callback", name); \ | ||
} \ | ||
\ | ||
return true; \ | ||
} | ||
|
||
|
||
|
||
// Singleton instance of the callbacks manager | ||
app::CHIPDeviceCallbacksMgr & gCallbacks = app::CHIPDeviceCallbacksMgr::GetInstance(); | ||
|
||
|
||
bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t action, uint32_t delayedActionTime) | ||
{ | ||
ChipLogProgress(Zcl, "ApplyUpdateResponse:"); | ||
ChipLogProgress(Zcl, " action: %" PRIu8 "", action); | ||
ChipLogProgress(Zcl, " delayedActionTime: %" PRIu32 "", delayedActionTime); | ||
|
||
GET_CLUSTER_RESPONSE_CALLBACKS("OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback"); | ||
|
||
Callback::Callback<OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback> * cb = Callback::Callback<OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback>::FromCancelable(onSuccessCallback); | ||
cb->mCall(cb->mContext, action, delayedActionTime); | ||
return true; | ||
} | ||
|
||
bool emberAfOtaSoftwareUpdateProviderClusterQueryImageResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, uint32_t delayedActionTime, chip::CharSpan imageURI, uint32_t softwareVersion, chip::CharSpan softwareVersionString, chip::ByteSpan updateToken, bool userConsentNeeded, chip::ByteSpan metadataForRequestor) | ||
{ | ||
ChipLogProgress(Zcl, "QueryImageResponse:"); | ||
ChipLogProgress(Zcl, " status: %" PRIu8 "", status); | ||
ChipLogProgress(Zcl, " delayedActionTime: %" PRIu32 "", delayedActionTime); | ||
ChipLogProgress(Zcl, " imageURI: %.*s", static_cast<int>(imageURI.size()), imageURI.data()); | ||
ChipLogProgress(Zcl, " softwareVersion: %" PRIu32 "", softwareVersion); | ||
ChipLogProgress(Zcl, " softwareVersionString: %.*s", static_cast<int>(softwareVersionString.size()), softwareVersionString.data()); | ||
ChipLogProgress(Zcl, " updateToken: %zu", updateToken.size()); | ||
ChipLogProgress(Zcl, " userConsentNeeded: %d", userConsentNeeded); | ||
ChipLogProgress(Zcl, " metadataForRequestor: %zu", metadataForRequestor.size()); | ||
|
||
GET_CLUSTER_RESPONSE_CALLBACKS("OtaSoftwareUpdateProviderClusterQueryImageResponseCallback"); | ||
|
||
Callback::Callback<OtaSoftwareUpdateProviderClusterQueryImageResponseCallback> * cb = Callback::Callback<OtaSoftwareUpdateProviderClusterQueryImageResponseCallback>::FromCancelable(onSuccessCallback); | ||
cb->mCall(cb->mContext, status, delayedActionTime, imageURI, softwareVersion, softwareVersionString, updateToken, userConsentNeeded, metadataForRequestor); | ||
return true; | ||
} | ||
|
41 changes: 41 additions & 0 deletions
41
examples/lighting-app/lighting-common/gen-new/CHIPClientCallbacks.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,41 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* | ||
* 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 IS GENERATED BY ZAP | ||
|
||
#pragma once | ||
|
||
#include <app/InteractionModelEngine.h> | ||
#include <app-common/zap-generated/af-structs.h> | ||
#include <app-common/zap-generated/cluster-objects.h> | ||
#include <app/data-model/DecodableList.h> | ||
#include <app/util/af-enums.h> | ||
#include <app/util/attribute-filter.h> | ||
#include <app/util/im-client-callbacks.h> | ||
#include <inttypes.h> | ||
#include <lib/support/FunctionTraits.h> | ||
#include <lib/support/Span.h> | ||
|
||
// Note: The IMDefaultResponseCallback is a bridge to the old CallbackMgr before IM is landed, so it still accepts EmberAfStatus | ||
// instead of IM status code. | ||
// #6308 should handle IM error code on the application side, either modify this function or remove this. | ||
|
||
// Cluster Specific Response Callbacks | ||
typedef void (*OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback)(void * context, uint8_t action, uint32_t delayedActionTime); | ||
typedef void (*OtaSoftwareUpdateProviderClusterQueryImageResponseCallback)(void * context, uint8_t status, uint32_t delayedActionTime, chip::CharSpan imageURI, uint32_t softwareVersion, chip::CharSpan softwareVersionString, chip::ByteSpan updateToken, bool userConsentNeeded, chip::ByteSpan metadataForRequestor); | ||
|
||
// List specific responses |
Oops, something went wrong.