From 36645232d89a641d4fb6399fec6dc1ec08bcf698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=A9gevand?= <77852424+jmeg-sfy@users.noreply.github.com> Date: Wed, 15 Jun 2022 14:50:35 +0200 Subject: [PATCH] WindowCovering: Improve Xml enum for OperationalStatus (#18300) * DEV: Rename feature * DEV: BitFlags add Set/Get field/mask * DEV/ZAP: Rename SafetyStatus * DEV: Changes feature + Remove Useless artifact * ZAP: Update OperationalStatus definition * DEV: Rework OperationalStatus * FIX: SetField * Add prints * Dev: add operational status checks * DEV: Rework OperationalStatus from ESP32 * FIX: Update nrfconnect code * Restyled by clang-format * ZAP: Update + Regen * Restyled by google-java-format * ZAP: Update + Regen * DEV: Update from BitFlags to BitMask * ZAP: Update + Regen * Zap: Update + Regen * Drop: BitFlags modifications * ZAP: Update + Regen Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 24 +-- .../esp32/main/DeviceWithDisplay.cpp | 8 +- .../all-clusters-minimal-app.matter | 22 +- .../placeholder/linux/apps/app1/config.matter | 24 +-- .../placeholder/linux/apps/app2/config.matter | 24 +-- .../window-app/common/include/WindowApp.h | 13 +- examples/window-app/common/src/WindowApp.cpp | 33 ++- examples/window-app/common/window-app.matter | 24 +-- .../nrfconnect/main/WindowCovering.cpp | 35 +-- .../window-covering-server.cpp | 204 ++++++++---------- .../window-covering-server.h | 38 +--- .../zcl/data-model/chip/window-covering.xml | 21 +- .../data_model/controller-clusters.matter | 24 +-- .../CHIPAttributeTLVValueDecoder.cpp | 4 +- .../CHIPAttributeTLVValueDecoder.mm | 4 +- .../CHIP/zap-generated/CHIPCallbackBridge.mm | 48 +++++ .../CHIPCallbackBridge_internal.h | 59 +++++ .../CHIP/zap-generated/CHIPClustersObjc.h | 50 ++--- .../CHIP/zap-generated/CHIPClustersObjc.mm | 104 ++++----- .../zap-generated/attributes/Accessors.cpp | 16 +- .../zap-generated/attributes/Accessors.h | 10 +- .../app-common/zap-generated/cluster-enums.h | 28 +-- .../zap-generated/cluster-objects.h | 18 +- .../app-common/zap-generated/enums.h | 80 +++---- .../cluster/logging/DataModelLogger.cpp | 4 +- .../chip-tool/zap-generated/test/Commands.h | 40 ++-- .../cluster/CHIPTestClustersObjc.mm | 4 +- 27 files changed, 498 insertions(+), 465 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 0bf6a45aeaefcb..f97edf39c9d9db 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3711,14 +3711,7 @@ server cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -3726,13 +3719,20 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -3757,7 +3757,7 @@ server cluster WindowCovering = 258 { readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; readonly attribute EndProductType endProductType = 13; @@ -3768,7 +3768,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; attribute access(write: manage) Mode mode = 23; - readonly attribute bitmap16 safetyStatus = 26; + readonly attribute SafetyStatus safetyStatus = 26; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; diff --git a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp index ef87982f8eb5eb..246825835638eb 100644 --- a/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceWithDisplay.cpp @@ -301,7 +301,9 @@ class EditAttributeListModel : public TouchesMatterStackModel { // update the operational status here for hardcoded endpoint 1 ESP_LOGI(TAG, "Operational status changed to : %d", n); - app::Clusters::WindowCovering::Attributes::OperationalStatus::Set(1, static_cast(n)); + chip::BitFlags opStatus = + static_cast>(n); + app::Clusters::WindowCovering::Attributes::OperationalStatus::Set(1, opStatus); } else if (name == "Bat remaining") { @@ -676,7 +678,9 @@ void SetupPretendDevices() AddAttribute("Current Tilt", "5"); app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Set(1, static_cast(5 * 100)); AddAttribute("Opr Status", "0"); - app::Clusters::WindowCovering::Attributes::OperationalStatus::Set(1, static_cast(0)); + chip::BitFlags opStatus = + static_cast>(0); + app::Clusters::WindowCovering::Attributes::OperationalStatus::Set(1, opStatus); AddDevice("Battery"); AddEndpoint("1"); diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index de169f34582b4d..3b1bd2e565b06d 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3174,14 +3174,7 @@ server cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -3189,13 +3182,20 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -3212,7 +3212,7 @@ server cluster WindowCovering = 258 { readonly attribute Type type = 0; readonly attribute ConfigStatus configStatus = 7; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute EndProductType endProductType = 13; attribute access(write: manage) Mode mode = 23; readonly attribute bitmap32 featureMap = 65532; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 832f9ca426152c..37bb895aca9159 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -2496,14 +2496,7 @@ server cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -2511,13 +2504,20 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -2538,7 +2538,7 @@ server cluster WindowCovering = 258 { readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; readonly attribute EndProductType endProductType = 13; @@ -2549,7 +2549,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; attribute access(write: manage) Mode mode = 23; - readonly attribute bitmap16 safetyStatus = 26; + readonly attribute SafetyStatus safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 832f9ca426152c..37bb895aca9159 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -2496,14 +2496,7 @@ server cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -2511,13 +2504,20 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -2538,7 +2538,7 @@ server cluster WindowCovering = 258 { readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; readonly attribute EndProductType endProductType = 13; @@ -2549,7 +2549,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; attribute access(write: manage) Mode mode = 23; - readonly attribute bitmap16 safetyStatus = 26; + readonly attribute SafetyStatus safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; diff --git a/examples/window-app/common/include/WindowApp.h b/examples/window-app/common/include/WindowApp.h index 22a7c66ad924e1..210af1bf1a5b71 100644 --- a/examples/window-app/common/include/WindowApp.h +++ b/examples/window-app/common/include/WindowApp.h @@ -112,12 +112,14 @@ class WindowApp void LiftContinueToTarget() { LiftUpdate(false); } void LiftStepToward(OperationalState direction); void LiftSchedulePositionSet(chip::Percent100ths position) { SchedulePositionSet(position, false); } + void LiftScheduleOperationalStateSet(OperationalState opState) { ScheduleOperationalStateSet(opState, false); } void TiltUpdate(bool newTarget); void TiltGoToTarget() { TiltUpdate(true); } void TiltContinueToTarget() { TiltUpdate(false); } void TiltStepToward(OperationalState direction); void TiltSchedulePositionSet(chip::Percent100ths position) { SchedulePositionSet(position, true); } + void TiltScheduleOperationalStateSet(OperationalState opState) { ScheduleOperationalStateSet(opState, true); } void StepToward(OperationalState direction, bool isTilt); @@ -128,11 +130,6 @@ class WindowApp chip::EndpointId mEndpoint = 0; - // Attribute: Id 10 OperationalStatus - OperationalStatus mOperationalStatus = { .global = OperationalState::Stall, - .lift = OperationalState::Stall, - .tilt = OperationalState::Stall }; - Timer * mLiftTimer = nullptr; Timer * mTiltTimer = nullptr; OperationalState mLiftOpState = OperationalState::Stall; @@ -146,14 +143,14 @@ class WindowApp union { chip::Percent100ths percent100ths; - OperationalStatus opStatus; + OperationalState opState; }; }; void SchedulePositionSet(chip::Percent100ths position, bool isTilt); static void CallbackPositionSet(intptr_t arg); - void ScheduleOperationalStatusSetWithGlobalUpdate(OperationalStatus opStatus); - static void CallbackOperationalStatusSetWithGlobalUpdate(intptr_t arg); + void ScheduleOperationalStateSet(OperationalState opState, bool isTilt); + static void CallbackOperationalStateSet(intptr_t arg); }; static WindowApp & Instance(); diff --git a/examples/window-app/common/src/WindowApp.cpp b/examples/window-app/common/src/WindowApp.cpp index 0cada84b7b046c..4c846ecf6a8c05 100644 --- a/examples/window-app/common/src/WindowApp.cpp +++ b/examples/window-app/common/src/WindowApp.cpp @@ -296,6 +296,7 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At Cover * cover = GetCover(endpoint); chip::BitMask mode; chip::BitMask configStatus; + chip::BitMask opStatus; if (nullptr == cover) { @@ -316,7 +317,8 @@ void WindowApp::DispatchEventAttributeChange(chip::EndpointId endpoint, chip::At /* RO OperationalStatus */ case Attributes::OperationalStatus::Id: chip::DeviceLayer::PlatformMgr().LockChipStack(); - emberAfWindowCoveringClusterPrint("Global OpState: %02X\n", (unsigned int) OperationalStatusGet(endpoint).global); + opStatus = OperationalStatusGet(endpoint); + OperationalStatusPrint(opStatus); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); break; /* RW Mode */ @@ -432,8 +434,6 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint) configStatus.Set(ConfigStatus::kOnlineReserved); ConfigStatusSet(endpoint, configStatus); - OperationalStatusSetWithGlobalUpdated(endpoint, mOperationalStatus); - // Attribute: Id 13 EndProductType EndProductTypeSet(endpoint, EndProductType::kInteriorBlind); @@ -448,8 +448,7 @@ void WindowApp::Cover::Init(chip::EndpointId endpoint) ModeSet(endpoint, mode); // Attribute: Id 27 SafetyStatus (Optional) - SafetyStatus safetyStatus = { 0x00 }; // 0 is no issues; - SafetyStatusSet(endpoint, safetyStatus); + chip::BitFlags safetyStatus(0x00); // 0 is no issues; } void WindowApp::Cover::Finish() @@ -489,8 +488,7 @@ void WindowApp::Cover::LiftUpdate(bool newTarget) Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, target); Attributes::CurrentPositionLiftPercent100ths::Get(mEndpoint, current); - OperationalStatus opStatus = OperationalStatusGet(mEndpoint); - OperationalState opState = ComputeOperationalState(target, current); + OperationalState opState = ComputeOperationalState(target, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); @@ -514,9 +512,8 @@ void WindowApp::Cover::LiftUpdate(bool newTarget) mLiftOpState = OperationalState::Stall; } - opStatus.lift = mLiftOpState; - ScheduleOperationalStatusSetWithGlobalUpdate(opStatus); + LiftScheduleOperationalStateSet(mLiftOpState); if ((OperationalState::Stall != mLiftOpState) && mLiftTimer) { @@ -555,8 +552,7 @@ void WindowApp::Cover::TiltUpdate(bool newTarget) Attributes::TargetPositionTiltPercent100ths::Get(mEndpoint, target); Attributes::CurrentPositionTiltPercent100ths::Get(mEndpoint, current); - OperationalStatus opStatus = OperationalStatusGet(mEndpoint); - OperationalState opState = ComputeOperationalState(target, current); + OperationalState opState = ComputeOperationalState(target, current); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); @@ -580,9 +576,8 @@ void WindowApp::Cover::TiltUpdate(bool newTarget) mTiltOpState = OperationalState::Stall; } - opStatus.tilt = mTiltOpState; - ScheduleOperationalStatusSetWithGlobalUpdate(opStatus); + TiltScheduleOperationalStateSet(mTiltOpState); if ((OperationalState::Stall != mTiltOpState) && mTiltTimer) { @@ -676,21 +671,23 @@ void WindowApp::Cover::CallbackPositionSet(intptr_t arg) chip::Platform::Delete(data); } -void WindowApp::Cover::ScheduleOperationalStatusSetWithGlobalUpdate(OperationalStatus opStatus) +void WindowApp::Cover::ScheduleOperationalStateSet(OperationalState opState, bool isTilt) { CoverWorkData * data = chip::Platform::New(); VerifyOrReturn(data != nullptr, emberAfWindowCoveringClusterPrint("Cover::OperationalStatusSet - Out of Memory for WorkData")); data->mEndpointId = mEndpoint; - data->opStatus = opStatus; + data->opState = opState; + data->isTilt = isTilt; - chip::DeviceLayer::PlatformMgr().ScheduleWork(CallbackOperationalStatusSetWithGlobalUpdate, reinterpret_cast(data)); + chip::DeviceLayer::PlatformMgr().ScheduleWork(CallbackOperationalStateSet, reinterpret_cast(data)); } -void WindowApp::Cover::CallbackOperationalStatusSetWithGlobalUpdate(intptr_t arg) +void WindowApp::Cover::CallbackOperationalStateSet(intptr_t arg) { WindowApp::Cover::CoverWorkData * data = reinterpret_cast(arg); - OperationalStatusSetWithGlobalUpdated(data->mEndpointId, data->opStatus); + + OperationalStateSet(data->mEndpointId, data->isTilt ? OperationalStatus::kTilt : OperationalStatus::kLift, data->opState); chip::Platform::Delete(data); } diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index e60eb56acf245a..37ec6085a3d5a1 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -1468,14 +1468,7 @@ server cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -1483,13 +1476,20 @@ server cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -1514,7 +1514,7 @@ server cluster WindowCovering = 258 { readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; readonly attribute EndProductType endProductType = 13; @@ -1525,7 +1525,7 @@ server cluster WindowCovering = 258 { readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; attribute access(write: manage) Mode mode = 23; - readonly attribute bitmap16 safetyStatus = 26; + readonly attribute SafetyStatus safetyStatus = 26; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; diff --git a/examples/window-app/nrfconnect/main/WindowCovering.cpp b/examples/window-app/nrfconnect/main/WindowCovering.cpp index cd4dc07fc127eb..f1fd5a7059cadb 100644 --- a/examples/window-app/nrfconnect/main/WindowCovering.cpp +++ b/examples/window-app/nrfconnect/main/WindowCovering.cpp @@ -91,17 +91,15 @@ chip::Percent100ths WindowCovering::CalculateSingleStep(MoveType aMoveType) NPercent100ths current{}; OperationalState opState{}; - OperationalStatus opStatus = OperationalStatusGet(Endpoint()); - if (aMoveType == MoveType::LIFT) { status = Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current); - opState = opStatus.lift; + opState = OperationalStateGet(Endpoint(), OperationalStatus::kLift); } else if (aMoveType == MoveType::TILT) { status = Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current); - opState = opStatus.tilt; + opState = OperationalStateGet(Endpoint(), OperationalStatus::kTilt); } if ((status == EMBER_ZCL_STATUS_SUCCESS) && !current.IsNull()) @@ -119,26 +117,7 @@ chip::Percent100ths WindowCovering::CalculateSingleStep(MoveType aMoveType) bool WindowCovering::TargetCompleted(MoveType aMoveType, NPercent100ths aCurrent, NPercent100ths aTarget) { - OperationalStatus currentOpStatus = OperationalStatusGet(Endpoint()); - OperationalState currentOpState = (aMoveType == MoveType::LIFT) ? currentOpStatus.lift : currentOpStatus.tilt; - - if (!aCurrent.IsNull() && !aTarget.IsNull()) - { - switch (currentOpState) - { - case OperationalState::MovingDownOrClose: - return (aCurrent.Value() >= aTarget.Value()); - case OperationalState::MovingUpOrOpen: - return (aCurrent.Value() <= aTarget.Value()); - default: - return true; - } - } - else - { - LOG_ERR("Invalid target/current positions"); - } - return false; + return (OperationalState::Stall == ComputeOperationalState(aTarget, aCurrent)); } void WindowCovering::StartTimer(MoveType aMoveType, uint32_t aTimeoutMs) @@ -230,23 +209,19 @@ void WindowCovering::SetSingleStepTarget(OperationalState aDirection) void WindowCovering::UpdateOperationalStatus(MoveType aMoveType, OperationalState aDirection) { - OperationalStatus currentOpStatus = OperationalStatusGet(Endpoint()); - switch (aMoveType) { case MoveType::LIFT: - currentOpStatus.lift = aDirection; + OperationalStateSet(Endpoint(), OperationalStatus::kLift, aDirection); break; case MoveType::TILT: - currentOpStatus.tilt = aDirection; + OperationalStateSet(Endpoint(), OperationalStatus::kTilt, aDirection); break; case MoveType::NONE: break; default: break; } - - OperationalStatusSetWithGlobalUpdated(Endpoint(), currentOpStatus); } void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percent100ths aPosition) diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp index 251118cc542a7c..d4ce21cf920d38 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -93,43 +93,12 @@ static Percent100ths ValueToPercent100ths(AbsoluteLimits limits, uint16_t absolu return ConvertValue(limits.open, limits.closed, WC_PERCENT100THS_MIN_OPEN, WC_PERCENT100THS_MAX_CLOSED, absolute); } -static OperationalState ValueToOperationalState(uint8_t value) -{ - switch (value) - { - case 0x00: - return OperationalState::Stall; - case 0x01: - return OperationalState::MovingUpOrOpen; - case 0x02: - return OperationalState::MovingDownOrClose; - case 0x03: - default: - return OperationalState::Reserved; - } -} -static uint8_t OperationalStateToValue(const OperationalState & state) -{ - switch (state) - { - case OperationalState::Stall: - return 0x00; - case OperationalState::MovingUpOrOpen: - return 0x01; - case OperationalState::MovingDownOrClose: - return 0x02; - case OperationalState::Reserved: - default: - return 0x03; - } -} - namespace chip { namespace app { namespace Clusters { namespace WindowCovering { -bool HasFeature(chip::EndpointId endpoint, WcFeature feature) +bool HasFeature(chip::EndpointId endpoint, Feature feature) { bool hasFeature = false; uint32_t featureMap = 0; @@ -145,12 +114,12 @@ bool HasFeature(chip::EndpointId endpoint, WcFeature feature) bool HasFeaturePaLift(chip::EndpointId endpoint) { - return (HasFeature(endpoint, WcFeature::kLift) && HasFeature(endpoint, WcFeature::kPositionAwareLift)); + return (HasFeature(endpoint, Feature::kLift) && HasFeature(endpoint, Feature::kPositionAwareLift)); } bool HasFeaturePaTilt(chip::EndpointId endpoint) { - return (HasFeature(endpoint, WcFeature::kTilt) && HasFeature(endpoint, WcFeature::kPositionAwareTilt)); + return (HasFeature(endpoint, Feature::kTilt) && HasFeature(endpoint, Feature::kPositionAwareTilt)); } void TypeSet(chip::EndpointId endpoint, Type type) @@ -206,40 +175,61 @@ void ConfigStatusUpdateFeatures(chip::EndpointId endpoint) ConfigStatusSet(endpoint, configStatus); } -void OperationalStatusSetWithGlobalUpdated(chip::EndpointId endpoint, OperationalStatus & status) +void OperationalStatusPrint(const chip::BitMask & opStatus) { - /* Global Always follow Lift by priority and then fallback to Tilt */ - if (OperationalState::Stall != status.lift) - { - status.global = status.lift; - } - else + emberAfWindowCoveringClusterPrint("OperationalStatus raw=0x%02X global=%u lift=%u tilt=%u", opStatus.Raw(), + opStatus.GetField(OperationalStatus::kGlobal), opStatus.GetField(OperationalStatus::kLift), + opStatus.GetField(OperationalStatus::kTilt)); +} + +chip::BitMask OperationalStatusGet(chip::EndpointId endpoint) +{ + chip::BitMask status; + + Attributes::OperationalStatus::Get(endpoint, &status); + + return status; +} + +void OperationalStatusSet(chip::EndpointId endpoint, chip::BitMask newStatus) +{ + chip::BitMask prevStatus; + Attributes::OperationalStatus::Get(endpoint, &prevStatus); + + // Filter changes + if (newStatus != prevStatus) { - status.global = status.tilt; + Attributes::OperationalStatus::Set(endpoint, newStatus); } - - OperationalStatusSet(endpoint, status); } -void OperationalStatusSet(chip::EndpointId endpoint, const OperationalStatus & status) +void OperationalStateSet(chip::EndpointId endpoint, const chip::BitMask field, OperationalState state) { - uint8_t global = OperationalStateToValue(status.global); - uint8_t lift = OperationalStateToValue(status.lift); - uint8_t tilt = OperationalStateToValue(status.tilt); - uint8_t value = (global & 0x03) | static_cast((lift & 0x03) << 2) | static_cast((tilt & 0x03) << 4); - Attributes::OperationalStatus::Set(endpoint, value); + chip::BitMask status; + Attributes::OperationalStatus::Get(endpoint, &status); + + /* Filter only Lift or Tilt action since we cannot allow global reflecting a state alone */ + if ((OperationalStatus::kLift == field) || (OperationalStatus::kTilt == field)) + { + status.SetField(field, static_cast(state)); + status.SetField(OperationalStatus::kGlobal, static_cast(state)); + + /* Global Always follow Lift by priority or therefore fallback to Tilt */ + chip::BitMask opGlobal = + status.HasAny(OperationalStatus::kLift) ? OperationalStatus::kLift : OperationalStatus::kTilt; + status.SetField(OperationalStatus::kGlobal, status.GetField(opGlobal)); + + OperationalStatusSet(endpoint, status); + } } -const OperationalStatus OperationalStatusGet(chip::EndpointId endpoint) +OperationalState OperationalStateGet(chip::EndpointId endpoint, const chip::BitMask field) { - uint8_t value = 0; - OperationalStatus status; + chip::BitMask status; - Attributes::OperationalStatus::Get(endpoint, &value); - status.global = ValueToOperationalState(value & 0x03); - status.lift = ValueToOperationalState((value >> 2) & 0x03); - status.tilt = ValueToOperationalState((value >> 4) & 0x03); - return status; + Attributes::OperationalStatus::Get(endpoint, &status); + + return static_cast(status.GetField(field)); } void EndProductTypeSet(chip::EndpointId endpoint, EndProductType type) @@ -296,42 +286,17 @@ chip::BitMask ModeGet(chip::EndpointId endpoint) return mode; } -void SafetyStatusSet(chip::EndpointId endpoint, SafetyStatus & status) -{ - /* clang-format off */ - uint16_t value = (status.remoteLockout ? 0x0001 : 0) - | (status.tamperDetection ? 0x0002 : 0) - | (status.failedCommunication ? 0x0004 : 0) - | (status.positionFailure ? 0x0008 : 0) - | (status.thermalProtection ? 0x0010 : 0) - | (status.obstacleDetected ? 0x0020 : 0) - | (status.powerIssue ? 0x0040 : 0) - | (status.stopInput ? 0x0080 : 0); - value |= (uint16_t) (status.motorJammed ? 0x0100 : 0) - | (uint16_t) (status.hardwareFailure ? 0x0200 : 0) - | (uint16_t) (status.manualOperation ? 0x0400 : 0); - /* clang-format on */ - Attributes::SafetyStatus::Set(endpoint, value); -} - -const SafetyStatus SafetyStatusGet(chip::EndpointId endpoint) -{ - uint16_t value = 0; - SafetyStatus status; - - Attributes::SafetyStatus::Get(endpoint, &value); - status.remoteLockout = (value & 0x0001) ? 1 : 0; - status.tamperDetection = (value & 0x0002) ? 1 : 0; - status.failedCommunication = (value & 0x0004) ? 1 : 0; - status.positionFailure = (value & 0x0008) ? 1 : 0; - status.thermalProtection = (value & 0x0010) ? 1 : 0; - status.obstacleDetected = (value & 0x0020) ? 1 : 0; - status.powerIssue = (value & 0x0040) ? 1 : 0; - status.stopInput = (value & 0x0080) ? 1 : 0; - status.motorJammed = (value & 0x0100) ? 1 : 0; - status.hardwareFailure = (value & 0x0200) ? 1 : 0; - status.manualOperation = (value & 0x0400) ? 1 : 0; - return status; +void SafetyStatusSet(chip::EndpointId endpoint, chip::BitMask & newSafetyStatus) +{ + Attributes::SafetyStatus::Set(endpoint, newSafetyStatus); +} + +chip::BitMask SafetyStatusGet(chip::EndpointId endpoint) +{ + chip::BitMask safetyStatus; + + Attributes::SafetyStatus::Get(endpoint, &safetyStatus); + return safetyStatus; } LimitStatus CheckLimitState(uint16_t position, AbsoluteLimits limits) @@ -528,11 +493,15 @@ Percent100ths ComputePercent100thsStep(OperationalState direction, Percent100ths void emberAfPluginWindowCoveringFinalizeFakeMotionEventHandler(EndpointId endpoint) { NPercent100ths position; - OperationalStatus opStatus = OperationalStatusGet(endpoint); - emberAfWindowCoveringClusterPrint("WC DELAYED CALLBACK 100ms w/ OpStatus=0x%02X", (unsigned char) opStatus.global); + + OperationalState opLift = OperationalStateGet(endpoint, OperationalStatus::kLift); + OperationalState opTilt = OperationalStateGet(endpoint, OperationalStatus::kTilt); + + emberAfWindowCoveringClusterPrint("WC DELAYED CALLBACK 100ms w/ OpLift=0x%02X OpTilt=0x%02X", (unsigned char) opLift, + (unsigned char) opTilt); /* Update position to simulate movement to pass the CI */ - if (OperationalState::Stall != opStatus.lift) + if (OperationalState::Stall != opLift) { Attributes::TargetPositionLiftPercent100ths::Get(endpoint, position); if (!position.IsNull()) @@ -542,7 +511,7 @@ void emberAfPluginWindowCoveringFinalizeFakeMotionEventHandler(EndpointId endpoi } /* Update position to simulate movement to pass the CI */ - if (OperationalState::Stall != opStatus.tilt) + if (OperationalState::Stall != opTilt) { Attributes::TargetPositionTiltPercent100ths::Get(endpoint, position); if (!position.IsNull()) @@ -594,18 +563,17 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI BitMask mode; BitMask configStatus; NPercent100ths current, target; - OperationalStatus prevOpStatus = OperationalStatusGet(endpoint); - OperationalStatus opStatus = prevOpStatus; - emberAfWindowCoveringClusterPrint("WC POST ATTRIBUTE=%u OpStatus global=0x%02X lift=0x%02X tilt=0x%02X", - (unsigned int) attributeId, (unsigned int) opStatus.global, (unsigned int) opStatus.lift, - (unsigned int) opStatus.tilt); + emberAfWindowCoveringClusterPrint("WC POST ATTRIBUTE=%u", (unsigned int) attributeId); + + OperationalState opLift = OperationalStateGet(endpoint, OperationalStatus::kLift); + OperationalState opTilt = OperationalStateGet(endpoint, OperationalStatus::kTilt); switch (attributeId) { /* RO OperationalStatus */ case Attributes::OperationalStatus::Id: - if (OperationalState::Stall != opStatus.global) + if (OperationalState::Stall != OperationalStateGet(endpoint, OperationalStatus::kGlobal)) { // Finish the fake motion attribute update: emberEventControlSetDelayMS(ConfigureFakeMotionEventControl(endpoint), FAKE_MOTION_DELAY_MS); @@ -613,16 +581,16 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI break; /* ============= Positions for Position Aware ============= */ case Attributes::CurrentPositionLiftPercent100ths::Id: - if (OperationalState::Stall != opStatus.lift) + if (OperationalState::Stall != opLift) { - opStatus.lift = OperationalState::Stall; + opLift = OperationalState::Stall; emberAfWindowCoveringClusterPrint("Lift stop"); } break; case Attributes::CurrentPositionTiltPercent100ths::Id: - if (OperationalState::Stall != opStatus.tilt) + if (OperationalState::Stall != opTilt) { - opStatus.tilt = OperationalState::Stall; + opTilt = OperationalState::Stall; emberAfWindowCoveringClusterPrint("Tilt stop"); } break; @@ -630,13 +598,13 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI case Attributes::TargetPositionLiftPercent100ths::Id: Attributes::TargetPositionLiftPercent100ths::Get(endpoint, target); Attributes::CurrentPositionLiftPercent100ths::Get(endpoint, current); - opStatus.lift = ComputeOperationalState(target, current); + opLift = ComputeOperationalState(target, current); break; /* For a device supporting Position Awareness : Changing the Target triggers motions on the real or simulated device */ case Attributes::TargetPositionTiltPercent100ths::Id: Attributes::TargetPositionTiltPercent100ths::Get(endpoint, target); Attributes::CurrentPositionTiltPercent100ths::Get(endpoint, current); - opStatus.tilt = ComputeOperationalState(target, current); + opTilt = ComputeOperationalState(target, current); break; /* Mode change is either internal from the application or external from a write request */ case Attributes::Mode::Id: @@ -653,8 +621,8 @@ void PostAttributeChange(chip::EndpointId endpoint, chip::AttributeId attributeI } /* This decides and triggers fake motion for the selected endpoint */ - if ((opStatus.lift != prevOpStatus.lift) || (opStatus.tilt != prevOpStatus.tilt)) - OperationalStatusSetWithGlobalUpdated(endpoint, opStatus); + OperationalStateSet(endpoint, OperationalStatus::kLift, opLift); + OperationalStateSet(endpoint, OperationalStatus::kTilt, opTilt); } EmberAfStatus GetMotionLockStatus(chip::EndpointId endpoint) @@ -721,11 +689,11 @@ bool emberAfWindowCoveringClusterUpOrOpenCallback(app::CommandHandler * commandO return true; } - if (HasFeature(endpoint, WcFeature::kLift)) + if (HasFeature(endpoint, Feature::kLift)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, WC_PERCENT100THS_MIN_OPEN); } - if (HasFeature(endpoint, WcFeature::kTilt)) + if (HasFeature(endpoint, Feature::kTilt)) { Attributes::TargetPositionTiltPercent100ths::Set(endpoint, WC_PERCENT100THS_MIN_OPEN); } @@ -751,11 +719,11 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(app::CommandHandler * comma return true; } - if (HasFeature(endpoint, WcFeature::kLift)) + if (HasFeature(endpoint, Feature::kLift)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, WC_PERCENT100THS_MAX_CLOSED); } - if (HasFeature(endpoint, WcFeature::kTilt)) + if (HasFeature(endpoint, Feature::kTilt)) { Attributes::TargetPositionTiltPercent100ths::Set(endpoint, WC_PERCENT100THS_MAX_CLOSED); } @@ -818,7 +786,7 @@ bool emberAfWindowCoveringClusterGoToLiftValueCallback(app::CommandHandler * com return true; } - if (HasFeature(endpoint, WcFeature::kAbsolutePosition) && HasFeaturePaLift(endpoint)) + if (HasFeature(endpoint, Feature::kAbsolutePosition) && HasFeaturePaLift(endpoint)) { Attributes::TargetPositionLiftPercent100ths::Set(endpoint, LiftToPercent100ths(endpoint, liftValue)); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); @@ -892,7 +860,7 @@ bool emberAfWindowCoveringClusterGoToTiltValueCallback(app::CommandHandler * com return true; } - if (HasFeature(endpoint, WcFeature::kAbsolutePosition) && HasFeaturePaTilt(endpoint)) + if (HasFeature(endpoint, Feature::kAbsolutePosition) && HasFeaturePaTilt(endpoint)) { Attributes::TargetPositionTiltPercent100ths::Set(endpoint, TiltToPercent100ths(endpoint, tiltValue)); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); diff --git a/src/app/clusters/window-covering-server/window-covering-server.h b/src/app/clusters/window-covering-server/window-covering-server.h index a0703a05917c64..d5dcea031a6995 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.h +++ b/src/app/clusters/window-covering-server/window-covering-server.h @@ -50,30 +50,6 @@ enum class OperationalState : uint8_t }; static_assert(sizeof(OperationalState) == sizeof(uint8_t), "OperationalState Size is not correct"); -// Decoded components of the OperationalStatus attribute -struct OperationalStatus -{ - OperationalState global; // bit 0-1 M - OperationalState lift; // bit 2-3 LF - OperationalState tilt; // bit 4-5 TL -}; - -struct SafetyStatus -{ - uint8_t remoteLockout : 1; // bit 0 - uint8_t tamperDetection : 1; // bit 1 - uint8_t failedCommunication : 1; // bit 2 - uint8_t positionFailure : 1; // bit 3 - uint8_t thermalProtection : 1; // bit 4 - uint8_t obstacleDetected : 1; // bit 5 - uint8_t powerIssue : 1; // bit 6 - uint8_t stopInput : 1; // bit 7 - uint8_t motorJammed : 1; // bit 8 - uint8_t hardwareFailure : 1; // bit 9 - uint8_t manualOperation : 1; // bit 10 -}; -static_assert(sizeof(SafetyStatus) == sizeof(uint16_t), "SafetyStatus Size is not correct"); - // Declare Position Limit Status enum class LimitStatus : uint8_t { @@ -92,7 +68,7 @@ struct AbsoluteLimits uint16_t closed; }; -bool HasFeature(chip::EndpointId endpoint, WcFeature feature); +bool HasFeature(chip::EndpointId endpoint, Feature feature); bool HasFeaturePaLift(chip::EndpointId endpoint); bool HasFeaturePaTilt(chip::EndpointId endpoint); @@ -104,9 +80,11 @@ void ConfigStatusSet(chip::EndpointId endpoint, const chip::BitMask ConfigStatusGet(chip::EndpointId endpoint); void ConfigStatusUpdateFeatures(chip::EndpointId endpoint); -void OperationalStatusSet(chip::EndpointId endpoint, const OperationalStatus & status); -void OperationalStatusSetWithGlobalUpdated(chip::EndpointId endpoint, OperationalStatus & status); -const OperationalStatus OperationalStatusGet(chip::EndpointId endpoint); +void OperationalStatusPrint(const chip::BitMask & opStatus); +void OperationalStatusSet(chip::EndpointId endpoint, chip::BitMask newStatus); +chip::BitMask OperationalStatusGet(chip::EndpointId endpoint); +void OperationalStateSet(chip::EndpointId endpoint, const chip::BitMask field, OperationalState state); +OperationalState OperationalStateGet(chip::EndpointId endpoint, const chip::BitMask field); OperationalState ComputeOperationalState(uint16_t target, uint16_t current); OperationalState ComputeOperationalState(NPercent100ths target, NPercent100ths current); @@ -119,8 +97,8 @@ void ModePrint(const chip::BitMask & mode); void ModeSet(chip::EndpointId endpoint, chip::BitMask & mode); chip::BitMask ModeGet(chip::EndpointId endpoint); -void SafetyStatusSet(chip::EndpointId endpoint, SafetyStatus & status); -const SafetyStatus SafetyStatusGet(chip::EndpointId endpoint); +void SafetyStatusSet(chip::EndpointId endpoint, const chip::BitMask & status); +chip::BitMask SafetyStatusGet(chip::EndpointId endpoint); LimitStatus CheckLimitState(uint16_t position, AbsoluteLimits limits); diff --git a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml index 8b4ebb7a393b44..1af4eeb21aa438 100644 --- a/src/app/zap-templates/zcl/data-model/chip/window-covering.xml +++ b/src/app/zap-templates/zcl/data-model/chip/window-covering.xml @@ -55,7 +55,7 @@ limitations under the License. CurrentPositionTiltPercentage - OperationalStatus + OperationalStatus TargetPositionLiftPercent100ths @@ -88,7 +88,7 @@ limitations under the License. - SafetyStatus + SafetyStatus @@ -177,7 +177,7 @@ limitations under the License. - + @@ -195,7 +195,7 @@ limitations under the License. - + @@ -211,13 +211,12 @@ limitations under the License. - + - - - - - + + + + + - diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 955a9825ea593e..8693e3cca8e109 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4251,14 +4251,7 @@ client cluster WindowCovering = 258 { kTiltEncoderControlled = 0x40; } - bitmap Mode : BITMAP8 { - kMotorDirectionReversed = 0x1; - kCalibrationMode = 0x2; - kMaintenanceMode = 0x4; - kLedFeedback = 0x8; - } - - bitmap WcFeature : BITMAP32 { + bitmap Feature : BITMAP32 { kLift = 0x1; kTilt = 0x2; kPositionAwareLift = 0x4; @@ -4266,13 +4259,20 @@ client cluster WindowCovering = 258 { kPositionAwareTilt = 0x10; } - bitmap WcOperationalStatus : BITMAP8 { + bitmap Mode : BITMAP8 { + kMotorDirectionReversed = 0x1; + kCalibrationMode = 0x2; + kMaintenanceMode = 0x4; + kLedFeedback = 0x8; + } + + bitmap OperationalStatus : BITMAP8 { kGlobal = 0x3; kLift = 0xC; kTilt = 0x30; } - bitmap WcSafetyStatus : BITMAP16 { + bitmap SafetyStatus : BITMAP16 { kRemoteLockout = 0x1; kTamperDetection = 0x2; kFailedCommunication = 0x4; @@ -4297,7 +4297,7 @@ client cluster WindowCovering = 258 { readonly attribute ConfigStatus configStatus = 7; readonly attribute nullable Percent currentPositionLiftPercentage = 8; readonly attribute nullable Percent currentPositionTiltPercentage = 9; - readonly attribute bitmap8 operationalStatus = 10; + readonly attribute OperationalStatus operationalStatus = 10; readonly attribute nullable Percent100ths targetPositionLiftPercent100ths = 11; readonly attribute nullable Percent100ths targetPositionTiltPercent100ths = 12; readonly attribute EndProductType endProductType = 13; @@ -4308,7 +4308,7 @@ client cluster WindowCovering = 258 { readonly attribute int16u installedOpenLimitTilt = 18; readonly attribute int16u installedClosedLimitTilt = 19; attribute access(write: manage) Mode mode = 23; - readonly attribute bitmap16 safetyStatus = 26; + readonly attribute SafetyStatus safetyStatus = 26; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 0df4dd0bdbacdf..eb6a3def6b8626 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -18678,7 +18678,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + cppValue.Raw(), value); return value; } case Attributes::TargetPositionLiftPercent100ths::Id: { @@ -18871,7 +18871,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + cppValue.Raw(), value); return value; } case Attributes::GeneratedCommandList::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 98b0a58b532c52..ab760ef91f6bc8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -16947,7 +16947,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::TargetPositionLiftPercent100ths::Id: { @@ -17084,7 +17084,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; return value; } case Attributes::GeneratedCommandList::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 2cfaba55ac5894..7cc6117360727e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -11267,6 +11267,30 @@ } } +void CHIPWindowCoveringOperationalStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitMask value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void CHIPWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPWindowCoveringModeAttributeCallbackBridge::OnSuccessFn( void * context, chip::BitMask value) { @@ -11291,6 +11315,30 @@ } } +void CHIPWindowCoveringSafetyStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::BitMask value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedShort:value.Raw()]; + DispatchSuccess(context, objCValue); +}; + +void CHIPWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPWindowCoveringGeneratedCommandListListAttributeCallbackBridge::OnSuccessFn( void * context, const chip::app::DataModel::DecodableList & value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 7db67a8f437c48..298be5edbc7b33 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -1120,7 +1120,11 @@ typedef void (*WiFiNetworkDiagnosticsAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*WindowCoveringConfigStatusAttributeCallback)(void *, chip::BitMask); +typedef void (*WindowCoveringOperationalStatusAttributeCallback)( + void *, chip::BitMask); typedef void (*WindowCoveringModeAttributeCallback)(void *, chip::BitMask); +typedef void (*WindowCoveringSafetyStatusAttributeCallback)(void *, + chip::BitMask); typedef void (*WindowCoveringGeneratedCommandListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*WindowCoveringAcceptedCommandListListAttributeCallback)( @@ -9284,6 +9288,34 @@ class CHIPWindowCoveringConfigStatusAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPWindowCoveringOperationalStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPWindowCoveringOperationalStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::BitMask value); +}; + +class CHIPWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge + : public CHIPWindowCoveringOperationalStatusAttributeCallbackBridge +{ +public: + CHIPWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPWindowCoveringOperationalStatusAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPWindowCoveringModeAttributeCallbackBridge : public CHIPCallbackBridge { public: @@ -9310,6 +9342,33 @@ class CHIPWindowCoveringModeAttributeCallbackSubscriptionBridge : public CHIPWin SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPWindowCoveringSafetyStatusAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPWindowCoveringSafetyStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::BitMask value); +}; + +class CHIPWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge + : public CHIPWindowCoveringSafetyStatusAttributeCallbackBridge +{ +public: + CHIPWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPWindowCoveringSafetyStatusAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPWindowCoveringGeneratedCommandListListAttributeCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 326621dc1bb925..61415ec3c0a6f9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -22100,6 +22100,14 @@ typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringConfigStatus) { CHIPWindowCoveringConfigStatusTiltEncoderControlled = 0x40, }; +typedef NS_OPTIONS(uint32_t, CHIPWindowCoveringFeature) { + CHIPWindowCoveringFeatureLift = 0x1, + CHIPWindowCoveringFeatureTilt = 0x2, + CHIPWindowCoveringFeaturePositionAwareLift = 0x4, + CHIPWindowCoveringFeatureAbsolutePosition = 0x8, + CHIPWindowCoveringFeaturePositionAwareTilt = 0x10, +}; + typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringMode) { CHIPWindowCoveringModeMotorDirectionReversed = 0x1, CHIPWindowCoveringModeCalibrationMode = 0x2, @@ -22107,33 +22115,25 @@ typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringMode) { CHIPWindowCoveringModeLedFeedback = 0x8, }; -typedef NS_OPTIONS(uint32_t, CHIPWindowCoveringWcFeature) { - CHIPWindowCoveringWcFeatureLift = 0x1, - CHIPWindowCoveringWcFeatureTilt = 0x2, - CHIPWindowCoveringWcFeaturePositionAwareLift = 0x4, - CHIPWindowCoveringWcFeatureAbsolutePosition = 0x8, - CHIPWindowCoveringWcFeaturePositionAwareTilt = 0x10, -}; - -typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringWcOperationalStatus) { - CHIPWindowCoveringWcOperationalStatusGlobal = 0x3, - CHIPWindowCoveringWcOperationalStatusLift = 0xC, - CHIPWindowCoveringWcOperationalStatusTilt = 0x30, +typedef NS_OPTIONS(uint8_t, CHIPWindowCoveringOperationalStatus) { + CHIPWindowCoveringOperationalStatusGlobal = 0x3, + CHIPWindowCoveringOperationalStatusLift = 0xC, + CHIPWindowCoveringOperationalStatusTilt = 0x30, }; -typedef NS_OPTIONS(uint16_t, CHIPWindowCoveringWcSafetyStatus) { - CHIPWindowCoveringWcSafetyStatusRemoteLockout = 0x1, - CHIPWindowCoveringWcSafetyStatusTamperDetection = 0x2, - CHIPWindowCoveringWcSafetyStatusFailedCommunication = 0x4, - CHIPWindowCoveringWcSafetyStatusPositionFailure = 0x8, - CHIPWindowCoveringWcSafetyStatusThermalProtection = 0x10, - CHIPWindowCoveringWcSafetyStatusObstacleDetected = 0x20, - CHIPWindowCoveringWcSafetyStatusPower = 0x40, - CHIPWindowCoveringWcSafetyStatusStopInput = 0x80, - CHIPWindowCoveringWcSafetyStatusMotorJammed = 0x100, - CHIPWindowCoveringWcSafetyStatusHardwareFailure = 0x200, - CHIPWindowCoveringWcSafetyStatusManualOperation = 0x400, - CHIPWindowCoveringWcSafetyStatusProtection = 0x800, +typedef NS_OPTIONS(uint16_t, CHIPWindowCoveringSafetyStatus) { + CHIPWindowCoveringSafetyStatusRemoteLockout = 0x1, + CHIPWindowCoveringSafetyStatusTamperDetection = 0x2, + CHIPWindowCoveringSafetyStatusFailedCommunication = 0x4, + CHIPWindowCoveringSafetyStatusPositionFailure = 0x8, + CHIPWindowCoveringSafetyStatusThermalProtection = 0x10, + CHIPWindowCoveringSafetyStatusObstacleDetected = 0x20, + CHIPWindowCoveringSafetyStatusPower = 0x40, + CHIPWindowCoveringSafetyStatusStopInput = 0x80, + CHIPWindowCoveringSafetyStatusMotorJammed = 0x100, + CHIPWindowCoveringSafetyStatusHardwareFailure = 0x200, + CHIPWindowCoveringSafetyStatusManualOperation = 0x400, + CHIPWindowCoveringSafetyStatusProtection = 0x800, }; typedef NS_ENUM(uint8_t, CHIPPumpConfigurationAndControlPumpControlMode) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 05d6c2fd5d6352..d3c409b122e2af 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -80351,12 +80351,13 @@ new CHIPNullableInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancela - (void)readAttributeOperationalStatusWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPWindowCoveringOperationalStatusAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)subscribeAttributeOperationalStatusWithMinInterval:(NSNumber * _Nonnull)minInterval @@ -80366,7 +80367,7 @@ - (void)subscribeAttributeOperationalStatusWithMinInterval:(NSNumber * _Nonnull) reportHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt8uAttributeCallbackSubscriptionBridge( + new CHIPWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -80374,11 +80375,11 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = WindowCovering::Attributes::OperationalStatus::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 unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + CHIPWindowCoveringOperationalStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -80391,23 +80392,24 @@ + (void)readAttributeOperationalStatusWithAttributeCache:(CHIPAttributeCacheCont completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - if (attributeCacheContainer.cppAttributeCache) { - chip::app::ConcreteAttributePath path; - using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; - path.mEndpointId = static_cast([endpoint unsignedShortValue]); - path.mClusterId = TypeInfo::GetClusterId(); - path.mAttributeId = TypeInfo::GetAttributeId(); - TypeInfo::DecodableType value; - CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); - if (err == CHIP_NO_ERROR) { - successFn->mCall(successFn->mContext, value); + new CHIPWindowCoveringOperationalStatusAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; } - return err; - } - return CHIP_ERROR_NOT_FOUND; - }); + return CHIP_ERROR_NOT_FOUND; + }); } - (void)readAttributeTargetPositionLiftPercent100thsWithCompletionHandler:(void (^)(NSNumber * _Nullable value, @@ -81077,12 +81079,13 @@ new CHIPWindowCoveringModeAttributeCallbackBridge(queue, completionHandler, ^(Ca - (void)readAttributeSafetyStatusWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPWindowCoveringSafetyStatusAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)subscribeAttributeSafetyStatusWithMinInterval:(NSNumber * _Nonnull)minInterval @@ -81091,7 +81094,7 @@ - (void)subscribeAttributeSafetyStatusWithMinInterval:(NSNumber * _Nonnull)minIn subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt16uAttributeCallbackSubscriptionBridge( + new CHIPWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -81099,11 +81102,11 @@ new CHIPInt16uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = WindowCovering::Attributes::SafetyStatus::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 unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, + CHIPWindowCoveringSafetyStatusAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, nil, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -81116,23 +81119,24 @@ + (void)readAttributeSafetyStatusWithAttributeCache:(CHIPAttributeCacheContainer completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - if (attributeCacheContainer.cppAttributeCache) { - chip::app::ConcreteAttributePath path; - using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; - path.mEndpointId = static_cast([endpoint unsignedShortValue]); - path.mClusterId = TypeInfo::GetClusterId(); - path.mAttributeId = TypeInfo::GetAttributeId(); - TypeInfo::DecodableType value; - CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); - if (err == CHIP_NO_ERROR) { - successFn->mCall(successFn->mContext, value); + new CHIPWindowCoveringSafetyStatusAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; } - return err; - } - return CHIP_ERROR_NOT_FOUND; - }); + return CHIP_ERROR_NOT_FOUND; + }); } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, 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 d691e4c0388d3b..8fc6bb3d30676a 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 @@ -15914,9 +15914,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl namespace OperationalStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, readable, sizeof(temp)); @@ -15928,9 +15928,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -16343,9 +16343,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::WindowCovering::Id, Id, readable, sizeof(temp)); @@ -16357,9 +16357,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask 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 57efb6fe95015f..e6be530d511cf1 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 @@ -2805,8 +2805,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace CurrentPositionTiltPercentage namespace OperationalStatus { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + chip::BitMask * value); // OperationalStatus +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value); } // namespace OperationalStatus namespace TargetPositionLiftPercent100ths { @@ -2868,8 +2869,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask * value); // SafetyStatus +EmberAfStatus Set(chip::EndpointId endpoint, chip::BitMask value); } // namespace SafetyStatus namespace FeatureMap { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 993407dd1a80bf..58324cc4291e1e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1439,6 +1439,16 @@ enum class ConfigStatus : uint8_t kTiltEncoderControlled = 0x40, }; +// Bitmap for Feature +enum class Feature : uint32_t +{ + kLift = 0x1, + kTilt = 0x2, + kPositionAwareLift = 0x4, + kAbsolutePosition = 0x8, + kPositionAwareTilt = 0x10, +}; + // Bitmap for Mode enum class Mode : uint8_t { @@ -1448,26 +1458,16 @@ enum class Mode : uint8_t kLedFeedback = 0x8, }; -// Bitmap for WcFeature -enum class WcFeature : uint32_t -{ - kLift = 0x1, - kTilt = 0x2, - kPositionAwareLift = 0x4, - kAbsolutePosition = 0x8, - kPositionAwareTilt = 0x10, -}; - -// Bitmap for WcOperationalStatus -enum class WcOperationalStatus : uint8_t +// Bitmap for OperationalStatus +enum class OperationalStatus : uint8_t { kGlobal = 0x3, kLift = 0xC, kTilt = 0x30, }; -// Bitmap for WcSafetyStatus -enum class WcSafetyStatus : uint16_t +// Bitmap for SafetyStatus +enum class SafetyStatus : uint16_t { kRemoteLockout = 0x1, kTamperDetection = 0x2, 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 b649099b92593b..02ae1fee8cf8ef 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 @@ -18205,9 +18205,9 @@ struct TypeInfo namespace OperationalStatus { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::OperationalStatus::Id; } @@ -18337,9 +18337,9 @@ struct TypeInfo namespace SafetyStatus { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::WindowCovering::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SafetyStatus::Id; } @@ -18396,7 +18396,8 @@ struct TypeInfo static_cast>(0); Attributes::CurrentPositionLiftPercentage::TypeInfo::DecodableType currentPositionLiftPercentage; Attributes::CurrentPositionTiltPercentage::TypeInfo::DecodableType currentPositionTiltPercentage; - Attributes::OperationalStatus::TypeInfo::DecodableType operationalStatus = static_cast(0); + Attributes::OperationalStatus::TypeInfo::DecodableType operationalStatus = + static_cast>(0); Attributes::TargetPositionLiftPercent100ths::TypeInfo::DecodableType targetPositionLiftPercent100ths; Attributes::TargetPositionTiltPercent100ths::TypeInfo::DecodableType targetPositionTiltPercent100ths; Attributes::EndProductType::TypeInfo::DecodableType endProductType = @@ -18408,7 +18409,8 @@ struct TypeInfo Attributes::InstalledOpenLimitTilt::TypeInfo::DecodableType installedOpenLimitTilt = static_cast(0); Attributes::InstalledClosedLimitTilt::TypeInfo::DecodableType installedClosedLimitTilt = static_cast(0); Attributes::Mode::TypeInfo::DecodableType mode = static_cast>(0); - Attributes::SafetyStatus::TypeInfo::DecodableType safetyStatus = static_cast(0); + Attributes::SafetyStatus::TypeInfo::DecodableType safetyStatus = + static_cast>(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; 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 5509a461e00104..0f24c3f20417cd 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -701,6 +701,16 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_FAN_CONTROL_FEATURE_ROCKING_OFFSET (2) #define EMBER_AF_FAN_CONTROL_FEATURE_WIND (8) #define EMBER_AF_FAN_CONTROL_FEATURE_WIND_OFFSET (3) +#define EMBER_AF_FEATURE_LIFT (1) +#define EMBER_AF_FEATURE_LIFT_OFFSET (0) +#define EMBER_AF_FEATURE_TILT (2) +#define EMBER_AF_FEATURE_TILT_OFFSET (1) +#define EMBER_AF_FEATURE_POSITION_AWARE_LIFT (4) +#define EMBER_AF_FEATURE_POSITION_AWARE_LIFT_OFFSET (2) +#define EMBER_AF_FEATURE_ABSOLUTE_POSITION (8) +#define EMBER_AF_FEATURE_ABSOLUTE_POSITION_OFFSET (3) +#define EMBER_AF_FEATURE_POSITION_AWARE_TILT (16) +#define EMBER_AF_FEATURE_POSITION_AWARE_TILT_OFFSET (4) #define EMBER_AF_IAS_ZONE_STATUS_ALARM1 (1) #define EMBER_AF_IAS_ZONE_STATUS_ALARM1_OFFSET (0) #define EMBER_AF_IAS_ZONE_STATUS_ALARM2 (2) @@ -789,6 +799,12 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_ON_OFF_CONTROL_ACCEPT_ONLY_WHEN_ON_OFFSET (0) #define EMBER_AF_ON_OFF_FEATURE_LIGHTING (1) #define EMBER_AF_ON_OFF_FEATURE_LIGHTING_OFFSET (0) +#define EMBER_AF_OPERATIONAL_STATUS_GLOBAL (3) +#define EMBER_AF_OPERATIONAL_STATUS_GLOBAL_OFFSET (0) +#define EMBER_AF_OPERATIONAL_STATUS_LIFT (12) +#define EMBER_AF_OPERATIONAL_STATUS_LIFT_OFFSET (2) +#define EMBER_AF_OPERATIONAL_STATUS_TILT (48) +#define EMBER_AF_OPERATIONAL_STATUS_TILT_OFFSET (4) #define EMBER_AF_POWER_SOURCE_FEATURE_WIRED (1) #define EMBER_AF_POWER_SOURCE_FEATURE_WIRED_OFFSET (0) #define EMBER_AF_POWER_SOURCE_FEATURE_BATTERY (2) @@ -827,6 +843,30 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_ROCK_SUPPORT_MASK_ROCK_UP_DOWN_OFFSET (1) #define EMBER_AF_ROCK_SUPPORT_MASK_ROCK_ROUND (4) #define EMBER_AF_ROCK_SUPPORT_MASK_ROCK_ROUND_OFFSET (2) +#define EMBER_AF_SAFETY_STATUS_REMOTE_LOCKOUT (1) +#define EMBER_AF_SAFETY_STATUS_REMOTE_LOCKOUT_OFFSET (0) +#define EMBER_AF_SAFETY_STATUS_TAMPER_DETECTION (2) +#define EMBER_AF_SAFETY_STATUS_TAMPER_DETECTION_OFFSET (1) +#define EMBER_AF_SAFETY_STATUS_FAILED_COMMUNICATION (4) +#define EMBER_AF_SAFETY_STATUS_FAILED_COMMUNICATION_OFFSET (2) +#define EMBER_AF_SAFETY_STATUS_POSITION_FAILURE (8) +#define EMBER_AF_SAFETY_STATUS_POSITION_FAILURE_OFFSET (3) +#define EMBER_AF_SAFETY_STATUS_THERMAL_PROTECTION (16) +#define EMBER_AF_SAFETY_STATUS_THERMAL_PROTECTION_OFFSET (4) +#define EMBER_AF_SAFETY_STATUS_OBSTACLE_DETECTED (32) +#define EMBER_AF_SAFETY_STATUS_OBSTACLE_DETECTED_OFFSET (5) +#define EMBER_AF_SAFETY_STATUS_POWER (64) +#define EMBER_AF_SAFETY_STATUS_POWER_OFFSET (6) +#define EMBER_AF_SAFETY_STATUS_STOP_INPUT (128) +#define EMBER_AF_SAFETY_STATUS_STOP_INPUT_OFFSET (7) +#define EMBER_AF_SAFETY_STATUS_MOTOR_JAMMED (256) +#define EMBER_AF_SAFETY_STATUS_MOTOR_JAMMED_OFFSET (8) +#define EMBER_AF_SAFETY_STATUS_HARDWARE_FAILURE (512) +#define EMBER_AF_SAFETY_STATUS_HARDWARE_FAILURE_OFFSET (9) +#define EMBER_AF_SAFETY_STATUS_MANUAL_OPERATION (1024) +#define EMBER_AF_SAFETY_STATUS_MANUAL_OPERATION_OFFSET (10) +#define EMBER_AF_SAFETY_STATUS_PROTECTION (2048) +#define EMBER_AF_SAFETY_STATUS_PROTECTION_OFFSET (11) #define EMBER_AF_SCENE_FEATURES_SCENE_NAMES (1) #define EMBER_AF_SCENE_FEATURES_SCENE_NAMES_OFFSET (0) #define EMBER_AF_SCENES_COPY_MODE_COPY_ALL_SCENES (1) @@ -937,46 +977,6 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_WARNING_INFO_STROBE_OFFSET (2) #define EMBER_AF_WARNING_INFO_SIREN_LEVEL (3) #define EMBER_AF_WARNING_INFO_SIREN_LEVEL_OFFSET (0) -#define EMBER_AF_WC_FEATURE_LIFT (1) -#define EMBER_AF_WC_FEATURE_LIFT_OFFSET (0) -#define EMBER_AF_WC_FEATURE_TILT (2) -#define EMBER_AF_WC_FEATURE_TILT_OFFSET (1) -#define EMBER_AF_WC_FEATURE_POSITION_AWARE_LIFT (4) -#define EMBER_AF_WC_FEATURE_POSITION_AWARE_LIFT_OFFSET (2) -#define EMBER_AF_WC_FEATURE_ABSOLUTE_POSITION (8) -#define EMBER_AF_WC_FEATURE_ABSOLUTE_POSITION_OFFSET (3) -#define EMBER_AF_WC_FEATURE_POSITION_AWARE_TILT (16) -#define EMBER_AF_WC_FEATURE_POSITION_AWARE_TILT_OFFSET (4) -#define EMBER_AF_WC_OPERATIONAL_STATUS_GLOBAL (3) -#define EMBER_AF_WC_OPERATIONAL_STATUS_GLOBAL_OFFSET (0) -#define EMBER_AF_WC_OPERATIONAL_STATUS_LIFT (12) -#define EMBER_AF_WC_OPERATIONAL_STATUS_LIFT_OFFSET (2) -#define EMBER_AF_WC_OPERATIONAL_STATUS_TILT (48) -#define EMBER_AF_WC_OPERATIONAL_STATUS_TILT_OFFSET (4) -#define EMBER_AF_WC_SAFETY_STATUS_REMOTE_LOCKOUT (1) -#define EMBER_AF_WC_SAFETY_STATUS_REMOTE_LOCKOUT_OFFSET (0) -#define EMBER_AF_WC_SAFETY_STATUS_TAMPER_DETECTION (2) -#define EMBER_AF_WC_SAFETY_STATUS_TAMPER_DETECTION_OFFSET (1) -#define EMBER_AF_WC_SAFETY_STATUS_FAILED_COMMUNICATION (4) -#define EMBER_AF_WC_SAFETY_STATUS_FAILED_COMMUNICATION_OFFSET (2) -#define EMBER_AF_WC_SAFETY_STATUS_POSITION_FAILURE (8) -#define EMBER_AF_WC_SAFETY_STATUS_POSITION_FAILURE_OFFSET (3) -#define EMBER_AF_WC_SAFETY_STATUS_THERMAL_PROTECTION (16) -#define EMBER_AF_WC_SAFETY_STATUS_THERMAL_PROTECTION_OFFSET (4) -#define EMBER_AF_WC_SAFETY_STATUS_OBSTACLE_DETECTED (32) -#define EMBER_AF_WC_SAFETY_STATUS_OBSTACLE_DETECTED_OFFSET (5) -#define EMBER_AF_WC_SAFETY_STATUS_POWER (64) -#define EMBER_AF_WC_SAFETY_STATUS_POWER_OFFSET (6) -#define EMBER_AF_WC_SAFETY_STATUS_STOP_INPUT (128) -#define EMBER_AF_WC_SAFETY_STATUS_STOP_INPUT_OFFSET (7) -#define EMBER_AF_WC_SAFETY_STATUS_MOTOR_JAMMED (256) -#define EMBER_AF_WC_SAFETY_STATUS_MOTOR_JAMMED_OFFSET (8) -#define EMBER_AF_WC_SAFETY_STATUS_HARDWARE_FAILURE (512) -#define EMBER_AF_WC_SAFETY_STATUS_HARDWARE_FAILURE_OFFSET (9) -#define EMBER_AF_WC_SAFETY_STATUS_MANUAL_OPERATION (1024) -#define EMBER_AF_WC_SAFETY_STATUS_MANUAL_OPERATION_OFFSET (10) -#define EMBER_AF_WC_SAFETY_STATUS_PROTECTION (2048) -#define EMBER_AF_WC_SAFETY_STATUS_PROTECTION_OFFSET (11) #define EMBER_AF_WI_FI_NETWORK_DIAGNOSTICS_FEATURE_PACKET_COUNTS (1) #define EMBER_AF_WI_FI_NETWORK_DIAGNOSTICS_FEATURE_PACKET_COUNTS_OFFSET (0) #define EMBER_AF_WI_FI_NETWORK_DIAGNOSTICS_FEATURE_ERROR_COUNTS (2) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 753614018dae70..ff098c4947446a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -9850,7 +9850,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("CurrentPositionTiltPercentage", 1, value); } case WindowCovering::Attributes::OperationalStatus::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("OperationalStatus", 1, value); } @@ -9905,7 +9905,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("Mode", 1, value); } case WindowCovering::Attributes::SafetyStatus::Id: { - uint16_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SafetyStatus", 1, value); } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c4653358d4cd55..289cdf531bca03 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -36779,7 +36779,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); @@ -36892,7 +36892,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint16_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map16")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); @@ -36905,7 +36905,7 @@ class Test_TC_WNCV_2_1Suite : public TestCommand case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint16_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map16")); VerifyOrReturn(CheckConstraintNotValue("value", value, 4096U)); @@ -37110,8 +37110,8 @@ class Test_TC_WNCV_2_1Suite : public TestCommand LogStep(16, "3a.2: write a value into the RO mandatory attribute: SafetyStatus"); VerifyOrDo(!ShouldSkip("A_SAFETYSTATUS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - uint16_t value; - value = 4096U; + chip::BitMask value; + value = static_cast>(4096U); return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::SafetyStatus::Id, value, chip::NullOptional, chip::NullOptional); } @@ -37844,7 +37844,7 @@ class Test_TC_WNCV_3_1Suite : public TestCommand case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); } @@ -37881,7 +37881,7 @@ class Test_TC_WNCV_3_1Suite : public TestCommand case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 5)); @@ -37943,7 +37943,7 @@ class Test_TC_WNCV_3_1Suite : public TestCommand case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -38249,7 +38249,7 @@ class Test_TC_WNCV_3_2Suite : public TestCommand case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); } @@ -38286,7 +38286,7 @@ class Test_TC_WNCV_3_2Suite : public TestCommand case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 10)); @@ -38348,7 +38348,7 @@ class Test_TC_WNCV_3_2Suite : public TestCommand case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -38624,7 +38624,7 @@ class Test_TC_WNCV_3_3Suite : public TestCommand case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "", "map8")); } @@ -38639,7 +38639,7 @@ class Test_TC_WNCV_3_3Suite : public TestCommand case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -38652,7 +38652,7 @@ class Test_TC_WNCV_3_3Suite : public TestCommand case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -38897,7 +38897,7 @@ class Test_TC_WNCV_3_4Suite : public TestCommand case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -39089,7 +39089,7 @@ class Test_TC_WNCV_3_5Suite : public TestCommand case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -39300,7 +39300,7 @@ class Test_TC_WNCV_4_1Suite : public TestCommand case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -39346,7 +39346,7 @@ class Test_TC_WNCV_4_1Suite : public TestCommand case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -39596,7 +39596,7 @@ class Test_TC_WNCV_4_2Suite : public TestCommand case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } @@ -39642,7 +39642,7 @@ class Test_TC_WNCV_4_2Suite : public TestCommand case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint8_t value; + chip::BitMask value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("operationalStatus", value, 0)); } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/darwin-framework-tool/zap-generated/cluster/CHIPTestClustersObjc.mm index e685dbe0682138..84f6f74656e8b0 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -21504,7 +21504,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = WindowCovering::Attributes::OperationalStatus::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -21712,7 +21712,7 @@ new CHIPDefaultSuccessCallbackBridge( ListFreer listFreer; using TypeInfo = WindowCovering::Attributes::SafetyStatus::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedShortValue; + cppValue = static_cast>(value.unsignedShortValue); auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall);