@@ -58,30 +58,31 @@ EmberAfStatus Get(chip::EndpointId endpoint, {{accessorGetterType this}} value)
58
58
{{>value}}.reduce_size(length);
59
59
return status;
60
60
{{else}}
61
- NumericAttributeTraits<{{accessorTraitType type}}>::StorageType temp;
62
- uint8_t * readable = NumericAttributeTraits<{{accessorTraitType type}}>::ToAttributeStoreRepresentation(temp);
61
+ using Traits = NumericAttributeTraits<{{accessorTraitType type}}>;
62
+ Traits::StorageType temp;
63
+ uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp);
63
64
EmberAfStatus status = emberAfReadServerAttribute(endpoint, {{>clusterId}}, Id, readable, sizeof(temp));
64
65
VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status);
65
66
{{#if isNullable}}
66
- if (NumericAttributeTraits<{{accessorTraitType type}}> ::IsNullValue(temp))
67
+ if (Traits ::IsNullValue(temp))
67
68
{
68
69
value.SetNull();
69
70
}
70
71
else
71
72
{
72
- value.SetNonNull() = NumericAttributeTraits<{{accessorTraitType type}}> ::StorageToWorking(temp);
73
+ value.SetNonNull() = Traits ::StorageToWorking(temp);
73
74
}
74
75
{{else}}
75
- if (!NumericAttributeTraits<{{accessorTraitType type}}> ::CanRepresentValue(/* isNullable = */ {{isNullable}}, temp))
76
+ if (!Traits ::CanRepresentValue(/* isNullable = */ {{isNullable}}, temp))
76
77
{
77
78
return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
78
79
}
79
- *value = NumericAttributeTraits<{{accessorTraitType type}}> ::StorageToWorking(temp);
80
+ *value = Traits ::StorageToWorking(temp);
80
81
{{/if}}
81
82
return status;
82
83
{{/if}}
83
84
}
84
- EmberAfStatus Set(chip::EndpointId endpoint, {{asUnderlyingZclType type}} value)
85
+ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true }} value)
85
86
{
86
87
{{~#if (isString type)}}
87
88
{{~#*inline "lengthType"}}uint{{#if (isShortString type)}}8{{else}}16{{/if}}_t{{/inline}}
@@ -93,13 +94,14 @@ EmberAfStatus Set(chip::EndpointId endpoint, {{asUnderlyingZclType type}} value)
93
94
memcpy(&zclString[{{>sizingBytes}}], value.data(), value.size());
94
95
return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE);
95
96
{{else}}
96
- if (!NumericAttributeTraits<{{accessorTraitType type}}>::CanRepresentValue(/* isNullable = */ {{isNullable}}, value))
97
+ using Traits = NumericAttributeTraits<{{accessorTraitType type}}>;
98
+ if (!Traits::CanRepresentValue(/* isNullable = */ {{isNullable}}, value))
97
99
{
98
100
return EMBER_ZCL_STATUS_CONSTRAINT_ERROR;
99
101
}
100
- NumericAttributeTraits<{{accessorTraitType type}}> ::StorageType storageValue;
101
- NumericAttributeTraits<{{accessorTraitType type}}> ::WorkingToStorage(value, storageValue);
102
- uint8_t * writable = NumericAttributeTraits<{{accessorTraitType type}}> ::ToAttributeStoreRepresentation(storageValue);
102
+ Traits ::StorageType storageValue;
103
+ Traits ::WorkingToStorage(value, storageValue);
104
+ uint8_t * writable = Traits ::ToAttributeStoreRepresentation(storageValue);
103
105
return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE);
104
106
{{/if}}
105
107
}
@@ -111,14 +113,15 @@ EmberAfStatus SetNull(chip::EndpointId endpoint)
111
113
uint8_t zclString[{{>sizingBytes}}] = { {{#if (isShortString type)}}0xFF{{else}}0xFF, 0xFF{{/if}} };
112
114
return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, zclString, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE);
113
115
{{else}}
114
- NumericAttributeTraits<{{accessorTraitType type}}>::StorageType value;
115
- NumericAttributeTraits<{{accessorTraitType type}}>::SetNull(value);
116
- uint8_t * writable = NumericAttributeTraits<{{accessorTraitType type}}>::ToAttributeStoreRepresentation(value);
116
+ using Traits = NumericAttributeTraits<{{accessorTraitType type}}>;
117
+ Traits::StorageType value;
118
+ Traits::SetNull(value);
119
+ uint8_t * writable = Traits::ToAttributeStoreRepresentation(value);
117
120
return emberAfWriteServerAttribute(endpoint, {{>clusterId}}, Id, writable, ZCL_{{typeAsDelimitedMacro type}}_ATTRIBUTE_TYPE);
118
121
{{/if}}
119
122
}
120
123
121
- EmberAfStatus Set(chip::EndpointId endpoint, const DataModel::Nullable<{{asUnderlyingZclType type}}> & value)
124
+ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}} value)
122
125
{
123
126
if (value.IsNull()) {
124
127
return SetNull(endpoint);
0 commit comments