Skip to content

Commit

Permalink
Move the change callback around a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Jul 4, 2024
1 parent b26edf1 commit faac4fb
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/app/codegen-data-model/CodegenDataModel_Write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,6 @@ std::optional<CHIP_ERROR> TryWriteViaAccessInterface(const ConcreteAttributePath
return std::make_optional(err);
}

if (decoder.TriedDecode())
{
// TODO: change callbacks should likely be routed through the context `MarkDirty`
// however for now this is called directly because ember code does this call
// inside emberAfWriteAttribute.
//
// If we pull out the logic, the remaining `MarkDirty` calls should be
// sufficient.
MatterReportingAttributeChangeCallback(path);
}

// If the decoder tried to decode, then a value should have been read for processing.
// - if decoding was done, assume DONE (i.e. final CHIP_NO_ERROR)
// - otherwise, if no decoding done, return that processing must continue via nullopt
Expand Down Expand Up @@ -352,7 +341,12 @@ CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttribu
std::optional<CHIP_ERROR> aai_result = TryWriteViaAccessInterface(request.path, aai, decoder);
if (aai_result.has_value())
{
if (*aai_result == CHIP_NO_ERROR) {
if (*aai_result == CHIP_NO_ERROR)
{
// TODO: change callbacks should likely be routed through the context `MarkDirty` only
// however for now this is called directly because ember code does this call
// inside emberAfWriteAttribute.
MatterReportingAttributeChangeCallback(request.path);
CurrentContext().dataModelChangeListener->MarkDirty(request.path);
}
return *aai_result;
Expand Down

0 comments on commit faac4fb

Please sign in to comment.