Skip to content

Commit 1787122

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Remove unused manufacturerCode field of EmberAfAttributeSearchRecord. (#13521)
It's only written, never read. The emberAfReadSequentialAttributesAddToResponse function that was one of the writers is unused, so removing that too.
1 parent ee3ccea commit 1787122

File tree

5 files changed

+19
-128
lines changed

5 files changed

+19
-128
lines changed

src/app/util/af-types.h

+2-28
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,7 @@ typedef struct
132132
chip::EndpointId endpoint;
133133

134134
/**
135-
* Cluster that the attribute is located on. If the cluster
136-
* id is inside the manufacturer specific range, 0xfc00 - 0xffff,
137-
* The manufacturer code should also be set to the code associated
138-
* with the manufacturer specific cluster.
135+
* Cluster that the attribute is located on.
139136
*/
140137
chip::ClusterId clusterId;
141138

@@ -147,34 +144,11 @@ typedef struct
147144
EmberAfClusterMask clusterMask;
148145

149146
/**
150-
* The two byte identifier for the attribute. If the cluster id is
151-
* inside the manufacturer specific range 0xfc00 - 0xffff, or the manufacturer
152-
* code is NOT 0, the attribute is assumed to be manufacturer specific.
147+
* The identifier for the attribute.
153148
*/
154149
chip::AttributeId attributeId;
155-
156-
/**
157-
* Manufacturer Code associated with the cluster and or attribute.
158-
* If the cluster id is inside the manufacturer specific
159-
* range, this value should indicate the manufacturer code for the
160-
* manufacturer specific cluster. Otherwise if this value is non zero,
161-
* and the cluster id is a standard ZCL cluster,
162-
* it is assumed that the attribute being sought is a manufacturer specific
163-
* extension to the standard ZCL cluster indicated by the cluster id.
164-
*/
165-
uint16_t manufacturerCode;
166150
} EmberAfAttributeSearchRecord;
167151

168-
/**
169-
* A struct used to construct a table of manufacturer codes for
170-
* manufacturer specific attributes and clusters.
171-
*/
172-
typedef struct
173-
{
174-
uint16_t index;
175-
uint16_t manufacturerCode;
176-
} EmberAfManufacturerCodeEntry;
177-
178152
/**
179153
* This type is used to compare two ZCL attribute values. The size of this data
180154
* type depends on the platform.

src/app/util/attribute-storage.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,10 @@ EmberAfAttributeMetadata * emberAfLocateAttributeMetadata(EndpointId endpoint, C
400400
{
401401
EmberAfAttributeMetadata * metadata = NULL;
402402
EmberAfAttributeSearchRecord record;
403-
record.endpoint = endpoint;
404-
record.clusterId = clusterId;
405-
record.clusterMask = mask;
406-
record.attributeId = attributeId;
407-
record.manufacturerCode = manufacturerCode;
403+
record.endpoint = endpoint;
404+
record.clusterId = clusterId;
405+
record.clusterMask = mask;
406+
record.attributeId = attributeId;
408407
emAfReadOrWriteAttribute(&record, &metadata,
409408
NULL, // buffer
410409
0, // buffer size
@@ -1270,11 +1269,10 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, bool ignoreStorage)
12701269
if (!am->IsExternal())
12711270
{
12721271
EmberAfAttributeSearchRecord record;
1273-
record.endpoint = de->endpoint;
1274-
record.clusterId = cluster->clusterId;
1275-
record.clusterMask = (emberAfAttributeIsClient(am) ? CLUSTER_MASK_CLIENT : CLUSTER_MASK_SERVER);
1276-
record.attributeId = am->attributeId;
1277-
record.manufacturerCode = EMBER_AF_NULL_MANUFACTURER_CODE;
1272+
record.endpoint = de->endpoint;
1273+
record.clusterId = cluster->clusterId;
1274+
record.clusterMask = (emberAfAttributeIsClient(am) ? CLUSTER_MASK_CLIENT : CLUSTER_MASK_SERVER);
1275+
record.attributeId = am->attributeId;
12781276

12791277
if (ptr == nullptr)
12801278
{

src/app/util/attribute-table.cpp

+9-85
Original file line numberDiff line numberDiff line change
@@ -171,80 +171,6 @@ EmberAfStatus emberAfReadManufacturerSpecificClientAttribute(EndpointId endpoint
171171
return emAfReadAttribute(endpoint, cluster, attributeID, CLUSTER_MASK_CLIENT, manufacturerCode, dataPtr, readLength, NULL);
172172
}
173173

174-
bool emberAfReadSequentialAttributesAddToResponse(EndpointId endpoint, ClusterId clusterId, AttributeId startAttributeId,
175-
uint8_t mask, uint16_t manufacturerCode, uint8_t maxAttributeIds,
176-
bool includeAccessControl)
177-
{
178-
uint16_t i;
179-
uint16_t discovered = 0;
180-
uint16_t skipped = 0;
181-
uint16_t total = 0;
182-
183-
EmberAfCluster * cluster = emberAfFindClusterWithMfgCode(endpoint, clusterId, mask, manufacturerCode);
184-
185-
EmberAfAttributeSearchRecord record;
186-
record.endpoint = endpoint;
187-
record.clusterId = clusterId;
188-
record.clusterMask = mask;
189-
record.attributeId = startAttributeId;
190-
record.manufacturerCode = manufacturerCode;
191-
192-
// If we don't have the cluster or it doesn't match the search, we're done.
193-
if (cluster == NULL || !emAfMatchCluster(cluster, &record))
194-
{
195-
return true;
196-
}
197-
198-
for (i = 0; i < cluster->attributeCount; i++)
199-
{
200-
EmberAfAttributeMetadata * metadata = &cluster->attributes[i];
201-
202-
// If the cluster is not manufacturer-specific, an attribute is considered
203-
// only if its manufacturer code matches that of the command (which may be
204-
// unset).
205-
if (!emberAfClusterIsManufacturerSpecific(cluster))
206-
{
207-
record.attributeId = metadata->attributeId;
208-
if (!emAfMatchAttribute(cluster, metadata, &record))
209-
{
210-
continue;
211-
}
212-
}
213-
214-
if (metadata->attributeId < startAttributeId)
215-
{
216-
skipped++;
217-
}
218-
else if (discovered < maxAttributeIds)
219-
{
220-
emberAfPutInt32uInResp(metadata->attributeId);
221-
emberAfPutInt8uInResp(metadata->attributeType);
222-
if (includeAccessControl)
223-
{
224-
// bit 0 : Readable <-- All our attributes are readable
225-
// bit 1 : Writable <-- The only thing we track in the attribute metadata mask
226-
// bit 2 : Reportable <-- All our attributes are reportable
227-
emberAfPutInt8uInResp((metadata->mask & ATTRIBUTE_MASK_WRITABLE) ? 0x07 : 0x05);
228-
}
229-
discovered++;
230-
}
231-
else
232-
{
233-
// MISRA requires ..else if.. to have terminating else.
234-
}
235-
total++;
236-
}
237-
238-
// We are finished if there are no more attributes to find, which means the
239-
// number of attributes discovered plus the number skipped equals the total
240-
// attributes in the cluster. For manufacturer-specific clusters, the total
241-
// includes all attributes in the cluster. For standard ZCL clusters, if the
242-
// the manufacturer code is set, the total is the number of attributes that
243-
// match the manufacturer code. Otherwise, the total is the number of
244-
// standard ZCL attributes in the cluster.
245-
return (discovered + skipped == total);
246-
}
247-
248174
static void emberAfAttributeDecodeAndPrintCluster(ClusterId cluster, uint16_t mfgCode)
249175
{
250176
#if defined(EMBER_AF_PRINT_ENABLE) && defined(EMBER_AF_PRINT_ATTRIBUTES)
@@ -542,11 +468,10 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu
542468
{
543469
EmberAfAttributeMetadata * metadata = NULL;
544470
EmberAfAttributeSearchRecord record;
545-
record.endpoint = endpoint;
546-
record.clusterId = cluster;
547-
record.clusterMask = mask;
548-
record.attributeId = attributeID;
549-
record.manufacturerCode = manufacturerCode;
471+
record.endpoint = endpoint;
472+
record.clusterId = cluster;
473+
record.clusterMask = mask;
474+
record.attributeId = attributeID;
550475
emAfReadOrWriteAttribute(&record, &metadata,
551476
NULL, // buffer
552477
0, // buffer size
@@ -689,12 +614,11 @@ EmberAfStatus emAfReadAttribute(EndpointId endpoint, ClusterId cluster, Attribut
689614
EmberAfAttributeMetadata * metadata = NULL;
690615
EmberAfAttributeSearchRecord record;
691616
EmberAfStatus status;
692-
record.endpoint = endpoint;
693-
record.clusterId = cluster;
694-
record.clusterMask = mask;
695-
record.attributeId = attributeID;
696-
record.manufacturerCode = manufacturerCode;
697-
status = emAfReadOrWriteAttribute(&record, &metadata, dataPtr, readLength,
617+
record.endpoint = endpoint;
618+
record.clusterId = cluster;
619+
record.clusterMask = mask;
620+
record.attributeId = attributeID;
621+
status = emAfReadOrWriteAttribute(&record, &metadata, dataPtr, readLength,
698622
false); // write?
699623

700624
if (status == EMBER_ZCL_STATUS_SUCCESS)

src/app/util/attribute-table.h

-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ EmberAfStatus emberAfAppendAttributeReportFields(chip::EndpointId endpoint, chip
5757
uint8_t * bufIndex);
5858
void emberAfPrintAttributeTable(void);
5959

60-
bool emberAfReadSequentialAttributesAddToResponse(chip::EndpointId endpoint, chip::ClusterId clusterId,
61-
chip::AttributeId startAttributeId, uint8_t mask, uint16_t manufacturerCode,
62-
uint8_t maxAttributeIds, bool includeAccessControl);
63-
6460
EmberAfStatus emAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t mask,
6561
uint16_t manufacturerCode, uint8_t * data, EmberAfAttributeType dataType,
6662
bool overrideReadOnlyAndDataType, bool justTest);

src/app/util/ember-compatibility-functions.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, c
462462
record.clusterId = aPath.mClusterId;
463463
record.clusterMask = CLUSTER_MASK_SERVER;
464464
record.attributeId = aPath.mAttributeId;
465-
record.manufacturerCode = EMBER_AF_NULL_MANUFACTURER_CODE;
466465
EmberAfStatus emberStatus = emAfReadOrWriteAttribute(&record, &attributeMetadata, attributeData, sizeof(attributeData),
467466
/* write = */ false);
468467

0 commit comments

Comments
 (0)