Skip to content

Commit a986606

Browse files
authored
Cleanup some unused functionality from app/util/util.cpp (project-chip#32382)
* Remove unused zclClusterNames method and usage. Intent is to make util.cpp less dependent on generated code * Remove one more undefined and never used definition
1 parent 42727b1 commit a986606

File tree

5 files changed

+0
-999
lines changed

5 files changed

+0
-999
lines changed

src/app/common/templates/templates.json

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
"name": "ZCL callback header",
4646
"output": "callback.h"
4747
},
48-
{
49-
"path": "../../zap-templates/templates/app/print-cluster.zapt",
50-
"name": "ZCL print-cluster header",
51-
"output": "print-cluster.h"
52-
},
5348
{
5449
"path": "../../zap-templates/templates/app/attributes/Accessors.zapt",
5550
"name": "Attributes Accessors header",

src/app/util/util.cpp

-37
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <app-common/zap-generated/attribute-type.h>
2121
#include <app-common/zap-generated/attributes/Accessors.h>
2222
#include <app-common/zap-generated/ids/Clusters.h>
23-
#include <app-common/zap-generated/print-cluster.h>
2423
#include <app/util/af.h>
2524
#include <app/util/attribute-storage.h>
2625
#include <app/util/config.h>
@@ -41,23 +40,6 @@ using namespace chip;
4140

4241
using chip::Protocols::InteractionModel::Status;
4342

44-
//------------------------------------------------------------------------------
45-
// Forward Declarations
46-
47-
//------------------------------------------------------------------------------
48-
// Globals
49-
50-
const EmberAfClusterName zclClusterNames[] = {
51-
CLUSTER_IDS_TO_NAMES // defined in print-cluster.h
52-
{ kInvalidClusterId, nullptr }, // terminator
53-
};
54-
55-
#ifdef MATTER_DM_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS
56-
MATTER_DM_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS
57-
#endif
58-
59-
//------------------------------------------------------------------------------
60-
6143
// Is the device identifying?
6244
bool emberAfIsDeviceIdentifying(EndpointId endpoint)
6345
{
@@ -174,25 +156,6 @@ void MatterPowerTopologyPluginServerInitCallback() {}
174156
void MatterElectricalEnergyMeasurementPluginServerInitCallback() {}
175157
void MatterElectricalPowerMeasurementPluginServerInitCallback() {}
176158

177-
// ****************************************
178-
// Print out information about each cluster
179-
// ****************************************
180-
181-
uint16_t emberAfFindClusterNameIndex(ClusterId cluster)
182-
{
183-
static_assert(sizeof(ClusterId) == 4, "May need to adjust our index type or somehow define it in terms of cluster id type");
184-
uint16_t index = 0;
185-
while (zclClusterNames[index].id != kInvalidClusterId)
186-
{
187-
if (zclClusterNames[index].id == cluster)
188-
{
189-
return index;
190-
}
191-
index++;
192-
}
193-
return 0xFFFF;
194-
}
195-
196159
#if (CHIP_CONFIG_BIG_ENDIAN_TARGET)
197160
#define EM_BIG_ENDIAN true
198161
#else

src/app/util/util.h

-10
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,7 @@
2222
#include <app/util/af-types.h>
2323
#include <app/util/endpoint-config-api.h>
2424

25-
// Cluster name structure
26-
typedef struct
27-
{
28-
chip::ClusterId id;
29-
const char * name;
30-
} EmberAfClusterName;
31-
32-
extern const EmberAfClusterName zclClusterNames[];
33-
3425
void emberAfInit();
35-
uint16_t emberAfFindClusterNameIndex(chip::ClusterId cluster);
3626

3727
/**
3828
* Retrieves the difference between the two passed values.

src/app/zap-templates/templates/app/print-cluster.zapt

-26
This file was deleted.

0 commit comments

Comments
 (0)