Skip to content

Commit

Permalink
Add Basic cluster tests for attributes constraints (#7792)
Browse files Browse the repository at this point in the history
* Extract Basic Information from general.xml to have it into its own file and reformat it to make it easier to read when comparing to the spec

* Use the updated Basic Information Cluster into the all-clusters-app and src/controller/data_model

* Do not overwrite the interaction model version defined from zap when the basic clusters startups

* Update templates to support _optional_ property on test as well as _constraints_

* Update the all-clusters-app.zap file with a fake manufacturing date for the basic cluster

* Add Test_10_1_1.yaml file

* Use optional for TestCluster unsupported attribute

* Update gen/ folders
  • Loading branch information
vivien-apple authored and pull[bot] committed Jul 7, 2021
1 parent d029172 commit 3254895
Show file tree
Hide file tree
Showing 36 changed files with 4,255 additions and 2,298 deletions.
39 changes: 27 additions & 12 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@
"mfgCode": 4098,
"source": "client",
"incoming": 1,
"outgoing": 1
"outgoing": 0
}
],
"attributes": [
Expand Down Expand Up @@ -896,23 +896,23 @@
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
"outgoing": 0
},
{
"name": "ShutDown",
"code": 1,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
"outgoing": 0
},
{
"name": "Leave",
"code": 2,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
"outgoing": 0
}
],
"attributes": [
Expand All @@ -925,7 +925,7 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "",
"defaultValue": "1",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -1030,7 +1030,7 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "0x00",
"defaultValue": "0",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -1060,7 +1060,7 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "0x00",
"defaultValue": "0",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -1090,7 +1090,7 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "",
"defaultValue": "20210614123456ZZ",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -1165,7 +1165,22 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "0x00",
"defaultValue": "0",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "Reachable",
"code": 17,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "1",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -11683,7 +11698,7 @@
]
},
{
"name": "Content Launch",
"name": "Content Launcher",
"code": 1290,
"mfgCode": null,
"define": "CONTENT_LAUNCH_CLUSTER",
Expand Down Expand Up @@ -11726,7 +11741,7 @@
]
},
{
"name": "Content Launch",
"name": "Content Launcher",
"code": 1290,
"mfgCode": null,
"define": "CONTENT_LAUNCH_CLUSTER",
Expand Down Expand Up @@ -15793,4 +15808,4 @@
}
],
"log": []
}
}
823 changes: 397 additions & 426 deletions examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h

Large diffs are not rendered by default.

374 changes: 184 additions & 190 deletions examples/bridge-app/bridge-common/gen/endpoint_config.h

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,7 @@ class ReadBarrierControlClusterRevision : public ModelCommand
| * ProductLabel | 0x000E |
| * SerialNumber | 0x000F |
| * LocalConfigDisabled | 0x0010 |
| * Reachable | 0x0011 |
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

Expand Down Expand Up @@ -3054,6 +3055,40 @@ class WriteBasicLocalConfigDisabled : public ModelCommand
uint8_t mValue;
};

/*
* Attribute Reachable
*/
class ReadBasicReachable : public ModelCommand
{
public:
ReadBasicReachable() : ModelCommand("read")
{
AddArgument("attr-name", "reachable");
ModelCommand::AddArguments();
}

~ReadBasicReachable()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);

chip::Controller::BasicCluster cluster;
cluster.Associate(device, endpointId);
return cluster.ReadAttributeReachable(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<BooleanAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<BooleanAttributeCallback>(OnBooleanAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute ClusterRevision
*/
Expand Down Expand Up @@ -20710,6 +20745,7 @@ void registerClusterBasic(Commands & commands)
make_unique<ReadBasicSerialNumber>(),
make_unique<ReadBasicLocalConfigDisabled>(),
make_unique<WriteBasicLocalConfigDisabled>(),
make_unique<ReadBasicReachable>(),
make_unique<ReadBasicClusterRevision>(),
};

Expand Down
Loading

0 comments on commit 3254895

Please sign in to comment.