Skip to content

Commit

Permalink
Make XOccupiedToUnoccupiedDelay attributes in OccupancySensing cluste…
Browse files Browse the repository at this point in the history
…r managed by AAI (project-chip#36777)

* Make XOccupiedToUnoccupiedDelay attributes managed by AAI

* add document

* add more document
  • Loading branch information
wqx6 authored Dec 16, 2024
1 parent d162e3a commit 43f66f0
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
9 changes: 8 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,14 @@
"ClientsSupportedPerFabric",
"MaximumCheckInBackOff"
],
"Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"],
"Occupancy Sensing": [
"HoldTimeLimits",
"HoldTime",
"PIROccupiedToUnoccupiedDelay",
"UltrasonicOccupiedToUnoccupiedDelay",
"PhysicalContactOccupiedToUnoccupiedDelay",
"FeatureMap"
],
"Operational Credentials": [
"SupportedFabrics",
"CommissionedFabrics",
Expand Down
9 changes: 8 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@
"ClientsSupportedPerFabric",
"MaximumCheckInBackOff"
],
"Occupancy Sensing": ["HoldTimeLimits", "HoldTime", "FeatureMap"],
"Occupancy Sensing": [
"HoldTimeLimits",
"HoldTime",
"PIROccupiedToUnoccupiedDelay",
"UltrasonicOccupiedToUnoccupiedDelay",
"PhysicalContactOccupiedToUnoccupiedDelay",
"FeatureMap"
],
"Operational Credentials": [
"SupportedFabrics",
"CommissionedFabrics",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 43f66f0

Please sign in to comment.