diff --git a/examples/all-clusters-app/ameba/main/include/OnOffCommands.h b/examples/all-clusters-app/ameba/main/include/OnOffCommands.h index dd05750f1c70e1..6b261bb052241c 100644 --- a/examples/all-clusters-app/ameba/main/include/OnOffCommands.h +++ b/examples/all-clusters-app/ameba/main/include/OnOffCommands.h @@ -124,7 +124,7 @@ void ProcessOnOffUnicastBindingCommand(BindingCommandData * data, const EmberBin break; case Clusters::OnOff::Commands::OffWithEffect::Id: - offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); + offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); offwitheffectCommand.effectVariant = static_cast(data->args[1]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, offwitheffectCommand, onSuccess, onFailure); @@ -136,7 +136,7 @@ void ProcessOnOffUnicastBindingCommand(BindingCommandData * data, const EmberBin break; case Clusters::OnOff::Commands::OnWithTimedOff::Id: - onwithtimedoffCommand.onOffControl = static_cast>(data->args[0]); + onwithtimedoffCommand.onOffControl = static_cast>(data->args[0]); onwithtimedoffCommand.onTime = static_cast(data->args[1]); onwithtimedoffCommand.offWaitTime = static_cast(data->args[2]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, @@ -171,7 +171,7 @@ void ProcessOnOffGroupBindingCommand(BindingCommandData * data, const EmberBindi break; case Clusters::OnOff::Commands::OffWithEffect::Id: - offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); + offwitheffectCommand.effectIdentifier = static_cast(data->args[0]); offwitheffectCommand.effectVariant = static_cast(data->args[1]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, offwitheffectCommand); break; @@ -181,7 +181,7 @@ void ProcessOnOffGroupBindingCommand(BindingCommandData * data, const EmberBindi break; case Clusters::OnOff::Commands::OnWithTimedOff::Id: - onwithtimedoffCommand.onOffControl = static_cast>(data->args[0]); + onwithtimedoffCommand.onOffControl = static_cast>(data->args[0]); onwithtimedoffCommand.onTime = static_cast(data->args[1]); onwithtimedoffCommand.offWaitTime = static_cast(data->args[2]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, onwithtimedoffCommand); diff --git a/examples/chef/sample_app_util/test_files/sample_zap_file.zap b/examples/chef/sample_app_util/test_files/sample_zap_file.zap index 7de53320310a9b..2488ad155e52d3 100644 --- a/examples/chef/sample_app_util/test_files/sample_zap_file.zap +++ b/examples/chef/sample_app_util/test_files/sample_zap_file.zap @@ -6093,7 +6093,7 @@ "code": 16387, "mfgCode": null, "side": "server", - "type": "OnOffStartUpOnOff", + "type": "StartUpOnOffEnum", "included": 1, "storageOption": "NVM", "singleton": 0, diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index ab504abfb51a52..c4fe7ff0c06e91 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -159,30 +159,28 @@ void OnTriggerOffWithEffect(OnOffEffect * effect) auto effectVariant = effect->mEffectVariant; // Uses print outs until we can support the effects - if (effectId == Clusters::OnOff::OnOffEffectIdentifier::kDelayedAllOff) + if (effectId == Clusters::OnOff::EffectIdentifierEnum::kDelayedAllOff) { - auto typedEffectVariant = static_cast(effectVariant); - if (typedEffectVariant == Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds) + auto typedEffectVariant = static_cast(effectVariant); + if (typedEffectVariant == Clusters::OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffFastFade) { - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kDelayedOffFastFade"); } - else if (typedEffectVariant == Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kNoFade) + else if (typedEffectVariant == Clusters::OnOff::DelayedAllOffEffectVariantEnum::kNoFade) { - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::kNoFade"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kNoFade"); } - else if (typedEffectVariant == - Clusters::OnOff::OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds) + else if (typedEffectVariant == Clusters::OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffSlowFade) { - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kDelayedOffSlowFade"); } } - else if (effectId == Clusters::OnOff::OnOffEffectIdentifier::kDyingLight) + else if (effectId == Clusters::OnOff::EffectIdentifierEnum::kDyingLight) { - auto typedEffectVariant = static_cast(effectVariant); - if (typedEffectVariant == - Clusters::OnOff::OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second) + auto typedEffectVariant = static_cast(effectVariant); + if (typedEffectVariant == Clusters::OnOff::DyingLightEffectVariantEnum::kDyingLightFadeOff) { - ChipLogProgress(Zcl, "OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second"); + ChipLogProgress(Zcl, "DyingLightEffectVariantEnum::kDyingLightFadeOff"); } } } @@ -190,8 +188,8 @@ void OnTriggerOffWithEffect(OnOffEffect * effect) OnOffEffect gEffect = { chip::EndpointId{ 1 }, OnTriggerOffWithEffect, - Clusters::OnOff::OnOffEffectIdentifier::kDelayedAllOff, - to_underlying(Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds), + Clusters::OnOff::EffectIdentifierEnum::kDelayedAllOff, + to_underlying(Clusters::OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffFastFade), }; } // namespace diff --git a/examples/lighting-app/silabs/src/LightingManager.cpp b/examples/lighting-app/silabs/src/LightingManager.cpp index 2c5807f4ea693e..769dc0071166d7 100644 --- a/examples/lighting-app/silabs/src/LightingManager.cpp +++ b/examples/lighting-app/silabs/src/LightingManager.cpp @@ -42,8 +42,8 @@ namespace { OnOffEffect gEffect = { chip::EndpointId{ 1 }, LightMgr().OnTriggerOffWithEffect, - OnOffEffectIdentifier::kDelayedAllOff, - to_underlying(OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds), + EffectIdentifierEnum::kDelayedAllOff, + to_underlying(DelayedAllOffEffectVariantEnum::kDelayedOffFastFade), }; } // namespace @@ -288,32 +288,32 @@ void LightingManager::OnTriggerOffWithEffect(OnOffEffect * effect) // Temporary print outs and delay to test OffEffect behaviour // Until dimming is supported for dev boards. - if (effectId == OnOffEffectIdentifier::kDelayedAllOff) + if (effectId == EffectIdentifierEnum::kDelayedAllOff) { - auto typedEffectVariant = static_cast(effectVariant); - if (typedEffectVariant == OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds) + auto typedEffectVariant = static_cast(effectVariant); + if (typedEffectVariant == DelayedAllOffEffectVariantEnum::kDelayedOffFastFade) { offEffectDuration = 800; - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kDelayedOffFastFade"); } - else if (typedEffectVariant == OnOffDelayedAllOffEffectVariant::kNoFade) + else if (typedEffectVariant == DelayedAllOffEffectVariantEnum::kNoFade) { offEffectDuration = 800; - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::kNoFade"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kNoFade"); } - else if (typedEffectVariant == OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds) + else if (typedEffectVariant == DelayedAllOffEffectVariantEnum::kDelayedOffSlowFade) { offEffectDuration = 12800; - ChipLogProgress(Zcl, "OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds"); + ChipLogProgress(Zcl, "DelayedAllOffEffectVariantEnum::kDelayedOffSlowFade"); } } - else if (effectId == OnOffEffectIdentifier::kDyingLight) + else if (effectId == EffectIdentifierEnum::kDyingLight) { - auto typedEffectVariant = static_cast(effectVariant); - if (typedEffectVariant == OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second) + auto typedEffectVariant = static_cast(effectVariant); + if (typedEffectVariant == DyingLightEffectVariantEnum::kDyingLightFadeOff) { offEffectDuration = 1500; - ChipLogProgress(Zcl, "OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second"); + ChipLogProgress(Zcl, "DyingLightEffectVariantEnum::kDyingLightFadeOff"); } } diff --git a/scripts/py_matter_idl/matter_idl/tests/inputs/cluster_with_commands.matter b/scripts/py_matter_idl/matter_idl/tests/inputs/cluster_with_commands.matter index d978642f26ef1b..dce4c5e9308db5 100644 --- a/scripts/py_matter_idl/matter_idl/tests/inputs/cluster_with_commands.matter +++ b/scripts/py_matter_idl/matter_idl/tests/inputs/cluster_with_commands.matter @@ -1,24 +1,24 @@ server cluster OnOff = 6 { - enum OnOffDelayedAllOffEffectVariant : ENUM8 { - kFadeToOffIn0p8Seconds = 0; + enum DelayedAllOffEffectVariantEnum : ENUM8 { + kDelayedOffFastFade = 0; kNoFade = 1; - k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 2; + kDelayedOffSlowFade = 2; } - enum OnOffDyingLightEffectVariant : ENUM8 { - k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0; + enum DyingLightEffectVariantEnum : ENUM8 { + kDyingLightFadeOff = 0; } - enum OnOffEffectIdentifier : ENUM8 { + enum EffectIdentifierEnum : ENUM8 { kDelayedAllOff = 0; kDyingLight = 1; } - enum OnOffStartUpOnOff : ENUM8 { + enum StartUpOnOffEnum : ENUM8 { kOff = 0; kOn = 1; - kTogglePreviousOnOff = 2; + kToggle = 2; } bitmap OnOffControl : BITMAP8 { diff --git a/scripts/py_matter_idl/matter_idl/tests/inputs/large_all_clusters_app.matter b/scripts/py_matter_idl/matter_idl/tests/inputs/large_all_clusters_app.matter index cc0c601f7dd505..bd73950bd94dcc 100644 --- a/scripts/py_matter_idl/matter_idl/tests/inputs/large_all_clusters_app.matter +++ b/scripts/py_matter_idl/matter_idl/tests/inputs/large_all_clusters_app.matter @@ -216,25 +216,25 @@ server cluster Scenes = 5 { } server cluster OnOff = 6 { - enum OnOffDelayedAllOffEffectVariant : ENUM8 { - kFadeToOffIn0p8Seconds = 0; + enum DelayedAllOffEffectVariantEnum : ENUM8 { + kDelayedOffFastFade = 0; kNoFade = 1; - k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 2; + kDelayedOffSlowFade = 2; } - enum OnOffDyingLightEffectVariant : ENUM8 { - k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0; + enum DyingLightEffectVariantEnum : ENUM8 { + kDyingLightFadeOff = 0; } - enum OnOffEffectIdentifier : ENUM8 { + enum EffectIdentifierEnum : ENUM8 { kDelayedAllOff = 0; kDyingLight = 1; } - enum OnOffStartUpOnOff : ENUM8 { + enum StartUpOnOffEnum : ENUM8 { kOff = 0; kOn = 1; - kTogglePreviousOnOff = 2; + kToggle = 2; } bitmap OnOffControl : BITMAP8 { @@ -253,13 +253,13 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + attribute access(write: manage) nullable StartUpOnOffEnum startUpOnOff = 16387; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; request struct OffWithEffectRequest { - OnOffEffectIdentifier effectId = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + EffectIdentifierEnum effectId = 0; + DelayedAllOffEffectVariantEnum effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/scripts/py_matter_idl/matter_idl/tests/inputs/large_lighting_app.matter b/scripts/py_matter_idl/matter_idl/tests/inputs/large_lighting_app.matter index 6020196c85103e..c0c8391d6a93c8 100644 --- a/scripts/py_matter_idl/matter_idl/tests/inputs/large_lighting_app.matter +++ b/scripts/py_matter_idl/matter_idl/tests/inputs/large_lighting_app.matter @@ -108,25 +108,25 @@ server cluster Groups = 4 { } server cluster OnOff = 6 { - enum OnOffDelayedAllOffEffectVariant : ENUM8 { - kFadeToOffIn0p8Seconds = 0; + enum DelayedAllOffEffectVariantEnum : ENUM8 { + kDelayedOffFastFade = 0; kNoFade = 1; - k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 2; + kDelayedOffSlowFade = 2; } - enum OnOffDyingLightEffectVariant : ENUM8 { - k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0; + enum DyingLightEffectVariantEnum : ENUM8 { + kDyingLightFadeOff = 0; } - enum OnOffEffectIdentifier : ENUM8 { + enum EffectIdentifierEnum : ENUM8 { kDelayedAllOff = 0; kDyingLight = 1; } - enum OnOffStartUpOnOff : ENUM8 { + enum StartUpOnOffEnum : ENUM8 { kOff = 0; kOn = 1; - kTogglePreviousOnOff = 2; + kToggle = 2; } bitmap OnOffControl : BITMAP8 { @@ -145,13 +145,13 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute access(write: manage) nullable OnOffStartUpOnOff startUpOnOff = 16387; + attribute access(write: manage) nullable StartUpOnOffEnum startUpOnOff = 16387; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; request struct OffWithEffectRequest { - OnOffEffectIdentifier effectId = 0; - OnOffDelayedAllOffEffectVariant effectVariant = 1; + EffectIdentifierEnum effectId = 0; + DelayedAllOffEffectVariantEnum effectVariant = 1; } request struct OnWithTimedOffRequest { diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/cpp-tlvmeta/clusters_meta.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/cpp-tlvmeta/clusters_meta.cpp index 66462f8a497554..0e63899c417c59 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/cpp-tlvmeta/clusters_meta.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_with_commands/cpp-tlvmeta/clusters_meta.cpp @@ -16,25 +16,25 @@ const Entry _OnOff[] = { { { CommandTag(2), "Toggle", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::Toggle::() }; -const Entry _OnOff_OnOffDelayedAllOffEffectVariant[] = { - { { ConstantValueTag(0x0), "kFadeToOffIn0p8Seconds", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds - { { ConstantValueTag(0x1), "kNoFade", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffDelayedAllOffEffectVariant::kNoFade - { { ConstantValueTag(0x2), "k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffDelayedAllOffEffectVariant::k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds +const Entry _OnOff_DelayedAllOffEffectVariantEnum[] = { + { { ConstantValueTag(0x0), "kDelayedOffFastFade", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffFastFade + { { ConstantValueTag(0x1), "kNoFade", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::DelayedAllOffEffectVariantEnum::kNoFade + { { ConstantValueTag(0x2), "kDelayedOffSlowFade", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffSlowFade }; -const Entry _OnOff_OnOffDyingLightEffectVariant[] = { - { { ConstantValueTag(0x0), "k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffDyingLightEffectVariant::k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second +const Entry _OnOff_DyingLightEffectVariantEnum[] = { + { { ConstantValueTag(0x0), "kDyingLightFadeOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::DyingLightEffectVariantEnum::kDyingLightFadeOff }; -const Entry _OnOff_OnOffEffectIdentifier[] = { - { { ConstantValueTag(0x0), "kDelayedAllOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffEffectIdentifier::kDelayedAllOff - { { ConstantValueTag(0x1), "kDyingLight", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffEffectIdentifier::kDyingLight +const Entry _OnOff_EffectIdentifierEnum[] = { + { { ConstantValueTag(0x0), "kDelayedAllOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::EffectIdentifierEnum::kDelayedAllOff + { { ConstantValueTag(0x1), "kDyingLight", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::EffectIdentifierEnum::kDyingLight }; -const Entry _OnOff_OnOffStartUpOnOff[] = { - { { ConstantValueTag(0x0), "kOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffStartUpOnOff::kOff - { { ConstantValueTag(0x1), "kOn", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffStartUpOnOff::kOn - { { ConstantValueTag(0x2), "kTogglePreviousOnOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff +const Entry _OnOff_StartUpOnOffEnum[] = { + { { ConstantValueTag(0x0), "kOff", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::StartUpOnOffEnum::kOff + { { ConstantValueTag(0x1), "kOn", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::StartUpOnOffEnum::kOn + { { ConstantValueTag(0x2), "kToggle", ItemType::kDefault }, kInvalidNodeIndex }, // OnOff::StartUpOnOffEnum::kToggle }; const Entry _OnOff_OnOffControl[] = { @@ -66,10 +66,10 @@ const std::array, 8 + 2> clusters_meta = { { _ENTRY(_all_clusters), // 0 _ENTRY(_primitive_type_list), // 1 _ENTRY(_OnOff), // 2 - _ENTRY(_OnOff_OnOffDelayedAllOffEffectVariant), // 3 - _ENTRY(_OnOff_OnOffDyingLightEffectVariant), // 4 - _ENTRY(_OnOff_OnOffEffectIdentifier), // 5 - _ENTRY(_OnOff_OnOffStartUpOnOff), // 6 + _ENTRY(_OnOff_DelayedAllOffEffectVariantEnum), // 3 + _ENTRY(_OnOff_DyingLightEffectVariantEnum), // 4 + _ENTRY(_OnOff_EffectIdentifierEnum), // 5 + _ENTRY(_OnOff_StartUpOnOffEnum), // 6 _ENTRY(_OnOff_OnOffControl), // 7 _ENTRY(_OnOff_OnOffFeature), // 8 _ENTRY(_OnOff_ScenesFeature), // 9 diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index a3ebc06d740b7c..bbd35235e99555 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -634,7 +634,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) */ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp) { - app::DataModel::Nullable startUpOnOff; + app::DataModel::Nullable startUpOnOff; EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); if (status == EMBER_ZCL_STATUS_SUCCESS) { @@ -647,13 +647,13 @@ EmberAfStatus OnOffServer::getOnOffValueForStartUp(chip::EndpointId endpoint, bo { switch (startUpOnOff.Value()) { - case OnOff::OnOffStartUpOnOff::kOff: + case OnOff::StartUpOnOffEnum::kOff: updatedOnOff = false; // Off break; - case OnOff::OnOffStartUpOnOff::kOn: + case OnOff::StartUpOnOffEnum::kOn: updatedOnOff = true; // On break; - case OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff: + case OnOff::StartUpOnOffEnum::kToggle: updatedOnOff = !updatedOnOff; break; default: @@ -811,14 +811,14 @@ uint32_t OnOffServer::calculateNextWaitTimeMS() bool OnOffServer::OnWithTimedOffCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::OnWithTimedOff::DecodableType & commandData) { - BitFlags onOffControl = commandData.onOffControl; - uint16_t onTime = commandData.onTime; - uint16_t offWaitTime = commandData.offWaitTime; - Status status = Status::Success; - chip::EndpointId endpoint = commandPath.mEndpointId; - bool isOn = false; - uint16_t currentOffWaitTime = MAX_ON_OFF_TIME_VALUE; - uint16_t currentOnTime = 0; + BitFlags onOffControl = commandData.onOffControl; + uint16_t onTime = commandData.onTime; + uint16_t offWaitTime = commandData.offWaitTime; + Status status = Status::Success; + chip::EndpointId endpoint = commandPath.mEndpointId; + bool isOn = false; + uint16_t currentOffWaitTime = MAX_ON_OFF_TIME_VALUE; + uint16_t currentOnTime = 0; EmberEventControl * event = configureEventControl(endpoint); VerifyOrExit(event != nullptr, status = Status::UnsupportedEndpoint); @@ -827,7 +827,7 @@ bool OnOffServer::OnWithTimedOffCommand(app::CommandHandler * commandObj, const OnOff::Attributes::OnOff::Get(endpoint, &isOn); // OnOff is off and the commands is only accepted if on - if (onOffControl.Has(OnOffControl::kAcceptOnlyWhenOn) && !isOn) + if (onOffControl.Has(OnOffControlBitmap::kAcceptOnlyWhenOn) && !isOn) { commandObj->AddStatus(commandPath, Status::Success); return true; @@ -1024,7 +1024,7 @@ static inline void unreg(OnOffEffect * inst) } OnOffEffect::OnOffEffect(chip::EndpointId endpoint, OffWithEffectTriggerCommand offWithEffectTrigger, - OnOffEffectIdentifier effectIdentifier, uint8_t effectVariant) : + EffectIdentifierEnum effectIdentifier, uint8_t effectVariant) : mEndpoint(endpoint), mOffWithEffectTrigger(offWithEffectTrigger), mEffectIdentifier(effectIdentifier), mEffectVariant(effectVariant) { diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index aead913b911726..26e62fb2ea1a73 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -101,30 +101,30 @@ class OnOffServer struct OnOffEffect { using OffWithEffectTriggerCommand = void (*)(OnOffEffect *); - using EffectVariantType = std::underlying_type_t; + using EffectVariantType = std::underlying_type_t; static_assert( - std::is_same>::value, - "chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant and " - "chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant underlying types differ."); + std::is_same>::value, + "chip::app::Clusters::OnOff::DelayedAllOffEffectVariantEnum and " + "chip::app::Clusters::OnOff::DyingLightEffectVariantEnum underlying types differ."); chip::EndpointId mEndpoint; OffWithEffectTriggerCommand mOffWithEffectTrigger = nullptr; - chip::app::Clusters::OnOff::OnOffEffectIdentifier mEffectIdentifier; + chip::app::Clusters::OnOff::EffectIdentifierEnum mEffectIdentifier; EffectVariantType mEffectVariant; OnOffEffect * nextEffect = nullptr; - OnOffEffect(chip::EndpointId endpoint, OffWithEffectTriggerCommand offWithEffectTrigger, - chip::app::Clusters::OnOff::OnOffEffectIdentifier effectIdentifier = - chip::app::Clusters::OnOff::OnOffEffectIdentifier::kDelayedAllOff, - - /* - * effectVariant's type depends on the effectIdentifier so we don't know the type at compile time. - * The assertion at the beginning of this method ensures the effect variants share the same base type. - * Casting to the common base type for more flexibility since the type can be OnOffDelayedAllOffEffectVariant or - * OnOffDelayedAllOffEffectVariant - */ - EffectVariantType = - chip::to_underlying(chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant::kFadeToOffIn0p8Seconds)); + OnOffEffect( + chip::EndpointId endpoint, OffWithEffectTriggerCommand offWithEffectTrigger, + chip::app::Clusters::OnOff::EffectIdentifierEnum effectIdentifier = + chip::app::Clusters::OnOff::EffectIdentifierEnum::kDelayedAllOff, + + /* + * effectVariant's type depends on the effectIdentifier so we don't know the type at compile time. + * The assertion at the beginning of this method ensures the effect variants share the same base type. + * Casting to the common base type for more flexibility since the type can be DelayedAllOffEffectVariantEnum or + * DelayedAllOffEffectVariantEnum + */ + EffectVariantType = chip::to_underlying(chip::app::Clusters::OnOff::DelayedAllOffEffectVariantEnum::kDelayedOffFastFade)); ~OnOffEffect(); bool hasNext() { return this->nextEffect != nullptr; } diff --git a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml index 46689b38467deb..91af71dc367b8f 100644 --- a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml @@ -17,32 +17,32 @@ limitations under the License. - + - + - + - + - + - + - + - + - + @@ -59,7 +59,7 @@ limitations under the License. GlobalSceneControl OnTime OffWaitTime - + StartUpOnOff @@ -79,7 +79,7 @@ limitations under the License. The OffWithEffect command allows devices to be turned off using enhanced ways of fading. - + @@ -89,15 +89,15 @@ limitations under the License. The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received during this time, are prevented from turning the devices back on. - - - + + + - + diff --git a/src/controller/python/chip/clusters/TestObjects.py b/src/controller/python/chip/clusters/TestObjects.py index 6e9f5bd8c0af36..cf8733dfd5a3bd 100644 --- a/src/controller/python/chip/clusters/TestObjects.py +++ b/src/controller/python/chip/clusters/TestObjects.py @@ -29,15 +29,15 @@ class OnOff: id: typing.ClassVar[int] = 0x0006 - class OnOffDelayedAllOffEffectVariant(IntEnum): - kFadeToOffIn0p8Seconds = 0x00 + class DelayedAllOffEffectVariantEnum(IntEnum): + kDelayedOffFastFade = 0x00 kNoFade = 0x01 - k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 0x02 + kDelayedOffSlowFade = 0x02 - class OnOffDyingLightEffectVariant(IntEnum): - k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0x00 + class DyingLightEffectVariantEnum(IntEnum): + kDyingLightFadeOff = 0x00 - class OnOffEffectIdentifier(IntEnum): + class EffectIdentifierEnum(IntEnum): kDelayedAllOff = 0x00 kDyingLight = 0x01 diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index c8f0a6b4767829..c69649abde125a 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -3062,10 +3062,17 @@ - EffectVariantEnum - IdentifyTypeEnum OnOff: - - OnOffDelayedAllOffEffectVariant - - OnOffDyingLightEffectVariant - - OnOffEffectIdentifier - - OnOffStartUpOnOff + # DelayedOnOffEffectVariantEnum, DyingLightEffectVariantEnum, + # EffectIdentifierEnum, and StartUpOnOffEnum were originally named + # OnOffDelayedAllOffEffectVariant, + # OnOffDelayedAllOffEffectVariant, OnOffEffectIdentifier, and + # OnOffStartUpOnOff, but we generate the same API for the names + # with/without "Enum" at the end, and with/without the cluster + # name at the beginning, so the name can just change here. + - DelayedAllOffEffectVariantEnum + - DyingLightEffectVariantEnum + - EffectIdentifierEnum + - StartUpOnOffEnum LevelControl: - MoveMode - StepMode @@ -3283,16 +3290,23 @@ - Display - Actuator OnOff: - OnOffDelayedAllOffEffectVariant: + # DelayedOnOffEffectVariantEnum, DyingLightEffectVariantEnum, + # EffectIdentifierEnum, and StartUpOnOffEnum were originally named + # OnOffDelayedAllOffEffectVariant, + # OnOffDelayedAllOffEffectVariant, OnOffEffectIdentifier, and + # OnOffStartUpOnOff, but we generate the same API for the names + # with/without "Enum" at the end, and with/without the cluster + # name at the beginning, so the name can just change here. + DelayedAllOffEffectVariantEnum: - FadeToOffIn0p8Seconds - NoFade - 50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds - OnOffDyingLightEffectVariant: + DyingLightEffectVariantEnum: - 20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second - OnOffEffectIdentifier: + EffectIdentifierEnum: - DelayedAllOff - DyingLight - OnOffStartUpOnOff: + StartUpOnOffEnum: - Off - On - TogglePreviousOnOff @@ -7562,8 +7576,65 @@ - release: "Future" versions: "future" + introduced: + enum values: + OnOff: + DelayedAllOffEffectVariantEnum: + - DelayedOffFastFade + - DelayedOffSlowFade + DyingLightEffectVariantEnum: + - DyingLightFadeOff + StartUpOnOffEnum: + - Toggle + bitmaps: + OnOff: + - OnOffControlBitmap + bitmap values: + OnOff: + Feature: + - DeadFrontBehavior + OnOffControlBitmap: + - AcceptOnlyWhenOn + deprecated: + enum values: + OnOff: + DelayedAllOffEffectVariantEnum: + - FadeToOffIn0p8Seconds + - 50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds + DyingLightEffectVariantEnum: + - 20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second + StartUpOnOffEnum: + - TogglePreviousOnOff + bitmaps: + OnOff: + - OnOffControl + bitmap values: + OnOff: + Feature: + - DeadFront provisional: bitmaps: BarrierControl: - BarrierControlCapabilities - BarrierControlSafetyStatus + attributes: + GeneralDiagnostics: + # Not in the spec yet. + - AverageWearCount + renames: + enum values: + OnOff: + DelayedAllOffEffectVariantEnum: + DelayedOffFastFade: FadeToOffIn0p8Seconds + DelayedOffSlowFade: 50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds + DyingLightEffectVariantEnum: + DyingLightFadeOff: 20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second + StartUpOnOffEnum: + Toggle: TogglePreviousOnOff + bitmaps: + OnOff: + OnOffControlBitmap: OnOffControl + bitmap values: + OnOff: + Feature: + DeadFrontBehavior: DeadFront