Skip to content

Commit

Permalink
Make test cluster code an "manufacturer extension cluster" (#19288)
Browse files Browse the repository at this point in the history
* Move 0x050F to 0xFFF1050F for test cluster

* Update test cluster code in zap files

* Ran zap regen

* For purposes of naming, switch data sizes to uint32_t to support full codes. I am unsure why mfgCode was used to have a cluster code, but it seems to behave like that

* Remove MFG code from println code: it does not seem used

* Restyle

* Single extra error log for failure since the log of "assertion failed: "onSuccessWasCalled && !onFailureWasCalled"" is not as useful

* Switch cluster ID from 0xFFF1050F to 0xFFF1F50F to match spec range restrictions

* Switch cluster ID from 0xFFF1F50F to 0xFFF1FC05 to match spec range restrictions .. even more restricted it seems

* Switch cluster ID from 0xFFF1F50F to 0xFFF1FC05 to match spec range restrictions .. even more restricted it seems

* Remove unused argument

* Update unit test getting of cluster info to use the new cluster id for the test cluster

* Update protobuf for pigwed with the updated cluster id for the test cluster

* Update tvapp constant for test cluster. Why does TV app use a test cluster?

* Use ChipClusterId data type

* Isolate the protobuf definition in an enum for the test cluster id - the id is too large to be acccepted by protoc

* Define the constant after all, with a big explanation about why it is likely bad
  • Loading branch information
andy31415 authored Jun 9, 2022
1 parent 47a51ce commit ac7e2f7
Show file tree
Hide file tree
Showing 48 changed files with 18,679 additions and 18,676 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,7 @@ server cluster TemperatureMeasurement = 1026 {
readonly attribute int16u clusterRevision = 65533;
}

server cluster TestCluster = 1295 {
server cluster TestCluster = 4294048773 {
enum SimpleEnum : ENUM8 {
kUnspecified = 0;
kValueA = 1;
Expand Down Expand Up @@ -4680,6 +4680,22 @@ endpoint 1 {
ram attribute clusterRevision default = 1;
}

server cluster ElectricalMeasurement {
ram attribute measurementType;
ram attribute totalActivePower;
ram attribute rmsVoltage default = 0xffff;
ram attribute rmsVoltageMin default = 0x8000;
ram attribute rmsVoltageMax default = 0x8000;
ram attribute rmsCurrent default = 0xffff;
ram attribute rmsCurrentMin default = 0xffff;
ram attribute rmsCurrentMax default = 0xffff;
ram attribute activePower default = 0xffff;
ram attribute activePowerMin default = 0xffff;
ram attribute activePowerMax default = 0xffff;
ram attribute featureMap;
ram attribute clusterRevision default = 3;
}

server cluster TestCluster {
ram attribute boolean;
ram attribute bitmap8;
Expand Down Expand Up @@ -4764,22 +4780,6 @@ endpoint 1 {
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}

server cluster ElectricalMeasurement {
ram attribute measurementType;
ram attribute totalActivePower;
ram attribute rmsVoltage default = 0xffff;
ram attribute rmsVoltageMin default = 0x8000;
ram attribute rmsVoltageMax default = 0x8000;
ram attribute rmsCurrent default = 0xffff;
ram attribute rmsCurrentMin default = 0xffff;
ram attribute rmsCurrentMax default = 0xffff;
ram attribute activePower default = 0xffff;
ram attribute activePowerMin default = 0xffff;
ram attribute activePowerMax default = 0xffff;
ram attribute featureMap;
ram attribute clusterRevision default = 3;
}
}
endpoint 2 {
device type onofflight = 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8268,7 +8268,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -8320,7 +8320,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -19155,7 +19155,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -19327,7 +19327,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -25144,4 +25144,4 @@
}
],
"log": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,7 @@ server cluster TemperatureMeasurement = 1026 {
readonly attribute int16u clusterRevision = 65533;
}

server cluster TestCluster = 1295 {
server cluster TestCluster = 4294048773 {
enum SimpleEnum : ENUM8 {
kUnspecified = 0;
kValueA = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8268,7 +8268,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -8320,7 +8320,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -19110,7 +19110,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -19282,7 +19282,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -25098,4 +25098,4 @@
"deviceIdentifier": 61442
}
]
}
}
8 changes: 7 additions & 1 deletion examples/common/pigweed/protos/attributes_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ enum ClusterType {
ZCL_APPLICATION_LAUNCHER_CLUSTER_ID = 0x050C;
ZCL_APPLICATION_BASIC_CLUSTER_ID = 0x050D;
ZCL_ACCOUNT_LOGIN_CLUSTER_ID = 0x050E;
ZCL_TEST_CLUSTER_ID = 0x050F;
ZCL_MESSAGING_CLUSTER_ID = 0x0703;
ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID = 0x0B00;
ZCL_METER_IDENTIFICATION_CLUSTER_ID = 0x0B01;
Expand All @@ -180,6 +179,13 @@ enum ClusterType {
ZCL_BINDING_CLUSTER_ID = 0xF000;
ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID = 0xF004;
ZCL_SAMPLE_MFG_SPECIFIC_CLUSTER_ID = 0xFC00;

// NOTE: This is a large number that becomes negative as a 32-bit integer.
//
// Protobuf documentation states:
// Enumerator constants must be in the range of a 32-bit integer. Since enum values
// use varint encoding on the wire, negative values are inefficient and thus not recommended.
ZCL_TEST_CLUSTER_ID = -918523; // 0xFFF1FC05;
}


Expand Down
10 changes: 5 additions & 5 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -7009,7 +7009,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -7061,7 +7061,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -14090,7 +14090,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -14134,7 +14134,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -14511,4 +14511,4 @@
"deviceIdentifier": 769
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class Clusters {
public static final int ClusterId_ApplicationLauncher = 0x0000050C;
public static final int ClusterId_ApplicationBasic = 0x0000050D;
public static final int ClusterId_AccountLogin = 0x0000050E;
public static final int ClusterId_TestCluster = 0x0000050F;
public static final int ClusterId_TestCluster = 0xFFF1FC05;
public static final int ClusterId_Messaging = 0x00000703;
public static final int ClusterId_ApplianceIdentification = 0x00000B00;
public static final int ClusterId_MeterIdentification = 0x00000B01;
Expand Down
10 changes: 5 additions & 5 deletions examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -7123,7 +7123,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -7175,7 +7175,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -9432,7 +9432,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -9484,7 +9484,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -12529,4 +12529,4 @@
}
],
"log": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ client cluster TargetNavigator = 1285 {
command NavigateTarget(NavigateTargetRequest): NavigateTargetResponse = 0;
}

server cluster TestCluster = 1295 {
server cluster TestCluster = 4294048773 {
enum SimpleEnum : ENUM8 {
kUnspecified = 0;
kValueA = 1;
Expand Down
10 changes: 5 additions & 5 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -6896,7 +6896,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -6948,7 +6948,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -14227,7 +14227,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "client",
Expand Down Expand Up @@ -14271,7 +14271,7 @@
},
{
"name": "Test Cluster",
"code": 1295,
"code": 4294048773,
"mfgCode": null,
"define": "TEST_CLUSTER",
"side": "server",
Expand Down Expand Up @@ -17747,4 +17747,4 @@
"deviceIdentifier": 263
}
]
}
}
4 changes: 2 additions & 2 deletions src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ uint32_t afNumPktsSent;
#endif

const EmberAfClusterName zclClusterNames[] = {
CLUSTER_IDS_TO_NAMES // defined in print-cluster.h
{ ZCL_NULL_CLUSTER_ID, EMBER_AF_NULL_MANUFACTURER_CODE, nullptr }, // terminator
CLUSTER_IDS_TO_NAMES // defined in print-cluster.h
{ ZCL_NULL_CLUSTER_ID, nullptr }, // terminator
};

// A pointer to the current command being processed
Expand Down
3 changes: 1 addition & 2 deletions src/app/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
// Cluster name structure
typedef struct
{
uint16_t id;
uint16_t mfgCode;
chip::ClusterId id;
const char * name;
} EmberAfClusterName;

Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/templates/app/print-cluster.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{{#zcl_clusters}}
#if defined(ZCL_USING_{{asDelimitedMacro this.define}}_SERVER) || defined(ZCL_USING_{{asDelimitedMacro this.define}}_CLIENT)
#define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} {ZCL_{{asDelimitedMacro this.define}}_ID, {{this.code}}, "{{this.label}}" },
#define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}} {ZCL_{{asDelimitedMacro this.define}}_ID, "{{this.label}}" },
#else
#define CHIP_PRINTCLUSTER_{{asDelimitedMacro this.define}}
#endif
Expand Down
Loading

0 comments on commit ac7e2f7

Please sign in to comment.