@@ -86,8 +86,8 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, {{accessorGet
86
86
{{/if}}
87
87
}
88
88
89
- Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true}} value, MarkAttributeDirty markDirty)
90
- {
89
+ {{! Has a passMarkDirty boolean argument that controls which overload of emberAfWriteAttribute we call }}
90
+ {{#*inline "setBody"}}
91
91
{{~#if (isString type)}}
92
92
{{~#*inline "lengthType"}}uint{{#if (isShortString type)}}8{{else}}16{{/if}}_t{{/inline}}
93
93
static_assert({{maxLength}} < NumericAttributeTraits<{{>lengthType}}>::kNullValue,
@@ -101,7 +101,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEn
101
101
Encoding::LittleEndian::Put16(zclString, length);
102
102
{{/if}}
103
103
memcpy(&zclString[{{>sizingBytes}}], value.data(), value.size());
104
- return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE, markDirty);
104
+ return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE{{#if passMarkDirty}} , markDirty{{/if}} );
105
105
{{else}}
106
106
using Traits = NumericAttributeTraits<{{accessorTraitType type}}>;
107
107
if (!Traits::CanRepresentValue(/* isNullable = */ {{isNullable}}, value))
@@ -111,33 +111,43 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEn
111
111
Traits::StorageType storageValue;
112
112
Traits::WorkingToStorage(value, storageValue);
113
113
uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue);
114
- return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE, markDirty);
114
+ return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE{{#if passMarkDirty}} , markDirty{{/if}} );
115
115
{{/if}}
116
+ {{/inline}}
117
+
118
+ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true}} value, MarkAttributeDirty markDirty)
119
+ {
120
+ {{> setBody passMarkDirty=true}}
116
121
}
117
122
118
123
Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true}} value)
119
124
{
120
- return Set(endpoint, value, MarkAttributeDirty::kIfChanged);
125
+ {{> setBody passMarkDirty=false}}
121
126
}
122
127
123
128
{{#if isNullable}}
124
- Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty)
125
- {
129
+ {{! Has a passMarkDirty boolean argument that controls which overload of emberAfWriteAttribute we call }}
130
+ {{#*inline "setNullBody"}}
126
131
{{#if (isString type)}}
127
132
uint8_t zclString[{{>sizingBytes}}] = { {{#if (isShortString type)}}0xFF{{else}}0xFF, 0xFF{{/if}} };
128
- return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE, markDirty);
133
+ return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE{{#if passMarkDirty}} , markDirty{{/if}} );
129
134
{{else}}
130
135
using Traits = NumericAttributeTraits<{{accessorTraitType type}}>;
131
136
Traits::StorageType value;
132
137
Traits::SetNull(value);
133
138
uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
134
- return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE, markDirty);
139
+ return emberAfWriteAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE{{#if passMarkDirty}} , markDirty{{/if}} );
135
140
{{/if}}
141
+ {{/inline}}
142
+
143
+ Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty)
144
+ {
145
+ {{> setNullBody passMarkDirty=true}}
136
146
}
137
147
138
148
Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint)
139
149
{
140
- return SetNull(endpoint, MarkAttributeDirty::kIfChanged);
150
+ {{> setNullBody passMarkDirty=false}}
141
151
}
142
152
143
153
Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}} value, MarkAttributeDirty markDirty)
@@ -151,7 +161,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEn
151
161
152
162
Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}} value)
153
163
{
154
- return Set(endpoint, value, MarkAttributeDirty::kIfChanged);
164
+ if (value.IsNull()) {
165
+ return SetNull(endpoint);
166
+ }
167
+
168
+ return Set(endpoint, value.Value());
155
169
}
156
170
{{/if}}
157
171
0 commit comments