Skip to content

Commit

Permalink
[binding] Make binding table an attribute (#14874)
Browse files Browse the repository at this point in the history
* [binding] Make binding table an attribute

* fix linux tv-app build
  • Loading branch information
gjc13 authored and pull[bot] committed Feb 17, 2022
1 parent 5fd4acb commit 4670416
Show file tree
Hide file tree
Showing 101 changed files with 3,206 additions and 2,948 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,15 @@ server cluster BinaryInputBasic = 15 {
}

server cluster Binding = 30 {
readonly global attribute int16u clusterRevision = 65533;

request struct BindRequest {
struct BindingEntry {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

request struct UnbindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

command Bind(BindRequest): DefaultSuccess = 0;
command Unbind(UnbindRequest): DefaultSuccess = 1;
attribute BindingEntry bindingList[] = 0;
readonly global attribute int16u clusterRevision = 65533;
}

server cluster BooleanState = 69 {
Expand Down
70 changes: 33 additions & 37 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -877,24 +877,7 @@
"define": "BINDING_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "Bind",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "Unbind",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"commands": [],
"attributes": [
{
"name": "ClusterRevision",
Expand Down Expand Up @@ -922,6 +905,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "binding list",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down Expand Up @@ -8706,24 +8704,7 @@
"define": "BINDING_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "Bind",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "Unbind",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"commands": [],
"attributes": [
{
"name": "ClusterRevision",
Expand Down Expand Up @@ -8751,6 +8732,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "binding list",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down Expand Up @@ -21103,4 +21099,4 @@
"deviceIdentifier": 256
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BridgedActionsAttrAccess : public AttributeAccessInterface
// Register for the Bridged Actions cluster on all endpoints.
BridgedActionsAttrAccess() : AttributeAccessInterface(Optional<EndpointId>::Missing(), BridgedActions::Id) {}

CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
CHIP_ERROR Read(FabricIndex fabricIndex, const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;

private:
static constexpr uint16_t ClusterRevision = 1;
Expand Down Expand Up @@ -75,7 +75,8 @@ CHIP_ERROR BridgedActionsAttrAccess::ReadClusterRevision(EndpointId endpoint, At

BridgedActionsAttrAccess gAttrAccess;

CHIP_ERROR BridgedActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
CHIP_ERROR BridgedActionsAttrAccess::Read(FabricIndex fabricIndex, const ConcreteReadAttributePath & aPath,
AttributeValueEncoder & aEncoder)
{
VerifyOrDie(aPath.mClusterId == BridgedActions::Id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,6 @@ server cluster Basic = 40 {

server cluster Binding = 30 {
readonly global attribute int16u clusterRevision = 65533;

request struct BindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

request struct UnbindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

command Bind(BindRequest): DefaultSuccess = 0;
command Unbind(UnbindRequest): DefaultSuccess = 1;
}

client cluster ColorControl = 768 {
Expand Down
15 changes: 3 additions & 12 deletions examples/thermostat/thermostat-common/thermostat.matter
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,15 @@ server cluster Basic = 40 {
}

server cluster Binding = 30 {
readonly global attribute int16u clusterRevision = 65533;

request struct BindRequest {
struct BindingEntry {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

request struct UnbindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

command Bind(BindRequest): DefaultSuccess = 0;
command Unbind(UnbindRequest): DefaultSuccess = 1;
attribute BindingEntry bindingList[] = 0;
readonly global attribute int16u clusterRevision = 65533;
}

server cluster Descriptor = 29 {
Expand Down
68 changes: 32 additions & 36 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -854,24 +854,7 @@
"define": "BINDING_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "Bind",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "Unbind",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"commands": [],
"attributes": [
{
"name": "ClusterRevision",
Expand Down Expand Up @@ -899,6 +882,21 @@
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "binding list",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down Expand Up @@ -8158,24 +8156,7 @@
"define": "BINDING_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "Bind",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "Unbind",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"commands": [],
"attributes": [
{
"name": "ClusterRevision",
Expand Down Expand Up @@ -8203,6 +8184,21 @@
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "binding list",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down
3 changes: 2 additions & 1 deletion examples/tv-app/linux/include/cluster-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class TvAttrAccess : public app::AttributeAccessInterface
public:
TvAttrAccess() : app::AttributeAccessInterface(Optional<EndpointId>::Missing(), AttrTypeInfo::GetClusterId()) {}

CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override
CHIP_ERROR Read(FabricIndex fabricIndex, const app::ConcreteReadAttributePath & aPath,
app::AttributeValueEncoder & aEncoder) override
{
if (aPath.mAttributeId == AttrTypeInfo::GetAttributeId())
{
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MyPostCommissioningListener : public PostCommissioningListener
}

/* Callback when command results in success */
static void OnSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &)
static void OnSuccessResponse(void * context)
{
ChipLogProgress(Controller, "OnSuccessResponse - Binding Add Successfully");
CommissionerDiscoveryController * cdc = GetCommissionerDiscoveryController();
Expand Down
30 changes: 6 additions & 24 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -277,45 +277,27 @@ server cluster Basic = 40 {
}

client cluster Binding = 30 {
readonly global attribute int16u clusterRevision = 65533;

request struct BindRequest {
struct BindingEntry {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

request struct UnbindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

command Bind(BindRequest): DefaultSuccess = 0;
command Unbind(UnbindRequest): DefaultSuccess = 1;
attribute BindingEntry bindingList[] = 0;
readonly global attribute int16u clusterRevision = 65533;
}

server cluster Binding = 30 {
readonly global attribute int16u clusterRevision = 65533;

request struct BindRequest {
struct BindingEntry {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

request struct UnbindRequest {
NODE_ID nodeId = 0;
GROUP_ID groupId = 1;
ENDPOINT_NO endpointId = 2;
CLUSTER_ID clusterId = 3;
}

command Bind(BindRequest): DefaultSuccess = 0;
command Unbind(UnbindRequest): DefaultSuccess = 1;
attribute BindingEntry bindingList[] = 0;
readonly global attribute int16u clusterRevision = 65533;
}

server cluster Channel = 1284 {
Expand Down
Loading

0 comments on commit 4670416

Please sign in to comment.