Skip to content

Commit

Permalink
Document mask argument of DECLARE_DYNAMIC_ATTRIBUTE. (project-chip#35228
Browse files Browse the repository at this point in the history
)

People keep forgetting ATTRIBUTE_MASK_WRITABLE here, then being confused why
writes do not work.
  • Loading branch information
bzbarsky-apple authored and yyzhong-g committed Dec 11, 2024
1 parent eda5585 commit 372140a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/util/attribute-storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static constexpr uint16_t kEmberInvalidEndpointIndex = 0xFFFF;
} /* cluster revision */ \
}

// The attrMask must contain the relevant ATTRIBUTE_MASK_* bits from
// attribute-metadata.h. Specifically:
//
// * Writable attributes must have ATTRIBUTE_MASK_WRITABLE
// * Nullable attributes (have X in the quality column in the spec) must have ATTRIBUTE_MASK_NULLABLE
// * Attributes that have T in the Access column in the spec must have ATTRIBUTE_MASK_MUST_USE_TIMED_WRITE
#define DECLARE_DYNAMIC_ATTRIBUTE(attId, attType, attSizeBytes, attrMask) \
{ \
ZAP_EMPTY_DEFAULT(), attId, attSizeBytes, ZAP_TYPE(attType), attrMask | ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) \
Expand Down

0 comments on commit 372140a

Please sign in to comment.