diff --git a/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp b/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp index 70299109290a75..231abb135c0f23 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp @@ -5758,7 +5758,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman uint16_t imageType; uint16_t hardwareVersion; uint32_t currentVersion; - /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported; + uint8_t protocolsSupported; const uint8_t * location; uint8_t requestorCanConsent; chip::ByteSpan metadataForProvider; @@ -5807,8 +5807,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman TLVUnpackError = aDataTlv.Get(currentVersion); break; case 5: - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(protocolsSupported)); + TLVUnpackError = aDataTlv.Get(protocolsSupported); break; case 6: // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. diff --git a/examples/thermostat/thermostat-common/gen/IMClusterCommandHandler.cpp b/examples/thermostat/thermostat-common/gen/IMClusterCommandHandler.cpp index 475e34e1f6f3dd..c89f783f055c43 100644 --- a/examples/thermostat/thermostat-common/gen/IMClusterCommandHandler.cpp +++ b/examples/thermostat/thermostat-common/gen/IMClusterCommandHandler.cpp @@ -5326,7 +5326,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman uint16_t imageType; uint16_t hardwareVersion; uint32_t currentVersion; - /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported; + uint8_t protocolsSupported; const uint8_t * location; uint8_t requestorCanConsent; chip::ByteSpan metadataForProvider; @@ -5375,8 +5375,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman TLVUnpackError = aDataTlv.Get(currentVersion); break; case 5: - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(protocolsSupported)); + TLVUnpackError = aDataTlv.Get(protocolsSupported); break; case 6: // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. diff --git a/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp b/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp index 52a8e75efd969d..acbac5b5533b7c 100644 --- a/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp +++ b/examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp @@ -3464,7 +3464,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman uint16_t imageType; uint16_t hardwareVersion; uint32_t currentVersion; - /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported; + uint8_t protocolsSupported; const uint8_t * location; uint8_t requestorCanConsent; chip::ByteSpan metadataForProvider; @@ -3513,8 +3513,7 @@ void DispatchServerCommand(app::CommandHandler * apCommandObj, CommandId aComman TLVUnpackError = aDataTlv.Get(currentVersion); break; case 5: - // Just for compatibility, we will add array type support in IM later. - TLVUnpackError = aDataTlv.GetDataPtr(const_cast(protocolsSupported)); + TLVUnpackError = aDataTlv.Get(protocolsSupported); break; case 6: // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. diff --git a/src/app/clusters/ota-provider/ota-provider-delegate.h b/src/app/clusters/ota-provider/ota-provider-delegate.h index 0479018bd5e607..62f81f83827d5b 100644 --- a/src/app/clusters/ota-provider/ota-provider-delegate.h +++ b/src/app/clusters/ota-provider/ota-provider-delegate.h @@ -31,9 +31,9 @@ namespace clusters { class OTAProviderDelegate { public: - // TODO: protocolsSupported should be list of OTADownloadProtocol enums, not uint8_t* + // TODO(#8605): protocolsSupported should be list of OTADownloadProtocol enums, not uint8_t virtual EmberAfStatus HandleQueryImage(uint16_t vendorId, uint16_t productId, uint16_t imageType, uint16_t hardwareVersion, - uint32_t currentVersion, uint8_t * protocolsSupported, const chip::ByteSpan & location, + uint32_t currentVersion, uint8_t protocolsSupported, const chip::ByteSpan & location, bool clientCanConsent, const chip::ByteSpan & metadataForProvider) = 0; virtual EmberAfStatus HandleApplyUpdateRequest(const chip::ByteSpan & updateToken, uint32_t newVersion) = 0; diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index 1053baefdfef98..eb33dbb74f451a 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -46,11 +46,11 @@ OTAProviderDelegate * GetDelegate(chip::EndpointId endpoint) return (ep == 0xFFFF ? NULL : gDelegateTable[ep]); } -bool SendStatusIfDelegateNull(chip::EndpointId endpointId) +bool SendStatusIfDelegateNull(chip::EndpointId endpoint) { - if (GetDelegate(endpointId) == nullptr) + if (GetDelegate(endpoint) == nullptr) { - ChipLogError(Zcl, "No OTAProviderDelegate set for ep:%" PRIu16, endpointId); + ChipLogError(Zcl, "No OTAProviderDelegate set for ep:%" PRIu16, endpoint); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_UNSUP_COMMAND); return true; } @@ -72,12 +72,11 @@ bool emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(chip::End chip::ByteSpan updateToken, uint32_t newVersion) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - chip::EndpointId endpointId = emberAfCurrentEndpoint(); - OTAProviderDelegate * delegate = GetDelegate(endpointId); + OTAProviderDelegate * delegate = GetDelegate(endpoint); ChipLogDetail(Zcl, "OTA Provider received ApplyUpdateRequest"); - if (SendStatusIfDelegateNull(endpointId)) + if (SendStatusIfDelegateNull(endpoint)) { return true; } @@ -111,12 +110,11 @@ bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(chip::En chip::ByteSpan updateToken, uint32_t currentVersion) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - chip::EndpointId endpointId = emberAfCurrentEndpoint(); - OTAProviderDelegate * delegate = GetDelegate(endpointId); + OTAProviderDelegate * delegate = GetDelegate(endpoint); ChipLogDetail(Zcl, "OTA Provider received NotifyUpdateUpplied"); - if (SendStatusIfDelegateNull(endpointId)) + if (SendStatusIfDelegateNull(endpoint)) { return true; } @@ -153,17 +151,17 @@ bool emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(chip::En * @param metadataForProvider Optional, max 512 octets. A TLV-encoded Vendor-specific payload. */ -bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback( - chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, uint16_t imageType, - uint16_t hardwareVersion, uint32_t currentVersion, - /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported, uint8_t * location, uint8_t clientCanConsent, - chip::ByteSpan metadataForProvider) +bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, + uint16_t vendorId, uint16_t productId, uint16_t imageType, + uint16_t hardwareVersion, uint32_t currentVersion, + /* TODO(#8605): change this to list */ uint8_t protocolsSupported, + uint8_t * location, uint8_t clientCanConsent, + chip::ByteSpan metadataForProvider) { EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - chip::EndpointId endpointId = emberAfCurrentEndpoint(); - OTAProviderDelegate * delegate = GetDelegate(endpointId); + OTAProviderDelegate * delegate = GetDelegate(endpoint); - if (SendStatusIfDelegateNull(endpointId)) + if (SendStatusIfDelegateNull(endpoint)) { return true; }; @@ -199,9 +197,9 @@ namespace chip { namespace app { namespace clusters { -void OTAProvider::SetDelegate(chip::EndpointId endpointId, OTAProviderDelegate * delegate) +void OTAProvider::SetDelegate(chip::EndpointId endpoint, OTAProviderDelegate * delegate) { - uint16_t ep = emberAfFindClusterServerEndpointIndex(endpointId, ZCL_OTA_PROVIDER_CLUSTER_ID); + uint16_t ep = emberAfFindClusterServerEndpointIndex(endpoint, ZCL_OTA_PROVIDER_CLUSTER_ID); if (ep != 0xFFFF) { gDelegateTable[ep] = delegate; diff --git a/src/app/common/gen/callback.h b/src/app/common/gen/callback.h index a170292217a522..cda2aeb66ccccd 100644 --- a/src/app/common/gen/callback.h +++ b/src/app/common/gen/callback.h @@ -15727,10 +15727,11 @@ bool emberAfBasicClusterLeaveCallback(chip::EndpointId endpoint, chip::app::Comm /** * @brief Cluster QueryImage Command callback (from client) */ -bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback( - chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, uint16_t vendorId, uint16_t productId, uint16_t imageType, - uint16_t hardwareVersion, uint32_t currentVersion, /* TYPE WARNING: array array defaults to */ uint8_t * protocolsSupported, - uint8_t * location, uint8_t requestorCanConsent, chip::ByteSpan metadataForProvider); +bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj, + uint16_t vendorId, uint16_t productId, uint16_t imageType, + uint16_t hardwareVersion, uint32_t currentVersion, + uint8_t protocolsSupported, uint8_t * location, + uint8_t requestorCanConsent, chip::ByteSpan metadataForProvider); /** * @brief Cluster ApplyUpdateRequest Command callback (from client) */ diff --git a/src/app/common/gen/client-command-macro.h b/src/app/common/gen/client-command-macro.h index 5a3763f5f531e3..42860200600c36 100644 --- a/src/app/common/gen/client-command-macro.h +++ b/src/app/common/gen/client-command-macro.h @@ -1736,20 +1736,18 @@ * @param imageType INT16U * @param hardwareVersion INT16U * @param currentVersion INT32U - * @param protocolsSupported OTADownloadProtocol [] - * @param protocolsSupportedLen int + * @param protocolsSupported OTADownloadProtocol * @param location CHAR_STRING * @param requestorCanConsent BOOLEAN * @param metadataForProvider OCTET_STRING */ #define emberAfFillCommandOTA \ Software Update ProviderClusterQueryImage(vendorId, productId, imageType, hardwareVersion, currentVersion, protocolsSupported, \ - protocolsSupportedLen, location, requestorCanConsent, metadataForProvider) \ + location, requestorCanConsent, metadataForProvider) \ emberAfFillExternalBuffer(mask, \ \ - ZCL_QUERY_IMAGE_COMMAND_ID, "uuuuubuuu", vendorId, productId, imageType, hardwareVersion, \ - currentVersion, protocolsSupported, protocolsSupportedLen, location, requestorCanConsent, \ - metadataForProvider); + ZCL_QUERY_IMAGE_COMMAND_ID, "uuuuuuuuu", vendorId, productId, imageType, hardwareVersion, \ + currentVersion, protocolsSupported, location, requestorCanConsent, metadataForProvider); /** @brief Command description for ApplyUpdateRequest * 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 2ea38db34f20e1..723315b9393a3a 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 @@ -47,7 +47,7 @@ limitations under the License. - +