From d97b5af25e45888722e6e6332714a4a90bccb99f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 27 Aug 2024 13:49:56 -0400 Subject: [PATCH] Document mask argument of DECLARE_DYNAMIC_ATTRIBUTE. People keep forgetting ATTRIBUTE_MASK_WRITABLE here, then being confused why writes do not work. --- src/app/util/attribute-storage.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index 005f109181360d..99cba737256108 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -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) \