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 fb770209b996a3..071a3fcf7c5b76 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 @@ -9047,7 +9047,7 @@ endpoint 1 { ram attribute occupancySensorTypeBitmap default = 1; callback attribute holdTime; callback attribute holdTimeLimits; - ram attribute PIROccupiedToUnoccupiedDelay default = 10; + callback attribute PIROccupiedToUnoccupiedDelay; callback attribute featureMap; ram attribute clusterRevision default = 5; } @@ -9505,7 +9505,7 @@ endpoint 2 { ram attribute occupancySensorTypeBitmap default = 1; callback attribute holdTime; callback attribute holdTimeLimits; - ram attribute PIROccupiedToUnoccupiedDelay default = 10; + callback attribute PIROccupiedToUnoccupiedDelay; callback attribute featureMap; ram attribute clusterRevision default = 5; } diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index a6a1aa5c7f5a64..fe5fe0bfe6d84b 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -9645,13 +9645,13 @@ endpoint 1 { ram attribute occupancy; ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; - ram attribute PIROccupiedToUnoccupiedDelay default = 0x00; + callback attribute PIROccupiedToUnoccupiedDelay; ram attribute PIRUnoccupiedToOccupiedDelay default = 0x00; ram attribute PIRUnoccupiedToOccupiedThreshold default = 1; - ram attribute ultrasonicOccupiedToUnoccupiedDelay default = 0x00; + callback attribute ultrasonicOccupiedToUnoccupiedDelay; ram attribute ultrasonicUnoccupiedToOccupiedDelay default = 0x00; ram attribute ultrasonicUnoccupiedToOccupiedThreshold default = 1; - ram attribute physicalContactOccupiedToUnoccupiedDelay default = 0x00; + callback attribute physicalContactOccupiedToUnoccupiedDelay; ram attribute physicalContactUnoccupiedToOccupiedDelay default = 0x00; ram attribute physicalContactUnoccupiedToOccupiedThreshold default = 1; callback attribute featureMap; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 0373748d9de69e..68de2f9ffba90e 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -9540,13 +9540,13 @@ endpoint 1 { ram attribute occupancy; ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; - ram attribute PIROccupiedToUnoccupiedDelay default = 0x00; + callback attribute PIROccupiedToUnoccupiedDelay; ram attribute PIRUnoccupiedToOccupiedDelay default = 0x00; ram attribute PIRUnoccupiedToOccupiedThreshold default = 1; - ram attribute ultrasonicOccupiedToUnoccupiedDelay default = 0x00; + callback attribute ultrasonicOccupiedToUnoccupiedDelay; ram attribute ultrasonicUnoccupiedToOccupiedDelay default = 0x00; ram attribute ultrasonicUnoccupiedToOccupiedThreshold default = 1; - ram attribute physicalContactOccupiedToUnoccupiedDelay default = 0x00; + callback attribute physicalContactOccupiedToUnoccupiedDelay; ram attribute physicalContactUnoccupiedToOccupiedDelay default = 0x00; ram attribute physicalContactUnoccupiedToOccupiedThreshold default = 1; callback attribute featureMap; diff --git a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp index cd7ba5b8f659c2..03eaaa46475d1c 100644 --- a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp +++ b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp @@ -59,8 +59,12 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu case Attributes::FeatureMap::Id: ReturnErrorOnFailure(aEncoder.Encode(mFeature)); break; - case Attributes::HoldTime::Id: { - + case Attributes::HoldTime::Id: + case Attributes::PIROccupiedToUnoccupiedDelay::Id: + case Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id: + case Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id: { + // HoldTime is equivalent to the legacy *OccupiedToUnoccupiedDelay attributes. + // The AAI will read/write these attributes at the same storage for one endpoint. uint16_t * holdTime = GetHoldTimeForEndpoint(aPath.mEndpointId); if (holdTime == nullptr) @@ -190,12 +194,6 @@ CHIP_ERROR SetHoldTime(EndpointId endpointId, uint16_t newHoldTime) MatterReportingAttributeChangeCallback(endpointId, OccupancySensing::Id, Attributes::HoldTime::Id); } - // Blindly try to write RAM-backed legacy attributes (will fail silently if absent) - // to keep them in sync. - (void) Attributes::PIROccupiedToUnoccupiedDelay::Set(endpointId, newHoldTime); - (void) Attributes::UltrasonicOccupiedToUnoccupiedDelay::Set(endpointId, newHoldTime); - (void) Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Set(endpointId, newHoldTime); - return CHIP_NO_ERROR; } diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 0912be1df2db37..14179bb5566bfc 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -294,7 +294,14 @@ "ClientsSupportedPerFabric", "MaximumCheckInBackOff" ], - "Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"], + "Occupancy Sensing": [ + "HoldTimeLimits", + "HoldTime", + "PIROccupiedToUnoccupiedDelay", + "UltrasonicOccupiedToUnoccupiedDelay", + "PhysicalContactOccupiedToUnoccupiedDelay", + "FeatureMap" + ], "Operational Credentials": [ "SupportedFabrics", "CommissionedFabrics", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 3a62c4c84ca6eb..728d3acdad1f06 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -288,7 +288,14 @@ "ClientsSupportedPerFabric", "MaximumCheckInBackOff" ], - "Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"], + "Occupancy Sensing": [ + "HoldTimeLimits", + "HoldTime", + "PIROccupiedToUnoccupiedDelay", + "UltrasonicOccupiedToUnoccupiedDelay", + "PhysicalContactOccupiedToUnoccupiedDelay", + "FeatureMap" + ], "Operational Credentials": [ "SupportedFabrics", "CommissionedFabrics", 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 afb3da76dc8bc3..10f67cad3ffd77 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 @@ -32754,53 +32754,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, } // namespace OccupancySensorTypeBitmap -namespace PIROccupiedToUnoccupiedDelay { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::OccupancySensing::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::OccupancySensing::Id, Id), - EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::OccupancySensing::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace PIROccupiedToUnoccupiedDelay - namespace PIRUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) @@ -32895,53 +32848,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value) } // namespace PIRUnoccupiedToOccupiedThreshold -namespace UltrasonicOccupiedToUnoccupiedDelay { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::OccupancySensing::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::OccupancySensing::Id, Id), - EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::OccupancySensing::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace UltrasonicOccupiedToUnoccupiedDelay - namespace UltrasonicUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) @@ -33036,53 +32942,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value) } // namespace UltrasonicUnoccupiedToOccupiedThreshold -namespace PhysicalContactOccupiedToUnoccupiedDelay { - -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::OccupancySensing::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(ConcreteAttributePath(endpoint, Clusters::OccupancySensing::Id, Id), - EmberAfWriteDataInput(writable, ZCL_INT16U_ATTRIBUTE_TYPE).SetMarkDirty(markDirty)); -} - -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::OccupancySensing::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace PhysicalContactOccupiedToUnoccupiedDelay - namespace PhysicalContactUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value) 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 c79c0657c5b11b..d77633d6d72bbc 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 @@ -4913,12 +4913,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, MarkAttributeDirty markDirty); } // namespace OccupancySensorTypeBitmap -namespace PIROccupiedToUnoccupiedDelay { -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); -} // namespace PIROccupiedToUnoccupiedDelay - namespace PIRUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); @@ -4931,12 +4925,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value); Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); } // namespace PIRUnoccupiedToOccupiedThreshold -namespace UltrasonicOccupiedToUnoccupiedDelay { -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); -} // namespace UltrasonicOccupiedToUnoccupiedDelay - namespace UltrasonicUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); @@ -4949,12 +4937,6 @@ Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value); Protocols::InteractionModel::Status Set(EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); } // namespace UltrasonicUnoccupiedToOccupiedThreshold -namespace PhysicalContactOccupiedToUnoccupiedDelay { -Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); -} // namespace PhysicalContactOccupiedToUnoccupiedDelay - namespace PhysicalContactUnoccupiedToOccupiedDelay { Protocols::InteractionModel::Status Get(EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(EndpointId endpoint, uint16_t value);