Skip to content

Commit

Permalink
Add idea
Browse files Browse the repository at this point in the history
  • Loading branch information
rbultman committed Jul 30, 2024
1 parent e78498c commit 847e8ad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/app/clusters/fan-control-server/fan-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,17 @@ MatterFanControlClusterServerPreAttributeChangedCallback(const ConcreteAttribute
}
break;
}
case PercentCurrent::Id: {
res = Status::Success;
// ReportRequiredByWhatever - Something that get's triggered on edges to force reporting
if (ReportRequiredByWhatever) {
res = Status::ForceReport;
// SuppressReportByWhatever - Something that limits reporting based on time or some other requirement
} else if (SuppressReportByWhatever) {
res = Status::SuppressReport;
}
break;
}
default:
res = Status::Success;
break;
Expand Down
16 changes: 14 additions & 2 deletions src/app/util/attribute-table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,21 @@ Status emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId at
// Pre write attribute callback for all attribute changes,
// regardless of cluster.
imStatus = MatterPreAttributeChangeCallback(attributePath, dataType, emberAfAttributeSize(metadata), data);
if (imStatus != Protocols::InteractionModel::Status::Success)
switch(imStatus)
{
return imStatus;
case Protocols::InteractionModel::Status::ForceReport: {
markDirty = MarkAttributeDirty::kYes;
break;
}
case Protocols::InteractionModel::Status::SuppressReport: {
markDirty = MarkAttributeDirty::kNo;
break;
}
case Protocols::InteractionModel::Status::imStatus: {
break;
}
default:
return imStatus;
}

// Pre-write attribute callback specific
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/interaction_model/StatusCodeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ CHIP_IM_STATUS_CODE(TimedRequestMismatch , TIMED_REQUEST_MISMATCH , 0xc9)
CHIP_IM_STATUS_CODE(FailsafeRequired , FAILSAFE_REQUIRED , 0xca)
CHIP_IM_STATUS_CODE(InvalidInState , INVALID_IN_STATE , 0xcb)
CHIP_IM_STATUS_CODE(NoCommandResponse , NO_COMMAND_RESPONSE , 0xcc)
CHIP_IM_STATUS_CODE(SuppressReport , SUPPRESS_REPORT , 0xcd)
CHIP_IM_STATUS_CODE(ForceReport , FORCE_REPORT , 0xce)
CHIP_IM_STATUS_CODE(WriteIgnored , WRITE_IGNORED , 0xF0) // non-spec error code and use only internally
// clang-format on

0 comments on commit 847e8ad

Please sign in to comment.