Skip to content

Commit

Permalink
Add basic attribute read tests for general diagnostics cluster.
Browse files Browse the repository at this point in the history
Some notes:

1) This cluster appears on endpoint 0 on all-clusters-app, so we have to add
   it to the list in src/darwin/Framework/CHIP/templates/helper.js.

2) CHAR_STRING is not supported in structs yet.  Hence switch
   NetworkInterfaceType to using OCTET_STRING.

3) Remove the incorrect reinterpret_cast that was added to
   src/app/zap-templates/templates/app/attribute-size-src.zapt.
  • Loading branch information
bzbarsky-apple committed May 14, 2021
1 parent f0e9f91 commit 5a461d1
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 2 deletions.
82 changes: 82 additions & 0 deletions examples/chip-tool/chip-tool.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,88 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
{{chipType}} * entry = reinterpret_cast<{{chipType}} *>(write ? src : dest);
{{#chip_attribute_list_entryTypes}}
{{#if (isString type)}}
chip::ByteSpan * {{name}}Span = reinterpret_cast<chip::ByteSpan *>(&entry->{{name}}); // {{type}}
chip::ByteSpan * {{name}}Span = &entry->{{name}}; // {{type}}
if (CHIP_NO_ERROR != (write ? WriteByteSpan(dest + entryOffset, {{size}}, {{name}}Span) : ReadByteSpan(src + entryOffset, {{size}}, {{name}}Span)))
{
ChipLogError(Zcl, "Index %l is invalid. Not enough remaining space", index);
Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/custom-types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ limitations under the License.
<item name="operationalCert" type="OCTET_STRING" length="32"/>
</struct>
<struct name="NetworkInterfaceType">
<item name="Name" type="CHAR_STRING" length="32"/>
// TODO: CHAR_STRING not supported yet in structs.
<item name="Name" type="OCTET_STRING" length="32"/>
<item name="FabricConnected" type="BOOLEAN"/>
<item name="OffPremiseServicesReachableIPv4" type="BOOLEAN"/>
<item name="OffPremiseServicesReachableIPv6" type="BOOLEAN"/>
Expand Down
82 changes: 82 additions & 0 deletions src/controller/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,88 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down
82 changes: 82 additions & 0 deletions src/controller/python/local-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,88 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down
82 changes: 82 additions & 0 deletions src/darwin/Framework/CHIP/chip-tool.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,88 @@
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "General Diagnostics",
"code": 51,
"mfgCode": null,
"define": "GENERAL_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "NetworkInterfaces",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "RebootCount",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down
1 change: 1 addition & 0 deletions src/darwin/Framework/CHIP/templates/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function asExpectedEndpointForCluster(clusterName)
case 'Basic':
case 'Descriptor':
case 'GeneralCommissioning':
case 'GeneralDiagnostics':
case 'GroupKeyManagement':
case 'NetworkCommissioning':
case 'OperationalCredentials':
Expand Down

0 comments on commit 5a461d1

Please sign in to comment.