diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index dabac2d9b237be..2e4abd703884e3 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -165,8 +165,8 @@ EmberAfStatus OTAProviderExample::HandleApplyUpdateRequest(chip::app::CommandHan { // TODO: handle multiple transfers by tracking updateTokens - EmberAfOTAApplyUpdateAction updateAction = EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_PROCEED; // For now, just allow any update request - char tokenBuf[kUpdateTokenStrLen] = { 0 }; + OTAApplyUpdateAction updateAction = OTAApplyUpdateAction::kProceed; // For now, just allow any update request + char tokenBuf[kUpdateTokenStrLen] = { 0 }; GetUpdateTokenString(commandData.updateToken, tokenBuf, kUpdateTokenStrLen); ChipLogDetail(SoftwareUpdate, "%s: token: %s, version: %" PRIu32, __FUNCTION__, tokenBuf, commandData.newVersion); diff --git a/src/app/clusters/ota-provider/ota-provider.cpp b/src/app/clusters/ota-provider/ota-provider.cpp index bff08e61551145..b45b3cf4490110 100644 --- a/src/app/clusters/ota-provider/ota-provider.cpp +++ b/src/app/clusters/ota-provider/ota-provider.cpp @@ -192,7 +192,7 @@ bool emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(app::CommandHandl auto protocolIter = protocolsSupported.begin(); while (protocolIter.Next()) { - ChipLogDetail(Zcl, " %" PRIu8, protocolIter.GetValue()); + ChipLogDetail(Zcl, " %" PRIu8, to_underlying(protocolIter.GetValue())); } ChipLogDetail(Zcl, " ]"); if (hardwareVersion.HasValue()) diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 9e6fc4c92dde51..1f66e35df7d1b1 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -35,6 +35,7 @@ namespace chip { using namespace app::Clusters; using namespace app::Clusters::OtaSoftwareUpdateProvider; using namespace app::Clusters::OtaSoftwareUpdateProvider::Commands; +using namespace app::Clusters::OtaSoftwareUpdateRequestor; using namespace app::Clusters::OtaSoftwareUpdateRequestor::Commands; using bdx::TransferSession; @@ -118,7 +119,7 @@ void OTARequestor::OnQueryImageResponse(void * context, const QueryImageResponse if (err != CHIP_NO_ERROR) { - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Querying, err); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kQuerying, err); return; } @@ -140,7 +141,7 @@ void OTARequestor::OnQueryImageResponse(void * context, const QueryImageResponse System::Clock::Seconds32(response.delayedActionTime.ValueOr(0))); break; default: - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Querying, CHIP_ERROR_BAD_REQUEST); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kQuerying, CHIP_ERROR_BAD_REQUEST); break; } } @@ -151,7 +152,7 @@ void OTARequestor::OnQueryImageFailure(void * context, EmberAfStatus status) VerifyOrDie(requestorCore != nullptr); ChipLogDetail(SoftwareUpdate, "QueryImage failure response %" PRIu8, status); - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Querying, CHIP_ERROR_BAD_REQUEST); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kQuerying, CHIP_ERROR_BAD_REQUEST); } void OTARequestor::OnApplyUpdateResponse(void * context, const ApplyUpdateResponse::DecodableType & response) @@ -163,13 +164,13 @@ void OTARequestor::OnApplyUpdateResponse(void * context, const ApplyUpdateRespon switch (response.action) { - case EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_PROCEED: + case OTAApplyUpdateAction::kProceed: requestorCore->mOtaRequestorDriver->UpdateConfirmed(System::Clock::Seconds32(response.delayedActionTime)); break; - case EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_AWAIT_NEXT_ACTION: + case OTAApplyUpdateAction::kAwaitNextAction: requestorCore->mOtaRequestorDriver->UpdateSuspended(System::Clock::Seconds32(response.delayedActionTime)); break; - case EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_DISCONTINUE: + case OTAApplyUpdateAction::kDiscontinue: requestorCore->mOtaRequestorDriver->UpdateDiscontinued(); break; } @@ -181,7 +182,7 @@ void OTARequestor::OnApplyUpdateFailure(void * context, EmberAfStatus status) VerifyOrDie(requestorCore != nullptr); ChipLogDetail(SoftwareUpdate, "ApplyUpdate failure response %" PRIu8, status); - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Applying, CHIP_ERROR_BAD_REQUEST); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kApplying, CHIP_ERROR_BAD_REQUEST); } EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * commandObj, @@ -206,7 +207,7 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm ChipLogDetail(SoftwareUpdate, " FabricIndex: %" PRIu8, mProviderFabricIndex); ChipLogDetail(SoftwareUpdate, " ProviderNodeID: 0x" ChipLogFormatX64, ChipLogValueX64(mProviderNodeId)); ChipLogDetail(SoftwareUpdate, " VendorID: 0x%" PRIx16, commandData.vendorId); - ChipLogDetail(SoftwareUpdate, " AnnouncementReason: %" PRIu8, announcementReason); + ChipLogDetail(SoftwareUpdate, " AnnouncementReason: %" PRIu8, to_underlying(announcementReason)); if (commandData.metadataForNode.HasValue()) { ChipLogDetail(SoftwareUpdate, " MetadataForNode: %zu", commandData.metadataForNode.Value().size()); @@ -218,11 +219,11 @@ EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * comm uint32_t msToStart = 0; switch (announcementReason) { - case static_cast(EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_SIMPLE_ANNOUNCEMENT): - case static_cast(EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_UPDATE_AVAILABLE): + case OTAAnnouncementReason::kSimpleAnnouncement: + case OTAAnnouncementReason::kUpdateAvailable: msToStart = mOtaStartDelayMs; break; - case static_cast(EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_URGENT_UPDATE_AVAILABLE): + case OTAAnnouncementReason::kUrgentUpdateAvailable: msToStart = kImmediateStartDelayMs; break; default: @@ -269,7 +270,7 @@ void OTARequestor::OnConnected(void * context, OperationalDeviceProxy * devicePr if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to send QueryImage command: %" CHIP_ERROR_FORMAT, err.Format()); - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Querying, err); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kQuerying, err); } break; @@ -280,7 +281,7 @@ void OTARequestor::OnConnected(void * context, OperationalDeviceProxy * devicePr if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to start download: %" CHIP_ERROR_FORMAT, err.Format()); - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Downloading, err); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kDownloading, err); } break; @@ -291,7 +292,7 @@ void OTARequestor::OnConnected(void * context, OperationalDeviceProxy * devicePr if (err != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to send ApplyUpdate command: %" CHIP_ERROR_FORMAT, err.Format()); - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Applying, err); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kApplying, err); } break; @@ -328,13 +329,13 @@ void OTARequestor::OnConnectionFailure(void * context, PeerId peerId, CHIP_ERROR switch (requestorCore->mOnConnectedAction) { case kQueryImage: - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Querying, error); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kQuerying, error); break; case kStartBDX: - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Downloading, error); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kDownloading, error); break; case kApplyUpdate: - requestorCore->mOtaRequestorDriver->HandleError(UpdateStateEnum::Applying, error); + requestorCore->mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kApplying, error); break; default: break; @@ -361,7 +362,7 @@ void OTARequestor::OnDownloadStateChanged(OTADownloader::State state) mOtaRequestorDriver->UpdateDownloaded(); break; case OTADownloader::State::kIdle: - mOtaRequestorDriver->HandleError(UpdateStateEnum::Downloading, CHIP_ERROR_CONNECTION_ABORTED); + mOtaRequestorDriver->HandleError(OTAUpdateStateEnum::kDownloading, CHIP_ERROR_CONNECTION_ABORTED); break; default: break; @@ -370,7 +371,7 @@ void OTARequestor::OnDownloadStateChanged(OTADownloader::State state) CHIP_ERROR OTARequestor::SendQueryImageRequest(OperationalDeviceProxy & deviceProxy) { - constexpr EmberAfOTADownloadProtocol kProtocolsSupported[] = { EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS }; + constexpr OTADownloadProtocol kProtocolsSupported[] = { OTADownloadProtocol::kBDXSynchronous }; QueryImage::Type args; uint16_t vendorId; diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index c9c2d6ba42330f..fdb95cc6a74718 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -615,7 +615,6 @@ function isWeaklyTypedEnum(label) "BarrierControlBarrierPosition", "BarrierControlMovingState", "BootReasonType", - "ChangeReasonEnum", "ColorControlOptions", "ColorLoopAction", "ColorLoopDirection", @@ -648,9 +647,6 @@ function isWeaklyTypedEnum(label) "MoveMode", "NetworkFaultType", "NodeOperationalCertStatus", - "OTAAnnouncementReason", - "OTAApplyUpdateAction", - "OTADownloadProtocol", "OnOffDelayedAllOffEffectVariant", "OnOffDyingLightEffectVariant", "OnOffEffectIdentifier", @@ -669,7 +665,6 @@ function isWeaklyTypedEnum(label) "ThermostatControlSequence", "ThermostatRunningMode", "ThermostatSystemMode", - "UpdateStateEnum", "WcEndProductType", "WcType", "WiFiVersionType", 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 4abaa4849b326c..906c0c5cd4786c 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 @@ -88,7 +88,7 @@ limitations under the License. - + @@ -100,7 +100,7 @@ limitations under the License. - + @@ -124,7 +124,7 @@ limitations under the License. true DefaultOtaProviders UpdatePossible - UpdateState + UpdateState UpdateStateProgress Announce the presence of an OTA Provider @@ -136,9 +136,9 @@ limitations under the License. This event SHALL be generated when a change of the UpdateState attribute occurs due to an OTA Requestor moving through the states necessary to query for updates. - - - + + + diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index cf614c17c23897..3cf2286c7811c7 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -6711,7 +6711,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields = [ ClusterObjectFieldDescriptor(Label="defaultOtaProviders", Tag=0x00000000, Type=typing.List[OtaSoftwareUpdateRequestor.Structs.ProviderLocation]), ClusterObjectFieldDescriptor(Label="updatePossible", Tag=0x00000001, Type=bool), - ClusterObjectFieldDescriptor(Label="updateState", Tag=0x00000002, Type=OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum), + ClusterObjectFieldDescriptor(Label="updateState", Tag=0x00000002, Type=OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum), ClusterObjectFieldDescriptor(Label="updateStateProgress", Tag=0x00000003, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=typing.Optional[uint]), @@ -6720,26 +6720,26 @@ def descriptor(cls) -> ClusterObjectDescriptor: defaultOtaProviders: 'typing.List[OtaSoftwareUpdateRequestor.Structs.ProviderLocation]' = None updatePossible: 'bool' = None - updateState: 'OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum' = None + updateState: 'OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum' = None updateStateProgress: 'typing.Union[Nullable, uint]' = None attributeList: 'typing.List[uint]' = None featureMap: 'typing.Optional[uint]' = None clusterRevision: 'uint' = None class Enums: - class ChangeReasonEnum(IntEnum): + class OTAAnnouncementReason(IntEnum): + kSimpleAnnouncement = 0x00 + kUpdateAvailable = 0x01 + kUrgentUpdateAvailable = 0x02 + + class OTAChangeReasonEnum(IntEnum): kUnknown = 0x00 kSuccess = 0x01 kFailure = 0x02 kTimeOut = 0x03 kDelayByProvider = 0x04 - class OTAAnnouncementReason(IntEnum): - kSimpleAnnouncement = 0x00 - kUpdateAvailable = 0x01 - kUrgentUpdateAvailable = 0x02 - - class UpdateStateEnum(IntEnum): + class OTAUpdateStateEnum(IntEnum): kUnknown = 0x00 kIdle = 0x01 kQuerying = 0x02 @@ -6839,9 +6839,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum) + return ClusterObjectFieldDescriptor(Type=OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum) - value: 'OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum' = 0 + value: 'OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum' = 0 @dataclass class UpdateStateProgress(ClusterAttributeDescriptor): @@ -6923,15 +6923,15 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="previousState", Tag=0, Type=typing.Union[Nullable, OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum]), - ClusterObjectFieldDescriptor(Label="newState", Tag=1, Type=OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum), - ClusterObjectFieldDescriptor(Label="reason", Tag=2, Type=OtaSoftwareUpdateRequestor.Enums.ChangeReasonEnum), + ClusterObjectFieldDescriptor(Label="previousState", Tag=0, Type=typing.Union[Nullable, OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum]), + ClusterObjectFieldDescriptor(Label="newState", Tag=1, Type=OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum), + ClusterObjectFieldDescriptor(Label="reason", Tag=2, Type=OtaSoftwareUpdateRequestor.Enums.OTAChangeReasonEnum), ClusterObjectFieldDescriptor(Label="targetSoftwareVersion", Tag=3, Type=typing.Union[Nullable, uint]), ]) - previousState: 'typing.Union[Nullable, OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum]' = NullValue - newState: 'OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum' = 0 - reason: 'OtaSoftwareUpdateRequestor.Enums.ChangeReasonEnum' = 0 + previousState: 'typing.Union[Nullable, OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum]' = NullValue + newState: 'OtaSoftwareUpdateRequestor.Enums.OTAUpdateStateEnum' = 0 + reason: 'OtaSoftwareUpdateRequestor.Enums.OTAChangeReasonEnum' = 0 targetSoftwareVersion: 'typing.Union[Nullable, uint]' = NullValue @dataclass diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index ec02391ab9193f..dc1ce98fcc04cc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -7116,18 +7116,19 @@ } } -void CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge::OnSuccessFn( - void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum value) +void CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value) { NSNumber * _Nonnull objCValue; objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; DispatchSuccess(context, objCValue); }; -void CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( +void CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( void * context) { - auto * self = static_cast(context); + auto * self + = static_cast(context); if (!self->mQueue) { return; } @@ -7141,8 +7142,8 @@ } } -void CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge::OnSuccessFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) { NSNumber * _Nullable objCValue; if (value.IsNull()) { @@ -7153,11 +7154,12 @@ DispatchSuccess(context, objCValue); }; -void CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( - void * context) +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished(void * context) { auto * self - = static_cast(context); + = static_cast( + context); if (!self->mQueue) { return; } @@ -7171,19 +7173,19 @@ } } -void CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn( - void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value) +void CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum value) { NSNumber * _Nonnull objCValue; objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; DispatchSuccess(context, objCValue); }; -void CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( +void CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( void * context) { auto * self - = static_cast(context); + = static_cast(context); if (!self->mQueue) { return; } @@ -7197,8 +7199,8 @@ } } -void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn(void * context, - const chip::app::DataModel::Nullable & value) +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) { NSNumber * _Nullable objCValue; if (value.IsNull()) { @@ -7209,11 +7211,11 @@ DispatchSuccess(context, objCValue); }; -void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge:: - OnSubscriptionEstablished(void * context) +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( + void * context) { auto * self - = static_cast( + = static_cast( context); if (!self->mQueue) { return; @@ -7228,18 +7230,19 @@ } } -void CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge::OnSuccessFn( - void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value) +void CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value) { NSNumber * _Nonnull objCValue; objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; DispatchSuccess(context, objCValue); }; -void CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( +void CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( void * context) { - auto * self = static_cast(context); + auto * self + = static_cast(context); if (!self->mQueue) { return; } @@ -7253,8 +7256,8 @@ } } -void CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge::OnSuccessFn( - void * context, const chip::app::DataModel::Nullable & value) +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) { NSNumber * _Nullable objCValue; if (value.IsNull()) { @@ -7265,11 +7268,11 @@ DispatchSuccess(context, objCValue); }; -void CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished( void * context) { - auto * self - = static_cast(context); + auto * self = static_cast( + context); if (!self->mQueue) { return; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index c77eb3f26a3574..c498fd3cb364af 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -191,18 +191,18 @@ typedef void (*OtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallback)( void *, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus); typedef void (*NullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallback)( void *, const chip::app::DataModel::Nullable &); -typedef void (*OtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallback)( - void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum); -typedef void (*NullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallback)( - void *, const chip::app::DataModel::Nullable &); typedef void (*OtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallback)( void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason); typedef void (*NullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallback)( void *, const chip::app::DataModel::Nullable &); -typedef void (*OtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallback)( - void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum); -typedef void (*NullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallback)( - void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum); +typedef void (*NullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum); +typedef void (*NullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); typedef void (*LocalizationUnitClusterTempUnitAttributeCallback)(void *, chip::app::Clusters::LocalizationUnit::TempUnit); typedef void (*NullableLocalizationUnitClusterTempUnitAttributeCallback)( void *, const chip::app::DataModel::Nullable &); @@ -5833,26 +5833,28 @@ class CHIPNullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbac SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, - keepAlive){}; + CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; - static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum value); + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value); }; -class CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge - : public CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge + : public CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge( + CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(queue, handler, action, true), + CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -5862,30 +5864,30 @@ class CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubs SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, - ResponseHandler handler, - CHIPActionBlock action, - bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, - OnSuccessFn, keepAlive){}; + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge( + queue, handler, action, OnSuccessFn, keepAlive){}; - static void - OnSuccessFn(void * context, - const chip::app::DataModel::Nullable & value); + static void OnSuccessFn( + void * context, + const chip::app::DataModel::Nullable & value); }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge - : public CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge + : public CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackSubscriptionBridge( + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(queue, handler, action, true), + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -5895,28 +5897,27 @@ class CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCall SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, - ResponseHandler handler, - CHIPActionBlock action, - bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, - OnSuccessFn, keepAlive){}; + CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; - static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value); + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAChangeReasonEnum value); }; -class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge - : public CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge + : public CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge( + CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(queue, handler, action, true), + CHIPOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -5926,30 +5927,30 @@ class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbac SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, - ResponseHandler handler, - CHIPActionBlock action, - bool keepAlive = false) : - CHIPCallbackBridge( - queue, handler, action, OnSuccessFn, keepAlive){}; + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; - static void OnSuccessFn( - void * context, - const chip::app::DataModel::Nullable & value); + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge - : public CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge + : public CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackSubscriptionBridge( + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(queue, handler, action, true), + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAChangeReasonEnumAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -5959,26 +5960,26 @@ class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttribut SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, - keepAlive){}; + CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; - static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value); + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); }; -class CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge - : public CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge +class CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge + : public CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge { public: - CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge( + CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(queue, handler, action, true), + CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -5988,30 +5989,30 @@ class CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubsc SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, - ResponseHandler handler, - CHIPActionBlock action, - bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, - OnSuccessFn, keepAlive){}; + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; static void OnSuccessFn(void * context, - const chip::app::DataModel::Nullable & value); + const chip::app::DataModel::Nullable & value); }; -class CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge - : public CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge + : public CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge { public: - CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge( + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge( dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, SubscriptionEstablishedHandler establishedHandler) : - CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(queue, handler, action, true), + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 1dabf9f13951c6..5669719759361d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -10752,10 +10752,11 @@ new CHIPBooleanAttributeCallbackSubscriptionBridge( - (void)readAttributeUpdateStateWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge( + new CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackBridge( self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateState::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn + = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); @@ -10766,15 +10767,17 @@ - (void)subscribeAttributeUpdateStateWithMinInterval:(uint16_t)minInterval subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge( + new CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { using TypeInfo = OtaSoftwareUpdateRequestor::Attributes::UpdateState::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn + = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, minInterval, maxInterval, - CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + CHIPOtaSoftwareUpdateRequestorClusterOTAUpdateStateEnumAttributeCallbackSubscriptionBridge:: + OnSubscriptionEstablished); }, subscriptionEstablishedHandler); } diff --git a/src/include/platform/OTARequestorDriver.h b/src/include/platform/OTARequestorDriver.h index dc6fe2de9bb99f..5bfb7be664e645 100644 --- a/src/include/platform/OTARequestorDriver.h +++ b/src/include/platform/OTARequestorDriver.h @@ -24,6 +24,7 @@ #pragma once +#include #include #include @@ -46,20 +47,6 @@ enum class UpdateNotFoundReason UpToDate }; -// Possible values for the UpdateState attribute -enum class UpdateStateEnum -{ - Unknown = 0, - Idle = 1, - Querying = 2, - DelayedOnQuery = 3, - Downloading = 4, - Applying = 5, - DelayedOnApply = 6, - RollingBack = 7, - DelayedOnUserConsent = 8, -}; - // Interface class to abstract the OTA-related business logic. Each application // must implement this interface. All calls must be non-blocking unless stated otherwise class OTARequestorDriver @@ -74,7 +61,7 @@ class OTARequestorDriver virtual uint16_t GetMaxDownloadBlockSize() { return 1024; } /// Called when an error occurs at any OTA requestor operation - virtual void HandleError(UpdateStateEnum state, CHIP_ERROR error) = 0; + virtual void HandleError(app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum state, CHIP_ERROR error) = 0; /// Called when the latest query found a software update virtual void UpdateAvailable(const UpdateDescription & update, System::Clock::Seconds32 delay) = 0; diff --git a/src/platform/GenericOTARequestorDriver.cpp b/src/platform/GenericOTARequestorDriver.cpp index 96acdfbe75c544..5fcacdebe4b184 100644 --- a/src/platform/GenericOTARequestorDriver.cpp +++ b/src/platform/GenericOTARequestorDriver.cpp @@ -25,6 +25,8 @@ namespace chip { namespace DeviceLayer { namespace { +using namespace app::Clusters::OtaSoftwareUpdateRequestor; + GenericOTARequestorDriver * ToDriver(void * context) { return static_cast(context); @@ -42,7 +44,7 @@ uint16_t GenericOTARequestorDriver::GetMaxDownloadBlockSize() return 1024; } -void GenericOTARequestorDriver::HandleError(UpdateStateEnum state, CHIP_ERROR error) +void GenericOTARequestorDriver::HandleError(OTAUpdateStateEnum state, CHIP_ERROR error) { // TODO: Schedule the next QueryImage } @@ -50,7 +52,7 @@ void GenericOTARequestorDriver::HandleError(UpdateStateEnum state, CHIP_ERROR er void GenericOTARequestorDriver::UpdateAvailable(const UpdateDescription & update, System::Clock::Seconds32 delay) { VerifyOrDie(mRequestor != nullptr); - ScheduleDelayedAction(UpdateStateEnum::DelayedOnQuery, delay, + ScheduleDelayedAction(OTAUpdateStateEnum::kDelayedOnQuery, delay, [](System::Layer *, void * context) { ToDriver(context)->mRequestor->DownloadUpdate(); }); } @@ -68,14 +70,14 @@ void GenericOTARequestorDriver::UpdateDownloaded() void GenericOTARequestorDriver::UpdateConfirmed(System::Clock::Seconds32 delay) { VerifyOrDie(mImageProcessor != nullptr); - ScheduleDelayedAction(UpdateStateEnum::DelayedOnApply, delay, + ScheduleDelayedAction(OTAUpdateStateEnum::kDelayedOnApply, delay, [](System::Layer *, void * context) { ToDriver(context)->mImageProcessor->Apply(); }); } void GenericOTARequestorDriver::UpdateSuspended(System::Clock::Seconds32 delay) { VerifyOrDie(mRequestor != nullptr); - ScheduleDelayedAction(UpdateStateEnum::DelayedOnApply, delay, + ScheduleDelayedAction(OTAUpdateStateEnum::kDelayedOnApply, delay, [](System::Layer *, void * context) { ToDriver(context)->mRequestor->ApplyUpdate(); }); } @@ -85,7 +87,7 @@ void GenericOTARequestorDriver::UpdateDiscontinued() mImageProcessor->Abort(); } -void GenericOTARequestorDriver::ScheduleDelayedAction(UpdateStateEnum state, System::Clock::Seconds32 delay, +void GenericOTARequestorDriver::ScheduleDelayedAction(OTAUpdateStateEnum state, System::Clock::Seconds32 delay, System::TimerCompleteCallback action) { CHIP_ERROR error = SystemLayer().StartTimer(std::chrono::duration_cast(delay), action, this); diff --git a/src/platform/GenericOTARequestorDriver.h b/src/platform/GenericOTARequestorDriver.h index 9f552a763a30d2..f853821ac785a6 100644 --- a/src/platform/GenericOTARequestorDriver.h +++ b/src/platform/GenericOTARequestorDriver.h @@ -40,7 +40,7 @@ class GenericOTARequestorDriver : public OTARequestorDriver bool CanConsent() override; uint16_t GetMaxDownloadBlockSize() override; - void HandleError(UpdateStateEnum state, CHIP_ERROR error) override; + void HandleError(app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum state, CHIP_ERROR error) override; void UpdateAvailable(const UpdateDescription & update, System::Clock::Seconds32 delay) override; void UpdateNotFound(UpdateNotFoundReason reason, System::Clock::Seconds32 delay) override; void UpdateDownloaded() override; @@ -49,7 +49,8 @@ class GenericOTARequestorDriver : public OTARequestorDriver void UpdateDiscontinued() override; private: - void ScheduleDelayedAction(UpdateStateEnum state, System::Clock::Seconds32 delay, System::TimerCompleteCallback action); + void ScheduleDelayedAction(app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum state, System::Clock::Seconds32 delay, + System::TimerCompleteCallback action); OTARequestorInterface * mRequestor = nullptr; OTAImageProcessorInterface * mImageProcessor = nullptr; diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 11e87c358f6ca8..7c2f4dfc21a3fb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -6276,9 +6276,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value) namespace UpdateState { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = @@ -6291,9 +6291,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpd *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 7c5a59f636f2a5..f61ee2fda728e0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1142,8 +1142,8 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value); namespace UpdateState { EmberAfStatus Get(chip::EndpointId endpoint, - chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum * value); // UpdateStateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value); + chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum * value); // OTAUpdateStateEnum +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value); } // namespace UpdateState namespace UpdateStateProgress { 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 223e748cd2d752..f46d1b5607e29d 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 @@ -8137,9 +8137,6 @@ struct DecodableType } // namespace Events } // namespace Basic namespace OtaSoftwareUpdateProvider { -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM // Enum for OTAApplyUpdateAction enum class OTAApplyUpdateAction : uint8_t { @@ -8147,12 +8144,6 @@ enum class OTAApplyUpdateAction : uint8_t kAwaitNextAction = 0x01, kDiscontinue = 0x02, }; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using OTAApplyUpdateAction = EmberAfOTAApplyUpdateAction; -#endif -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM // Enum for OTADownloadProtocol enum class OTADownloadProtocol : uint8_t { @@ -8161,9 +8152,6 @@ enum class OTADownloadProtocol : uint8_t kHttps = 0x02, kVendorSpecific = 0x03, }; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using OTADownloadProtocol = EmberAfOTADownloadProtocol; -#endif // Enum for OTAQueryStatus enum class OTAQueryStatus : uint8_t { @@ -8472,24 +8460,6 @@ struct TypeInfo } // namespace Attributes } // namespace OtaSoftwareUpdateProvider namespace OtaSoftwareUpdateRequestor { -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -// Enum for ChangeReasonEnum -enum class ChangeReasonEnum : uint8_t -{ - kUnknown = 0x00, - kSuccess = 0x01, - kFailure = 0x02, - kTimeOut = 0x03, - kDelayByProvider = 0x04, -}; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using ChangeReasonEnum = EmberAfChangeReasonEnum; -#endif -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM // Enum for OTAAnnouncementReason enum class OTAAnnouncementReason : uint8_t { @@ -8497,14 +8467,17 @@ enum class OTAAnnouncementReason : uint8_t kUpdateAvailable = 0x01, kUrgentUpdateAvailable = 0x02, }; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using OTAAnnouncementReason = EmberAfOTAAnnouncementReason; -#endif -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -// Enum for UpdateStateEnum -enum class UpdateStateEnum : uint8_t +// Enum for OTAChangeReasonEnum +enum class OTAChangeReasonEnum : uint8_t +{ + kUnknown = 0x00, + kSuccess = 0x01, + kFailure = 0x02, + kTimeOut = 0x03, + kDelayByProvider = 0x04, +}; +// Enum for OTAUpdateStateEnum +enum class OTAUpdateStateEnum : uint8_t { kUnknown = 0x00, kIdle = 0x01, @@ -8516,9 +8489,6 @@ enum class UpdateStateEnum : uint8_t kRollingBack = 0x07, kDelayedOnUserConsent = 0x08, }; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using UpdateStateEnum = EmberAfUpdateStateEnum; -#endif namespace Structs { namespace ProviderLocation { @@ -8634,9 +8604,9 @@ struct TypeInfo namespace UpdateState { struct TypeInfo { - using Type = chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum; - using DecodableType = chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum; - using DecodableArgType = chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum; + using Type = chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum; + using DecodableType = chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum; + using DecodableArgType = chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum; static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateRequestor::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::UpdateState::Id; } @@ -8730,9 +8700,9 @@ struct Type static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateRequestor::Id; } - DataModel::Nullable previousState; - UpdateStateEnum newState; - ChangeReasonEnum reason; + DataModel::Nullable previousState; + OTAUpdateStateEnum newState; + OTAChangeReasonEnum reason; DataModel::Nullable targetSoftwareVersion; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -8745,9 +8715,9 @@ struct DecodableType static constexpr EventId GetEventId() { return kEventId; } static constexpr ClusterId GetClusterId() { return Clusters::OtaSoftwareUpdateRequestor::Id; } - DataModel::Nullable previousState; - UpdateStateEnum newState; - ChangeReasonEnum reason; + DataModel::Nullable previousState; + OTAUpdateStateEnum newState; + OTAChangeReasonEnum reason; DataModel::Nullable targetSoftwareVersion; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index 16a982466a2a46..84b72c07624aad 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -64,16 +64,6 @@ enum EmberAfBootReasonType : uint8_t EMBER_ZCL_BOOT_REASON_TYPE_SOFTWARE_RESET = 6, }; -// Enum for ChangeReasonEnum -enum EmberAfChangeReasonEnum : uint8_t -{ - EMBER_ZCL_CHANGE_REASON_ENUM_UNKNOWN = 0, - EMBER_ZCL_CHANGE_REASON_ENUM_SUCCESS = 1, - EMBER_ZCL_CHANGE_REASON_ENUM_FAILURE = 2, - EMBER_ZCL_CHANGE_REASON_ENUM_TIME_OUT = 3, - EMBER_ZCL_CHANGE_REASON_ENUM_DELAY_BY_PROVIDER = 4, -}; - // Enum for ColorControlOptions enum EmberAfColorControlOptions : uint8_t { @@ -375,31 +365,6 @@ enum EmberAfNodeOperationalCertStatus : uint8_t EMBER_ZCL_NODE_OPERATIONAL_CERT_STATUS_INVALID_FABRIC_INDEX = 11, }; -// Enum for OTAAnnouncementReason -enum EmberAfOTAAnnouncementReason : uint8_t -{ - EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_SIMPLE_ANNOUNCEMENT = 0, - EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_UPDATE_AVAILABLE = 1, - EMBER_ZCL_OTA_ANNOUNCEMENT_REASON_URGENT_UPDATE_AVAILABLE = 2, -}; - -// Enum for OTAApplyUpdateAction -enum EmberAfOTAApplyUpdateAction : uint8_t -{ - EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_PROCEED = 0, - EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_AWAIT_NEXT_ACTION = 1, - EMBER_ZCL_OTA_APPLY_UPDATE_ACTION_DISCONTINUE = 2, -}; - -// Enum for OTADownloadProtocol -enum EmberAfOTADownloadProtocol : uint8_t -{ - EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS = 0, - EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_ASYNCHRONOUS = 1, - EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_HTTPS = 2, - EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_VENDOR_SPECIFIC = 3, -}; - // Enum for OnOffDelayedAllOffEffectVariant enum EmberAfOnOffDelayedAllOffEffectVariant : uint8_t { @@ -564,20 +529,6 @@ enum EmberAfThermostatSystemMode : uint8_t EMBER_ZCL_THERMOSTAT_SYSTEM_MODE_FAN_ONLY = 7, }; -// Enum for UpdateStateEnum -enum EmberAfUpdateStateEnum : uint8_t -{ - EMBER_ZCL_UPDATE_STATE_ENUM_UNKNOWN = 0, - EMBER_ZCL_UPDATE_STATE_ENUM_IDLE = 1, - EMBER_ZCL_UPDATE_STATE_ENUM_QUERYING = 2, - EMBER_ZCL_UPDATE_STATE_ENUM_DELAYED_ON_QUERY = 3, - EMBER_ZCL_UPDATE_STATE_ENUM_DOWNLOADING = 4, - EMBER_ZCL_UPDATE_STATE_ENUM_APPLYING = 5, - EMBER_ZCL_UPDATE_STATE_ENUM_DELAYED_ON_APPLY = 6, - EMBER_ZCL_UPDATE_STATE_ENUM_ROLLING_BACK = 7, - EMBER_ZCL_UPDATE_STATE_ENUM_DELAYED_ON_USER_CONSENT = 8, -}; - // Enum for WcEndProductType enum EmberAfWcEndProductType : uint8_t { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index b78a88b3a85fa3..8434807893701d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -25266,7 +25266,7 @@ class ReadOtaSoftwareUpdateRequestorUpdateState : public ModelCommand this, OnAttributeResponse, OnDefaultFailure); } - static void OnAttributeResponse(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value) + static void OnAttributeResponse(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value) { OnGeneralAttributeResponse(context, "OtaSoftwareUpdateRequestor.UpdateState response", value); } @@ -25303,7 +25303,7 @@ class ReportOtaSoftwareUpdateRequestorUpdateState : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } - static void OnValueReport(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value) + static void OnValueReport(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum value) { LogValue("OtaSoftwareUpdateRequestor.UpdateState report", 0, value); }