Skip to content

Commit

Permalink
Rename enum values and add more information in comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tersal committed Feb 12, 2025
1 parent 5d233a2 commit 1a61b04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/app/WriteHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ void WriteHandler::DeliverListWriteEnd(const ConcreteAttributePath & aPath, bool
if (mDataModelProvider != nullptr)
{
mDataModelProvider->ListAttributeWriteNotification(aPath,
writeWasSuccessful ? DataModel::ListWriteOperation::kListWriteEndFinal
: DataModel::ListWriteOperation::kListWriteEnd);
writeWasSuccessful ? DataModel::ListWriteOperation::kListWriteSuccess
: DataModel::ListWriteOperation::kListWriteFailure);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/data-model-provider/OperationTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ enum class ReadFlags : uint32_t
enum class ListWriteOperation : uint8_t
{
kListWriteBegin = 0,
kListWriteEnd,
kListWriteEndFinal
kListWriteSuccess,
kListWriteFailure
};

struct ReadAttributeRequest : OperationRequest
Expand Down
7 changes: 4 additions & 3 deletions src/app/data-model-provider/Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ class Provider : public ProviderMetadataTree
virtual ActionReturnStatus WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) = 0;

/// Indicates the start/end of a series of list operations. This function will be called either before the first
/// Write operation or after the last one of a series of consequence attribute data of the same attribute.
/// Write operation or after the last one of a series of consecutive attribute data of the same attribute.
///
/// 1) This function will be called if the client tries to set a nullable list attribute to null.
/// 2) This function will only be called once for a series of consequent attribute data (regardless the kind of list
/// operation) of the same attribute.
/// 2) This function will only be called for a series of consecutive attribute data (regardless the kind of list
/// operation) of the same attribute at the beggining or end of the Write operations.
/// 3) The opType argument indicates the type of notification (Start, Failure, Success).
virtual void ListAttributeWriteNotification(const ConcreteAttributePath & aPath, BitFlags<ListWriteOperation> opType) = 0;

/// `handler` is used to send back the reply.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ void CodegenDataModelProvider::ListAttributeWriteNotification(const ConcreteAttr
case DataModel::ListWriteOperation::kListWriteBegin:
aai->OnListWriteBegin(aPath);
break;
case DataModel::ListWriteOperation::kListWriteEnd:
case DataModel::ListWriteOperation::kListWriteFailure:
aai->OnListWriteEnd(aPath, false);
break;
case DataModel::ListWriteOperation::kListWriteEndFinal:
case DataModel::ListWriteOperation::kListWriteSuccess:
aai->OnListWriteEnd(aPath, true);
break;
}
Expand Down

0 comments on commit 1a61b04

Please sign in to comment.