diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index e021520de92704..26c7b363a154be 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -18,9 +18,7 @@ #include -#include -#include -#include +#include #include #include #include @@ -31,12 +29,10 @@ #include using chip::ByteSpan; +using chip::CharSpan; +using chip::Optional; using chip::Span; -using chip::app::CommandPathFlags; -using chip::app::CommandPathParams; using chip::app::Clusters::OTAProviderDelegate; -using chip::TLV::ContextTag; -using chip::TLV::TLVWriter; constexpr uint8_t kUpdateTokenLen = 32; // must be between 8 and 32 constexpr uint8_t kUpdateTokenStrLen = kUpdateTokenLen * 2 + 1; // Hex string needs 2 hex chars for every byte @@ -97,10 +93,12 @@ void OTAProviderExample::SetOTAFilePath(const char * path) } } -EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, - uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, - const chip::Span & location, bool requestorCanConsent, - const chip::ByteSpan & metadataForProvider) +EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, uint16_t vendorId, + uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + const Optional & hardwareVersion, const Optional & location, + const Optional & requestorCanConsent, + const Optional & metadataForProvider) { // TODO: add confiuration for returning BUSY status @@ -151,29 +149,27 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c queryStatus = EMBER_ZCL_OTA_QUERY_STATUS_NOT_AVAILABLE; } - CommandPathParams cmdParams = { emberAfCurrentEndpoint(), 0 /* mGroupId */, ZCL_OTA_PROVIDER_CLUSTER_ID, - ZCL_QUERY_IMAGE_RESPONSE_COMMAND_ID, (CommandPathFlags::kEndpointIdValid) }; - TLVWriter * writer = nullptr; - uint8_t tagNum = 0; - VerifyOrReturnError((commandObj->PrepareCommand(cmdParams) == CHIP_NO_ERROR), EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(tagNum++), queryStatus) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(tagNum++), mDelayedActionTimeSec) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->PutString(ContextTag(tagNum++), uriBuf) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(tagNum++), newSoftwareVersion) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->PutString(ContextTag(tagNum++), kExampleSoftwareString) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->PutBytes(ContextTag(tagNum++), updateToken, kUpdateTokenLen) == CHIP_NO_ERROR, - EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(tagNum++), userConsentNeeded) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->PutBytes(ContextTag(tagNum++), updateToken, kUpdateTokenLen) == CHIP_NO_ERROR, - EMBER_ZCL_STATUS_FAILURE); // metadata - VerifyOrReturnError((commandObj->FinishCommand() == CHIP_NO_ERROR), EMBER_ZCL_STATUS_FAILURE); - + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Type response; + response.status = queryStatus; + response.delayedActionTime = mDelayedActionTimeSec; + response.imageURI = chip::CharSpan(uriBuf, strlen(uriBuf)); + response.softwareVersion = newSoftwareVersion; + response.softwareVersionString = chip::CharSpan(kExampleSoftwareString, strlen(kExampleSoftwareString)); + response.updateToken = chip::ByteSpan(updateToken); + response.userConsentNeeded = userConsentNeeded; + // TODO: Once our client is using APIs that handle optional arguments + // correctly, update QueryImageResponse to have the right things optional. + // At that point we can decide whether to send metadataForRequestor as an + // empty ByteSpan or whether to not send it at all. + response.metadataForRequestor = chip::ByteSpan(); + + VerifyOrReturnError(commandObj->AddResponseData(commandPath, response) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); return EMBER_ZCL_STATUS_SUCCESS; } EmberAfStatus OTAProviderExample::HandleApplyUpdateRequest(chip::app::CommandHandler * commandObj, - const chip::ByteSpan & updateToken, uint32_t newVersion) + const chip::app::ConcreteCommandPath & commandPath, + const ByteSpan & updateToken, uint32_t newVersion) { // TODO: handle multiple transfers by tracking updateTokens @@ -185,15 +181,10 @@ EmberAfStatus OTAProviderExample::HandleApplyUpdateRequest(chip::app::CommandHan VerifyOrReturnError(commandObj != nullptr, EMBER_ZCL_STATUS_INVALID_VALUE); - CommandPathParams cmdParams = { emberAfCurrentEndpoint(), 0 /* mGroupId */, ZCL_OTA_PROVIDER_CLUSTER_ID, - ZCL_APPLY_UPDATE_REQUEST_RESPONSE_COMMAND_ID, (CommandPathFlags::kEndpointIdValid) }; - TLVWriter * writer = nullptr; - - VerifyOrReturnError((commandObj->PrepareCommand(cmdParams) == CHIP_NO_ERROR), EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(0), updateAction) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError(writer->Put(ContextTag(1), mDelayedActionTimeSec) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - VerifyOrReturnError((commandObj->FinishCommand() == CHIP_NO_ERROR), EMBER_ZCL_STATUS_FAILURE); + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Type response; + response.action = updateAction; + response.delayedActionTime = mDelayedActionTimeSec; + VerifyOrReturnError(commandObj->AddResponseData(commandPath, response) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); return EMBER_ZCL_STATUS_SUCCESS; } diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h index f5107b34e5aee9..854fc0f3fb0db8 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h @@ -32,11 +32,14 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate void SetOTAFilePath(const char * path); // Inherited from OTAProviderDelegate - EmberAfStatus HandleQueryImage(chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, - uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, - const chip::Span & location, bool requestorCanConsent, - const chip::ByteSpan & metadataForServer) override; - EmberAfStatus HandleApplyUpdateRequest(chip::app::CommandHandler * commandObj, const chip::ByteSpan & updateToken, + EmberAfStatus HandleQueryImage(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + uint16_t vendorId, uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + const chip::Optional & hardwareVersion, + const chip::Optional & location, + const chip::Optional & requestorCanConsent, + const chip::Optional & metadataForServer) override; + EmberAfStatus HandleApplyUpdateRequest(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, const chip::ByteSpan & updateToken, uint32_t newVersion) override; EmberAfStatus HandleNotifyUpdateApplied(const chip::ByteSpan & updateToken, uint32_t softwareVersion) override; diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index bcec4be7d50356..fe3b188be8ba08 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -175,9 +175,8 @@ void OnConnected(void * context, OperationalDeviceProxy * operationalDeviceProxy ChipLogError(SoftwareUpdate, "Associate() failed: %" CHIP_ERROR_FORMAT, err.Format()); return; } - err = cluster.QueryImage(successCallback, failureCallback, kExampleVendorId, kExampleProductId, kExampleHWVersion, - kExampleSoftwareVersion, kExampleProtocolsSupported, exampleLocation, kExampleClientCanConsent, - metadata); + err = cluster.QueryImage(successCallback, failureCallback, kExampleVendorId, kExampleProductId, kExampleSoftwareVersion, + kExampleProtocolsSupported, kExampleHWVersion, exampleLocation, kExampleClientCanConsent, metadata); if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "QueryImage() failed: %" CHIP_ERROR_FORMAT, err.Format()); diff --git a/src/app/clusters/ota-provider/ota-provider-delegate.h b/src/app/clusters/ota-provider/ota-provider-delegate.h index b9e2d82935c0f9..cc18a79afb9bdd 100644 --- a/src/app/clusters/ota-provider/ota-provider-delegate.h +++ b/src/app/clusters/ota-provider/ota-provider-delegate.h @@ -20,7 +20,9 @@ #include #include +#include #include +#include namespace chip { namespace app { @@ -34,13 +36,14 @@ class OTAProviderDelegate { public: // TODO(#8605): protocolsSupported should be list of OTADownloadProtocol enums, not uint8_t - virtual EmberAfStatus HandleQueryImage(CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, - uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, - const chip::Span & location, bool requestorCanConsent, - const chip::ByteSpan & metadataForProvider) = 0; - - virtual EmberAfStatus HandleApplyUpdateRequest(CommandHandler * commandObj, const chip::ByteSpan & updateToken, - uint32_t newVersion) = 0; + virtual EmberAfStatus HandleQueryImage(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, uint16_t vendorId, + uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + const Optional & hardwareVersion, const Optional & location, + const Optional & requestorCanConsent, + const Optional & metadataForProvider) = 0; + + virtual EmberAfStatus HandleApplyUpdateRequest(CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::ByteSpan & updateToken, uint32_t newVersion) = 0; virtual EmberAfStatus HandleNotifyUpdateApplied(const chip::ByteSpan & updateToken, uint32_t softwareVersion) = 0; diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index 52855f003e1949..a2da67b9521e1b 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -92,7 +92,7 @@ bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback( emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_ARGUMENT); } - status = delegate->HandleApplyUpdateRequest(commandObj, updateToken, newVersion); + status = delegate->HandleApplyUpdateRequest(commandObj, commandPath, updateToken, newVersion); if (status != EMBER_ZCL_STATUS_SUCCESS) { emberAfSendImmediateDefaultResponse(status); @@ -189,27 +189,39 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandl ChipLogDetail(Zcl, " ProductID: %" PRIu16, productId); ChipLogDetail(Zcl, " SoftwareVersion: %" PRIu32, softwareVersion); ChipLogDetail(Zcl, " ProtocolsSupported: %" PRIu8, protocolsSupported); - ChipLogDetail(Zcl, " HardwareVersion: %" PRIu16, hardwareVersion); - ChipLogDetail(Zcl, " Location: %.*s", static_cast(location.size()), location.data()); - ChipLogDetail(Zcl, " RequestorCanConsent: %" PRIu8, requestorCanConsent); - ChipLogDetail(Zcl, " MetadataForProvider: %zu", metadataForProvider.size()); + if (hardwareVersion.HasValue()) + { + ChipLogDetail(Zcl, " HardwareVersion: %" PRIu16, hardwareVersion.Value()); + } + if (location.HasValue()) + { + ChipLogDetail(Zcl, " Location: %.*s", static_cast(location.Value().size()), location.Value().data()); + } + if (requestorCanConsent.HasValue()) + { + ChipLogDetail(Zcl, " RequestorCanConsent: %" PRIu8, requestorCanConsent.Value()); + } + if (metadataForProvider.HasValue()) + { + ChipLogDetail(Zcl, " MetadataForProvider: %zu", metadataForProvider.Value().size()); + } - if (location.size() != kLocationLen) + if (location.HasValue() && location.Value().size() != kLocationLen) { - ChipLogError(Zcl, "location param length %zu != expected length %zu", location.size(), kLocationLen); + ChipLogError(Zcl, "location param length %zu != expected length %zu", location.Value().size(), kLocationLen); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_ARGUMENT); return true; } - if (metadataForProvider.size() > kMaxMetadataLen) + if (metadataForProvider.HasValue() && metadataForProvider.Value().size() > kMaxMetadataLen) { - ChipLogError(Zcl, "metadata size %zu exceeds max %zu", metadataForProvider.size(), kMaxMetadataLen); + ChipLogError(Zcl, "metadata size %zu exceeds max %zu", metadataForProvider.Value().size(), kMaxMetadataLen); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_ARGUMENT); return true; } - status = delegate->HandleQueryImage(commandObj, vendorId, productId, hardwareVersion, softwareVersion, protocolsSupported, - location, requestorCanConsent, metadataForProvider); + status = delegate->HandleQueryImage(commandObj, commandPath, vendorId, productId, softwareVersion, protocolsSupported, + hardwareVersion, location, requestorCanConsent, metadataForProvider); if (status != EMBER_ZCL_STATUS_SUCCESS) { emberAfSendImmediateDefaultResponse(status); diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml b/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml index cc35fc625949ed..37f71a164e82eb 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-ota.xml @@ -43,18 +43,18 @@ limitations under the License. OTA_PROVIDER_CLUSTER true true - + Determine availability of a new Software Image - + - - - - + + + + - + Determine next action to take for a new Software Image @@ -75,7 +75,7 @@ limitations under the License. - + Reponse to ApplyUpdateRequest command diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index cb869bb7d511ca..16092a72f7ac34 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -4781,12 +4781,12 @@ class CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback jobject javaCallbackRef; }; -class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback - : public Callback::Callback +class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback + : public Callback::Callback { public: - CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback(jobject javaCallback) : - Callback::Callback(CallbackFn, this) + CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -4801,7 +4801,7 @@ class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback ChipLogError(Zcl, "Could not create global reference for Java callback"); } } - ~CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback() + ~CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -4819,11 +4819,11 @@ class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); jobject javaCallbackRef; jmethodID javaMethod; - CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback * cppCallback = nullptr; + CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback * cppCallback = nullptr; VerifyOrExit(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV); - cppCallback = reinterpret_cast(context); + cppCallback = reinterpret_cast(context); VerifyOrExit(cppCallback != nullptr, err = CHIP_JNI_ERROR_NULL_OBJECT); javaCallbackRef = cppCallback->javaCallbackRef; @@ -22000,10 +22000,10 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, applyUpdateRequest) JniByteArray updateTokenArr(env, updateToken); - std::unique_ptr - onSuccess(Platform::New(callback), - Platform::Delete); + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); std::unique_ptr onFailure( Platform::New(callback), Platform::Delete); VerifyOrExit(onSuccess.get() != nullptr, err = CHIP_ERROR_INCORRECT_STATE); @@ -22096,8 +22096,8 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, notifyUpdateApplied) } } JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, queryImage) -(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint vendorId, jint productId, jint hardwareVersion, - jlong softwareVersion, jint protocolsSupported, jstring location, jboolean requestorCanConsent, jbyteArray metadataForProvider) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint vendorId, jint productId, jlong softwareVersion, + jint protocolsSupported, jint hardwareVersion, jstring location, jboolean requestorCanConsent, jbyteArray metadataForProvider) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -22118,8 +22118,8 @@ JNI_METHOD(void, OtaSoftwareUpdateProviderCluster, queryImage) cppCluster = reinterpret_cast(clusterPtr); VerifyOrExit(cppCluster != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - err = cppCluster->QueryImage(onSuccess->Cancel(), onFailure->Cancel(), vendorId, productId, hardwareVersion, softwareVersion, - static_cast(protocolsSupported), + err = cppCluster->QueryImage(onSuccess->Cancel(), onFailure->Cancel(), static_cast(vendorId), productId, + softwareVersion, static_cast(protocolsSupported), hardwareVersion, chip::CharSpan(locationStr.c_str(), strlen(locationStr.c_str())), requestorCanConsent, chip::ByteSpan((const uint8_t *) metadataForProviderArr.data(), metadataForProviderArr.size())); SuccessOrExit(err); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index a7a8c41b77c283..b03b41c30ac20d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -4490,7 +4490,7 @@ public static long clusterId() { public native long initWithDevice(long devicePtr, int endpointId); public void applyUpdateRequest( - ApplyUpdateRequestResponseCallback callback, byte[] updateToken, long newVersion) { + ApplyUpdateResponseCallback callback, byte[] updateToken, long newVersion) { applyUpdateRequest(chipClusterPtr, callback, updateToken, newVersion); } @@ -4503,9 +4503,9 @@ public void queryImage( QueryImageResponseCallback callback, int vendorId, int productId, - int hardwareVersion, long softwareVersion, int protocolsSupported, + int hardwareVersion, String location, boolean requestorCanConsent, byte[] metadataForProvider) { @@ -4514,9 +4514,9 @@ public void queryImage( callback, vendorId, productId, - hardwareVersion, softwareVersion, protocolsSupported, + hardwareVersion, location, requestorCanConsent, metadataForProvider); @@ -4524,7 +4524,7 @@ public void queryImage( private native void applyUpdateRequest( long chipClusterPtr, - ApplyUpdateRequestResponseCallback callback, + ApplyUpdateResponseCallback callback, byte[] updateToken, long newVersion); @@ -4539,14 +4539,14 @@ private native void queryImage( QueryImageResponseCallback callback, int vendorId, int productId, - int hardwareVersion, long softwareVersion, int protocolsSupported, + int hardwareVersion, String location, boolean requestorCanConsent, byte[] metadataForProvider); - public interface ApplyUpdateRequestResponseCallback { + public interface ApplyUpdateResponseCallback { void onSuccess(int action, long delayedActionTime); void onError(Exception error); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index fe366bbf9678f8..56a412f5039bab 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -1417,8 +1417,8 @@ public void onError(Exception error) { } } - public class DelegatedApplyUpdateRequestResponseCallback - implements ChipClusters.OtaSoftwareUpdateProviderCluster.ApplyUpdateRequestResponseCallback, + public class DelegatedApplyUpdateResponseCallback + implements ChipClusters.OtaSoftwareUpdateProviderCluster.ApplyUpdateResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -5706,7 +5706,7 @@ public Map getClusterMap() { CommandParameterInfo otaSoftwareUpdateProviderapplyUpdateRequestCommandParameterInfo = new CommandParameterInfo( "OtaSoftwareUpdateProvider", - ChipClusters.OtaSoftwareUpdateProviderCluster.ApplyUpdateRequestResponseCallback.class); + ChipClusters.OtaSoftwareUpdateProviderCluster.ApplyUpdateResponseCallback.class); CommandParameterInfo otaSoftwareUpdateProviderapplyUpdateRequestupdateTokenCommandParameterInfo = new CommandParameterInfo("updateToken", byte[].class); @@ -5724,13 +5724,12 @@ public Map getClusterMap() { (cluster, callback, commandArguments) -> { ((ChipClusters.OtaSoftwareUpdateProviderCluster) cluster) .applyUpdateRequest( - (ChipClusters.OtaSoftwareUpdateProviderCluster - .ApplyUpdateRequestResponseCallback) + (ChipClusters.OtaSoftwareUpdateProviderCluster.ApplyUpdateResponseCallback) callback, (byte[]) commandArguments.get("updateToken"), (Long) commandArguments.get("newVersion")); }, - () -> new DelegatedApplyUpdateRequestResponseCallback(), + () -> new DelegatedApplyUpdateResponseCallback(), otaSoftwareUpdateProviderapplyUpdateRequestCommandParams); otaSoftwareUpdateProviderClusterCommandInfoMap.put( "applyUpdateRequest", otaSoftwareUpdateProviderapplyUpdateRequestCommandInfo); @@ -5782,11 +5781,6 @@ public Map getClusterMap() { otaSoftwareUpdateProviderqueryImageCommandParams.put( "productId", otaSoftwareUpdateProviderqueryImageproductIdCommandParameterInfo); - CommandParameterInfo otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo = - new CommandParameterInfo("hardwareVersion", int.class); - otaSoftwareUpdateProviderqueryImageCommandParams.put( - "hardwareVersion", otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo); - CommandParameterInfo otaSoftwareUpdateProviderqueryImagesoftwareVersionCommandParameterInfo = new CommandParameterInfo("softwareVersion", long.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( @@ -5798,6 +5792,11 @@ public Map getClusterMap() { "protocolsSupported", otaSoftwareUpdateProviderqueryImageprotocolsSupportedCommandParameterInfo); + CommandParameterInfo otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo = + new CommandParameterInfo("hardwareVersion", int.class); + otaSoftwareUpdateProviderqueryImageCommandParams.put( + "hardwareVersion", otaSoftwareUpdateProviderqueryImagehardwareVersionCommandParameterInfo); + CommandParameterInfo otaSoftwareUpdateProviderqueryImagelocationCommandParameterInfo = new CommandParameterInfo("location", String.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( @@ -5827,9 +5826,9 @@ public Map getClusterMap() { callback, (Integer) commandArguments.get("vendorId"), (Integer) commandArguments.get("productId"), - (Integer) commandArguments.get("hardwareVersion"), (Long) commandArguments.get("softwareVersion"), (Integer) commandArguments.get("protocolsSupported"), + (Integer) commandArguments.get("hardwareVersion"), (String) commandArguments.get("location"), (Boolean) commandArguments.get("requestorCanConsent"), (byte[]) commandArguments.get("metadataForProvider")); diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 093221538d11c7..2585a4957123b6 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -5773,15 +5773,15 @@ chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_No return cluster.NotifyUpdateApplied(nullptr, nullptr, chip::ByteSpan(updateToken, updateToken_Len), softwareVersion).AsInteger(); } chip::ChipError::StorageType chip_ime_AppendCommand_OtaSoftwareUpdateProvider_QueryImage( - chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, uint16_t vendorId, uint16_t productId, - uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, const uint8_t * location, uint32_t location_Len, + chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId, chip::VendorId vendorId, uint16_t productId, + uint32_t softwareVersion, uint8_t protocolsSupported, uint16_t hardwareVersion, const uint8_t * location, uint32_t location_Len, bool requestorCanConsent, const uint8_t * metadataForProvider, uint32_t metadataForProvider_Len) { VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT.AsInteger()); chip::Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(device, ZCLendpointId); return cluster - .QueryImage(nullptr, nullptr, vendorId, productId, hardwareVersion, softwareVersion, protocolsSupported, + .QueryImage(nullptr, nullptr, vendorId, productId, softwareVersion, protocolsSupported, hardwareVersion, chip::CharSpan(reinterpret_cast(location), location_Len), requestorCanConsent, chip::ByteSpan(metadataForProvider, metadataForProvider_Len)) .AsInteger(); diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 2723ad8a489f40..55e29308b5a4cd 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -2461,9 +2461,9 @@ class ChipClusters: "args": { "vendorId": "int", "productId": "int", - "hardwareVersion": "int", "softwareVersion": "int", "protocolsSupported": "int", + "hardwareVersion": "int", "location": "str", "requestorCanConsent": "bool", "metadataForProvider": "bytes", @@ -5144,10 +5144,10 @@ def ClusterOtaSoftwareUpdateProvider_CommandNotifyUpdateApplied(self, device: ct updateToken), softwareVersion ) - def ClusterOtaSoftwareUpdateProvider_CommandQueryImage(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, vendorId: int, productId: int, hardwareVersion: int, softwareVersion: int, protocolsSupported: int, location: str, requestorCanConsent: bool, metadataForProvider: bytes): + def ClusterOtaSoftwareUpdateProvider_CommandQueryImage(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, vendorId: int, productId: int, softwareVersion: int, protocolsSupported: int, hardwareVersion: int, location: str, requestorCanConsent: bool, metadataForProvider: bytes): location = location.encode("utf-8") + b'\x00' return self._chipLib.chip_ime_AppendCommand_OtaSoftwareUpdateProvider_QueryImage( - device, ZCLendpoint, ZCLgroupid, vendorId, productId, hardwareVersion, softwareVersion, protocolsSupported, location, len( + device, ZCLendpoint, ZCLgroupid, vendorId, productId, softwareVersion, protocolsSupported, hardwareVersion, location, len( location), requestorCanConsent, metadataForProvider, len(metadataForProvider) ) @@ -8717,7 +8717,7 @@ def InitLib(self, chipLib): self._chipLib.chip_ime_AppendCommand_OtaSoftwareUpdateProvider_NotifyUpdateApplied.restype = ctypes.c_uint32 # Cluster OtaSoftwareUpdateProvider Command QueryImage self._chipLib.chip_ime_AppendCommand_OtaSoftwareUpdateProvider_QueryImage.argtypes = [ - ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint32, ctypes.c_uint8, ctypes.c_char_p, ctypes.c_uint32, ctypes.c_bool, ctypes.c_char_p, ctypes.c_uint32] + ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint16, ctypes.c_uint32, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32, ctypes.c_bool, ctypes.c_char_p, ctypes.c_uint32] self._chipLib.chip_ime_AppendCommand_OtaSoftwareUpdateProvider_QueryImage.restype = ctypes.c_uint32 # Cluster OtaSoftwareUpdateProvider ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_OtaSoftwareUpdateProvider_ClusterRevision.argtypes = [ diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 5883d7bc105074..193d97cfcedd19 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -4971,11 +4971,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor( Label="productId", Tag=1, Type=uint), ClusterObjectFieldDescriptor( - Label="hardwareVersion", Tag=2, Type=uint), + Label="softwareVersion", Tag=2, Type=uint), ClusterObjectFieldDescriptor( - Label="softwareVersion", Tag=3, Type=uint), + Label="protocolsSupported", Tag=3, Type=OtaSoftwareUpdateProvider.Enums.OTADownloadProtocol), ClusterObjectFieldDescriptor( - Label="protocolsSupported", Tag=4, Type=OtaSoftwareUpdateProvider.Enums.OTADownloadProtocol), + Label="hardwareVersion", Tag=4, Type=uint), ClusterObjectFieldDescriptor( Label="location", Tag=5, Type=str), ClusterObjectFieldDescriptor( @@ -4986,9 +4986,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: vendorId: 'uint' = None productId: 'uint' = None - hardwareVersion: 'uint' = None softwareVersion: 'uint' = None protocolsSupported: 'OtaSoftwareUpdateProvider.Enums.OTADownloadProtocol' = None + hardwareVersion: 'uint' = None location: 'str' = None requestorCanConsent: 'bool' = None metadataForProvider: 'bytes' = None @@ -5069,7 +5069,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: metadataForRequestor: 'bytes' = None @dataclass - class ApplyUpdateRequestResponse(ClusterCommand): + class ApplyUpdateResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x0029 command_id: typing.ClassVar[int] = 0x0004 is_client: typing.ClassVar[bool] = False diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index e24edca1845215..43a87d5bae69d6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -1233,7 +1233,7 @@ }); }; -void CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallbackBridge::OnSuccessFn( +void CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge::OnSuccessFn( void * context, uint8_t action, uint32_t delayedActionTime) { DispatchSuccess(context, @ { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 1b28d1a1bf452c..eb0577cd430ed5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -1163,14 +1163,14 @@ class CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge static void OnSuccessFn(void * context, uint8_t errorCode, chip::CharSpan debugText); }; -class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallbackBridge - : public CHIPCallbackBridge +class CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge + : public CHIPCallbackBridge { public: - CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, - keepAlive){}; + CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; static void OnSuccessFn(void * context, uint8_t action, uint32_t delayedActionTime); }; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 6a00b4bbc89c73..7471f369156df3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1174,9 +1174,9 @@ NS_ASSUME_NONNULL_BEGIN responseHandler:(ResponseHandler)responseHandler; - (void)queryImage:(uint16_t)vendorId productId:(uint16_t)productId - hardwareVersion:(uint16_t)hardwareVersion softwareVersion:(uint32_t)softwareVersion protocolsSupported:(uint8_t)protocolsSupported + hardwareVersion:(uint16_t)hardwareVersion location:(NSString *)location requestorCanConsent:(bool)requestorCanConsent metadataForProvider:(NSData *)metadataForProvider diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 419fb6bfa5679d..29d362472d2c5d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -3449,7 +3449,7 @@ @implementation CHIPOtaSoftwareUpdateProvider - (void)applyUpdateRequest:(NSData *)updateToken newVersion:(uint32_t)newVersion responseHandler:(ResponseHandler)responseHandler { - new CHIPOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallbackBridge( + new CHIPOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge( self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { return self.cppCluster.ApplyUpdateRequest(success, failure, [self asByteSpan:updateToken], newVersion); }); @@ -3466,9 +3466,9 @@ new CHIPDefaultSuccessCallbackBridge(self.callbackQueue, responseHandler, ^(Canc - (void)queryImage:(uint16_t)vendorId productId:(uint16_t)productId - hardwareVersion:(uint16_t)hardwareVersion softwareVersion:(uint32_t)softwareVersion protocolsSupported:(uint8_t)protocolsSupported + hardwareVersion:(uint16_t)hardwareVersion location:(NSString *)location requestorCanConsent:(bool)requestorCanConsent metadataForProvider:(NSData *)metadataForProvider @@ -3476,8 +3476,8 @@ - (void)queryImage:(uint16_t)vendorId { new CHIPOtaSoftwareUpdateProviderClusterQueryImageResponseCallbackBridge( self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { - return self.cppCluster.QueryImage(success, failure, vendorId, productId, hardwareVersion, softwareVersion, - static_cast(protocolsSupported), [self asCharSpan:location], requestorCanConsent, + return self.cppCluster.QueryImage(success, failure, static_cast(vendorId), productId, softwareVersion, + static_cast(protocolsSupported), hardwareVersion, [self asCharSpan:location], requestorCanConsent, [self asByteSpan:metadataForProvider]); }); } diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 69bd403e97c46e..5b42529b5f0ceb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -12895,11 +12895,11 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageResponseCallback( chip::CharSpan imageURI, uint32_t softwareVersion, chip::CharSpan softwareVersionString, chip::ByteSpan updateToken, bool userConsentNeeded, chip::ByteSpan metadataForRequestor); /** - * @brief OTA Software Update Provider Cluster ApplyUpdateRequestResponse Command callback (from server) + * @brief OTA Software Update Provider Cluster ApplyUpdateResponse Command callback (from server) */ -bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback(chip::EndpointId endpoint, - chip::app::CommandSender * commandObj, - uint8_t action, uint32_t delayedActionTime); +bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback(chip::EndpointId endpoint, + chip::app::CommandSender * commandObj, uint8_t action, + uint32_t delayedActionTime); /** * @brief OTA Software Update Requestor Cluster AnnounceOtaProvider Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 16de792faa3d2f..0e7ec73e83a0b9 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -4635,10 +4635,10 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kVendorId)), vendorId)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kProductId)), productId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kHardwareVersion)), hardwareVersion)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kSoftwareVersion)), softwareVersion)); ReturnErrorOnFailure( DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kProtocolsSupported)), protocolsSupported)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kHardwareVersion)), hardwareVersion)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kLocation)), location)); ReturnErrorOnFailure( DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kRequestorCanConsent)), requestorCanConsent)); @@ -4665,15 +4665,15 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) case to_underlying(Fields::kProductId): ReturnErrorOnFailure(DataModel::Decode(reader, productId)); break; - case to_underlying(Fields::kHardwareVersion): - ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersion)); - break; case to_underlying(Fields::kSoftwareVersion): ReturnErrorOnFailure(DataModel::Decode(reader, softwareVersion)); break; case to_underlying(Fields::kProtocolsSupported): ReturnErrorOnFailure(DataModel::Decode(reader, protocolsSupported)); break; + case to_underlying(Fields::kHardwareVersion): + ReturnErrorOnFailure(DataModel::Decode(reader, hardwareVersion)); + break; case to_underlying(Fields::kLocation): ReturnErrorOnFailure(DataModel::Decode(reader, location)); break; @@ -4833,7 +4833,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } } // namespace QueryImageResponse. -namespace ApplyUpdateRequestResponse { +namespace ApplyUpdateResponse { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; @@ -4870,7 +4870,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(reader.ExitContainer(outer)); return CHIP_NO_ERROR; } -} // namespace ApplyUpdateRequestResponse. +} // namespace ApplyUpdateResponse. } // namespace Commands namespace Events { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index e122b080d30ad5..bf41dfaaac471a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -5886,9 +5886,9 @@ enum class Fields { kVendorId = 0, kProductId = 1, - kHardwareVersion = 2, - kSoftwareVersion = 3, - kProtocolsSupported = 4, + kSoftwareVersion = 2, + kProtocolsSupported = 3, + kHardwareVersion = 4, kLocation = 5, kRequestorCanConsent = 6, kMetadataForProvider = 7, @@ -5901,14 +5901,14 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::QueryImage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateProvider::Id; } - uint16_t vendorId; + chip::VendorId vendorId; uint16_t productId; - uint16_t hardwareVersion; uint32_t softwareVersion; OTADownloadProtocol protocolsSupported; - chip::CharSpan location; - bool requestorCanConsent; - chip::ByteSpan metadataForProvider; + Optional hardwareVersion; + Optional location; + Optional requestorCanConsent; + Optional metadataForProvider; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; }; @@ -5919,14 +5919,14 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::QueryImage::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateProvider::Id; } - uint16_t vendorId; + chip::VendorId vendorId; uint16_t productId; - uint16_t hardwareVersion; uint32_t softwareVersion; OTADownloadProtocol protocolsSupported; - chip::CharSpan location; - bool requestorCanConsent; - chip::ByteSpan metadataForProvider; + Optional hardwareVersion; + Optional location; + Optional requestorCanConsent; + Optional metadataForProvider; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace QueryImage @@ -6041,7 +6041,7 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace QueryImageResponse -namespace ApplyUpdateRequestResponse { +namespace ApplyUpdateResponse { enum class Fields { kAction = 0, @@ -6052,7 +6052,7 @@ struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::ApplyUpdateRequestResponse::Id; } + static constexpr CommandId GetCommandId() { return Commands::ApplyUpdateResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateProvider::Id; } OTAApplyUpdateAction action; @@ -6064,14 +6064,14 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::ApplyUpdateRequestResponse::Id; } + static constexpr CommandId GetCommandId() { return Commands::ApplyUpdateResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateProvider::Id; } OTAApplyUpdateAction action; uint32_t delayedActionTime; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace ApplyUpdateRequestResponse +}; // namespace ApplyUpdateResponse } // namespace Commands namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index c25d72c784e54f..bdce02368eb61d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -167,7 +167,7 @@ #define ZCL_APPLY_UPDATE_REQUEST_COMMAND_ID (0x01) #define ZCL_NOTIFY_UPDATE_APPLIED_COMMAND_ID (0x02) #define ZCL_QUERY_IMAGE_RESPONSE_COMMAND_ID (0x03) -#define ZCL_APPLY_UPDATE_REQUEST_RESPONSE_COMMAND_ID (0x04) +#define ZCL_APPLY_UPDATE_RESPONSE_COMMAND_ID (0x04) // Commands for cluster: OTA Software Update Requestor #define ZCL_ANNOUNCE_OTA_PROVIDER_COMMAND_ID (0x00) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 7e6e3b90c3860f..01bacb1bd0ce73 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -544,9 +544,9 @@ namespace QueryImageResponse { static constexpr CommandId Id = 0x00000003; } // namespace QueryImageResponse -namespace ApplyUpdateRequestResponse { +namespace ApplyUpdateResponse { static constexpr CommandId Id = 0x00000004; -} // namespace ApplyUpdateRequestResponse +} // namespace ApplyUpdateResponse } // namespace Commands } // namespace OtaSoftwareUpdateProvider diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index ae78a12781daa8..c6ff59a19029a3 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -1873,11 +1873,10 @@ static void OnNetworkCommissioningUpdateWiFiNetworkResponseSuccess( command->SetCommandExitStatus(CHIP_NO_ERROR); }; -static void OnOtaSoftwareUpdateProviderApplyUpdateRequestResponseSuccess( - void * context, - const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequestResponse::DecodableType & data) +static void OnOtaSoftwareUpdateProviderApplyUpdateResponseSuccess( + void * context, const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::DecodableType & data) { - ChipLogProgress(Zcl, "Received ApplyUpdateRequestResponse:"); + ChipLogProgress(Zcl, "Received ApplyUpdateResponse:"); ChipLogProgress(Zcl, " action: %" PRIu8 "", data.action); ChipLogProgress(Zcl, " delayedActionTime: %" PRIu32 "", data.delayedActionTime); @@ -14942,8 +14941,7 @@ class OtaSoftwareUpdateProviderApplyUpdateRequest : public ModelCommand chip::Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(device, endpointId); - return cluster.InvokeCommand(mRequest, this, OnOtaSoftwareUpdateProviderApplyUpdateRequestResponseSuccess, - OnDefaultFailure); + return cluster.InvokeCommand(mRequest, this, OnOtaSoftwareUpdateProviderApplyUpdateResponseSuccess, OnDefaultFailure); } private: @@ -14986,11 +14984,11 @@ class OtaSoftwareUpdateProviderQueryImage : public ModelCommand { AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); - AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); AddArgument( "ProtocolsSupported", 0, UINT8_MAX, reinterpret_cast *>(&mRequest.protocolsSupported)); + AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); AddArgument("Location", &mRequest.location); AddArgument("RequestorCanConsent", 0, 1, &mRequest.requestorCanConsent); AddArgument("MetadataForProvider", &mRequest.metadataForProvider); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index 04bab254585032..181d30ea44f299 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -1726,17 +1726,17 @@ bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(Endpoin return true; } -bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, - uint8_t action, uint32_t delayedActionTime) +bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, + uint8_t action, uint32_t delayedActionTime) { - ChipLogProgress(Zcl, "ApplyUpdateRequestResponse:"); + ChipLogProgress(Zcl, "ApplyUpdateResponse:"); ChipLogProgress(Zcl, " action: %" PRIu8 "", action); ChipLogProgress(Zcl, " delayedActionTime: %" PRIu32 "", delayedActionTime); - GET_CLUSTER_RESPONSE_CALLBACKS("OtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback"); + GET_CLUSTER_RESPONSE_CALLBACKS("OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallback"); - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); cb->mCall(cb->mContext, action, delayedActionTime); return true; } diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index d86d59baf49645..66defcbe9cc818 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -116,8 +116,8 @@ typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(v chip::CharSpan debugText); typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, chip::CharSpan debugText); -typedef void (*OtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback)(void * context, uint8_t action, - uint32_t delayedActionTime); +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); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index 9a697386b3a566..98b27a2047edb0 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -8611,10 +8611,10 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::NotifyUpdateApplied(Callback::Cance } CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t vendorId, - uint16_t productId, uint16_t hardwareVersion, uint32_t softwareVersion, - uint8_t protocolsSupported, chip::CharSpan location, - bool requestorCanConsent, chip::ByteSpan metadataForProvider) + Callback::Cancelable * onFailureCallback, chip::VendorId vendorId, + uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + uint16_t hardwareVersion, chip::CharSpan location, bool requestorCanConsent, + chip::ByteSpan metadataForProvider) { CHIP_ERROR err = CHIP_NO_ERROR; TLV::TLVWriter * writer = nullptr; @@ -8638,16 +8638,16 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * o SuccessOrExit(err = sender->PrepareCommand(cmdParams)); VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // vendorId: int16u + // vendorId: vendorId SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), vendorId)); // productId: int16u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), productId)); - // hardwareVersion: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), hardwareVersion)); // softwareVersion: int32u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), softwareVersion)); // protocolsSupported: OTADownloadProtocol SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), protocolsSupported)); + // hardwareVersion: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), hardwareVersion)); // location: charString SuccessOrExit(err = writer->PutString(TLV::ContextTag(argSeqNumber++), location.data())); // requestorCanConsent: boolean diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index e26c7e926bd504..c0ca67bc29a45e 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -988,9 +988,10 @@ class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase chip::ByteSpan updateToken, uint32_t newVersion); CHIP_ERROR NotifyUpdateApplied(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan updateToken, uint32_t softwareVersion); - CHIP_ERROR QueryImage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t vendorId, - uint16_t productId, uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, - chip::CharSpan location, bool requestorCanConsent, chip::ByteSpan metadataForProvider); + CHIP_ERROR QueryImage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::VendorId vendorId, uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + uint16_t hardwareVersion, chip::CharSpan location, bool requestorCanConsent, + chip::ByteSpan metadataForProvider); // Cluster Attributes CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp index e0da9e1c37e393..1c31d4daf0bfa2 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClustersInvoke.cpp @@ -706,10 +706,9 @@ ClusterBase::InvokeCommand( + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::DecodableType>( const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type &, void *, - CommandResponseSuccessCallback< - chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequestResponse::DecodableType>, + CommandResponseSuccessCallback, CommandResponseFailureCallback); template CHIP_ERROR ClusterBase::InvokeCommand * cb = - Callback::Callback::FromCancelable(onSuccessCallback); + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); cb->mCall(cb->mContext, action, delayedActionTime); return true; } diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h index 8121fed3553378..499a1924413099 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h @@ -36,8 +36,8 @@ // #6308 should handle IM error code on the application side, either modify this function or remove this. // Cluster Specific Response Callbacks -typedef void (*OtaSoftwareUpdateProviderClusterApplyUpdateRequestResponseCallback)(void * context, uint8_t action, - uint32_t delayedActionTime); +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); diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp b/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp index 4d6ca1eef926c6..893d63c7297967 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.cpp @@ -126,10 +126,10 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::NotifyUpdateApplied(Callback::Cance } CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t vendorId, - uint16_t productId, uint16_t hardwareVersion, uint32_t softwareVersion, - uint8_t protocolsSupported, chip::CharSpan location, - bool requestorCanConsent, chip::ByteSpan metadataForProvider) + Callback::Cancelable * onFailureCallback, chip::VendorId vendorId, + uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + uint16_t hardwareVersion, chip::CharSpan location, bool requestorCanConsent, + chip::ByteSpan metadataForProvider) { CHIP_ERROR err = CHIP_NO_ERROR; TLV::TLVWriter * writer = nullptr; @@ -153,16 +153,16 @@ CHIP_ERROR OtaSoftwareUpdateProviderCluster::QueryImage(Callback::Cancelable * o SuccessOrExit(err = sender->PrepareCommand(cmdParams)); VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - // vendorId: int16u + // vendorId: vendorId SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), vendorId)); // productId: int16u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), productId)); - // hardwareVersion: int16u - SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), hardwareVersion)); // softwareVersion: int32u SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), softwareVersion)); // protocolsSupported: OTADownloadProtocol SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), protocolsSupported)); + // hardwareVersion: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), hardwareVersion)); // location: charString SuccessOrExit(err = writer->PutString(TLV::ContextTag(argSeqNumber++), location.data())); // requestorCanConsent: boolean diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.h b/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.h index 9db60b690a6976..95d531b50c257d 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClusters.h @@ -41,9 +41,10 @@ class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase chip::ByteSpan updateToken, uint32_t newVersion); CHIP_ERROR NotifyUpdateApplied(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan updateToken, uint32_t softwareVersion); - CHIP_ERROR QueryImage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t vendorId, - uint16_t productId, uint16_t hardwareVersion, uint32_t softwareVersion, uint8_t protocolsSupported, - chip::CharSpan location, bool requestorCanConsent, chip::ByteSpan metadataForProvider); + CHIP_ERROR QueryImage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + chip::VendorId vendorId, uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported, + uint16_t hardwareVersion, chip::CharSpan location, bool requestorCanConsent, + chip::ByteSpan metadataForProvider); // Cluster Attributes CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp b/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp index 766af4b05aca67..5ef6695b4a310e 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClustersInvoke.cpp @@ -32,10 +32,9 @@ namespace Controller { template CHIP_ERROR ClusterBase::InvokeCommand( + chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::DecodableType>( const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type &, void *, - CommandResponseSuccessCallback< - chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequestResponse::DecodableType>, + CommandResponseSuccessCallback, CommandResponseFailureCallback); template CHIP_ERROR ClusterBase::InvokeCommand