diff --git a/examples/all-clusters-app/all-clusters-common/BUILD.gn b/examples/all-clusters-app/all-clusters-common/BUILD.gn index bcccf42a007521..c3d3ed724bac41 100644 --- a/examples/all-clusters-app/all-clusters-common/BUILD.gn +++ b/examples/all-clusters-app/all-clusters-common/BUILD.gn @@ -26,6 +26,7 @@ chip_data_model("all-clusters-common") { "bindings", "color-control-server", "content-launch-server", + "descriptor", "door-lock-server", "general-commissioning-server", "groups-server", diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 8cd94601604339..2d93651dfa5740 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1,6 +1,5 @@ { - "writeTime": "Wed Mar 17 2021 11:32:50 GMT-0700 (Pacific Daylight Time)", - "featureLevel": 11, + "featureLevel": 19, "creator": "zap", "keyValuePairs": [ { @@ -19,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../../src/app/zap-templates/zcl/zcl.json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../../../src/app/zap-templates/app-templates.json", + "path": "../../../src/app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -33,9 +32,9 @@ "endpointTypes": [ { "name": "Anonymous Endpoint Type", - "deviceTypeName": null, - "deviceTypeCode": null, - "deviceTypeProfileId": null, + "deviceTypeName": "CHIP-All-Clusters-Server", + "deviceTypeCode": 0, + "deviceTypeProfileId": 259, "clusters": [ { "name": "Identify", @@ -86,7 +85,7 @@ "mfgCode": null, "define": "IDENTIFY_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "IdentifyQueryResponse", @@ -137,23 +136,6 @@ "define": "GROUPS_CLUSTER", "side": "client", "enabled": 0, - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ], "commands": [ { "name": "AddGroup", @@ -203,6 +185,23 @@ "incoming": 1, "outgoing": 1 } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } ] }, { @@ -211,7 +210,7 @@ "mfgCode": null, "define": "GROUPS_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "AddGroupResponse", @@ -368,7 +367,7 @@ "mfgCode": null, "define": "SCENES_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "AddSceneResponse", @@ -701,7 +700,7 @@ "mfgCode": null, "define": "LEVEL_CONTROL_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { @@ -736,6 +735,118 @@ } ] }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_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": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "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": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Basic", "code": 40, @@ -743,7 +854,16 @@ "define": "BASIC_CLUSTER", "side": "client", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "MfgSpecificPing", + "code": 0, + "mfgCode": "4098", + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { "name": "cluster revision", @@ -979,15 +1099,15 @@ ] }, { - "name": "Door Lock", - "code": 257, + "name": "General Commissioning", + "code": 48, "mfgCode": null, - "define": "DOOR_LOCK_CLUSTER", + "define": "GENERAL_COMMISSIONING_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "LockDoor", + "name": "SetFabric", "code": 0, "mfgCode": null, "source": "client", @@ -995,178 +1115,289 @@ "outgoing": 1 }, { - "name": "UnlockDoor", - "code": 1, + "name": "ArmFailSafe", + "code": 2, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "UnlockWithTimeout", - "code": 3, + "name": "CommissioningComplete", + "code": 6, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 - }, + } + ], + "attributes": [ { - "name": "GetLogRecord", - "code": 4, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ { - "name": "SetPin", - "code": 5, + "name": "SetFabricResponse", + "code": 1, "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "GetPin", - "code": 6, + "name": "ArmFailSafeResponse", + "code": 3, "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "ClearPin", + "name": "CommissioningCompleteResponse", "code": 7, "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 - }, + } + ], + "attributes": [ { - "name": "ClearAllPins", - "code": 8, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "SetWeekdaySchedule", - "code": 11, + "name": "FabricId", + "code": 0, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "GetWeekdaySchedule", - "code": 12, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "o", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Breadcrumb", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "ClearWeekdaySchedule", - "code": 13, + "name": "AddWiFiNetwork", + "code": 2, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 1 + "outgoing": 0 }, { - "name": "SetYeardaySchedule", - "code": 14, + "name": "UpdateWiFiNetwork", + "code": 4, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 1 + "outgoing": 0 }, { - "name": "GetYeardaySchedule", - "code": 15, + "name": "AddThreadNetwork", + "code": 6, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 1 + "outgoing": 0 }, { - "name": "ClearYeardaySchedule", - "code": 16, + "name": "UpdateThreadNetwork", + "code": 8, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 1 + "outgoing": 0 }, { - "name": "SetHolidaySchedule", - "code": 17, + "name": "RemoveNetwork", + "code": 10, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "GetHolidaySchedule", - "code": 18, + "name": "EnableNetwork", + "code": 12, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "ClearHolidaySchedule", - "code": 19, + "name": "DisableNetwork", + "code": 14, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "SetUserType", - "code": 20, + "name": "GetLastNetworkCommissioningResult", + "code": 16, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 - }, + } + ], + "attributes": [ { - "name": "GetUserType", - "code": 21, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "source": "client", + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "SetRfid", - "code": 22, + "name": "AddWiFiNetworkResponse", + "code": 3, "mfgCode": null, - "source": "client", - "incoming": 1, + "source": "server", + "incoming": 0, "outgoing": 1 }, { - "name": "GetRfid", - "code": 23, + "name": "UpdateWiFiNetworkResponse", + "code": 5, "mfgCode": null, - "source": "client", + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "AddThreadNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UpdateThreadNetworkResponse", + "code": 9, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveNetworkResponse", + "code": 11, + "mfgCode": null, + "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "ClearRfid", - "code": 24, + "name": "EnableNetworkResponse", + "code": 13, "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "ClearAllRfids", - "code": 25, + "name": "DisableNetworkResponse", + "code": 15, "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 } @@ -1176,12 +1407,12 @@ "name": "cluster revision", "code": 65533, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -1194,90 +1425,301 @@ "code": 257, "mfgCode": null, "define": "DOOR_LOCK_CLUSTER", - "side": "server", + "side": "client", "enabled": 0, "commands": [ { - "name": "LockDoorResponse", + "name": "LockDoor", "code": 0, "mfgCode": null, - "source": "server", + "source": "client", "incoming": 1, "outgoing": 1 }, { - "name": "UnlockDoorResponse", + "name": "UnlockDoor", "code": 1, "mfgCode": null, - "source": "server", + "source": "client", "incoming": 1, "outgoing": 1 - } - ], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "UnlockWithTimeout", + "code": 3, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "lock state", - "code": 0, + "name": "GetLogRecord", + "code": 4, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "lock type", - "code": 1, + "name": "SetPin", + "code": 5, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "actuator enabled", - "code": 2, + "name": "GetPin", + "code": 6, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "door state", - "code": 3, + "name": "ClearPin", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearAllPins", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetWeekdaySchedule", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetWeekdaySchedule", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearWeekdaySchedule", + "code": 13, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetYeardaySchedule", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetYeardaySchedule", + "code": 15, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearYeardaySchedule", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetHolidaySchedule", + "code": 17, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetHolidaySchedule", + "code": 18, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearHolidaySchedule", + "code": 19, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetUserType", + "code": 20, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetUserType", + "code": 21, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetRfid", + "code": 22, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetRfid", + "code": 23, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearRfid", + "code": 24, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearAllRfids", + "code": 25, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Door Lock", + "code": 257, + "mfgCode": null, + "define": "DOOR_LOCK_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "LockDoorResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "UnlockDoorResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "lock state", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "lock type", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "actuator enabled", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "door state", + "code": 3, "mfgCode": null, "side": "server", "included": 0, @@ -1701,7 +2143,7 @@ "mfgCode": null, "define": "BARRIER_CONTROL_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { @@ -1926,7 +2368,7 @@ "mfgCode": null, "define": "COLOR_CONTROL_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { @@ -2728,7 +3170,7 @@ "mfgCode": null, "define": "TEMP_MEASUREMENT_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [], "attributes": [ { @@ -2849,7 +3291,7 @@ "mfgCode": null, "define": "IAS_ZONE_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "ZoneStatusChangeNotification", @@ -2960,22 +3402,24 @@ "reportableChange": 0 } ] - } - ] - }, - { - "name": "Anonymous Endpoint Type", - "deviceTypeName": "CHIP-All-Clusters-Server", - "deviceTypeCode": 0, - "deviceTypeProfileId": 259, - "clusters": [ + }, { - "name": "Identify", - "code": 3, + "name": "Low Power", + "code": 1288, "mfgCode": null, - "define": "IDENTIFY_CLUSTER", + "define": "LOW_POWER_CLUSTER", "side": "client", "enabled": 0, + "commands": [ + { + "name": "Sleep", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], "attributes": [ { "name": "cluster revision", @@ -2986,39 +3430,22 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 } - ], - "commands": [ - { - "name": "Identify", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "IdentifyQuery", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } ] }, { - "name": "Identify", - "code": 3, + "name": "Low Power", + "code": 1288, "mfgCode": null, - "define": "IDENTIFY_CLUSTER", + "define": "LOW_POWER_CLUSTER", "side": "server", "enabled": 1, + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3029,96 +3456,22 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "identify time", - "code": 0, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 } - ], - "commands": [ - { - "name": "IdentifyQueryResponse", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } ] }, { - "name": "Groups", - "code": 4, + "name": "Application Basic", + "code": 1293, "mfgCode": null, - "define": "GROUPS_CLUSTER", + "define": "APPLICATION_BASIC_CLUSTER", "side": "client", "enabled": 0, - "commands": [ - { - "name": "AddGroup", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "ViewGroup", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "GetGroupMembership", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RemoveGroup", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RemoveAllGroups", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "AddGroupIfIdentifying", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3129,7 +3482,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3138,65 +3491,107 @@ ] }, { - "name": "Groups", - "code": 4, + "name": "Application Basic", + "code": 1293, "mfgCode": null, - "define": "GROUPS_CLUSTER", + "define": "APPLICATION_BASIC_CLUSTER", "side": "server", "enabled": 1, - "commands": [ + "commands": [], + "attributes": [ { - "name": "AddGroupResponse", + "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": "vendor name", "code": 0, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "ViewGroupResponse", + "name": "vendor id", "code": 1, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "GetGroupMembershipResponse", + "name": "application name", "code": 2, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "RemoveGroupResponse", + "name": "product id", "code": 3, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { - "name": "cluster revision", - "code": 65533, + "name": "application id", + "code": 5, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "name support", - "code": 0, + "name": "catalog vendor id", + "code": 6, "mfgCode": null, "side": "server", "included": 1, @@ -3208,19 +3603,34 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + }, + { + "name": "application satus", + "code": 7, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] }, { - "name": "Scenes", - "code": 5, + "name": "Binding", + "code": 61440, "mfgCode": null, - "define": "SCENES_CLUSTER", + "define": "BINDING_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "AddScene", + "name": "Bind", "code": 0, "mfgCode": null, "source": "client", @@ -3228,52 +3638,12 @@ "outgoing": 1 }, { - "name": "ViewScene", + "name": "Unbind", "code": 1, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 - }, - { - "name": "RemoveScene", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RemoveAllScenes", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StoreScene", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RecallScene", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "GetSceneMembership", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 } ], "attributes": [ @@ -3286,7 +3656,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3295,62 +3665,13 @@ ] }, { - "name": "Scenes", - "code": 5, + "name": "Binding", + "code": 61440, "mfgCode": null, - "define": "SCENES_CLUSTER", + "define": "BINDING_CLUSTER", "side": "server", "enabled": 1, - "commands": [ - { - "name": "AddSceneResponse", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "ViewSceneResponse", - "code": 1, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RemoveSceneResponse", - "code": 2, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RemoveAllScenesResponse", - "code": 3, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StoreSceneResponse", - "code": 4, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "GetSceneMembershipResponse", - "code": 6, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3361,75 +3682,82 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "scene count", - "code": 0, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Group Key Management", + "code": 61444, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "current scene", - "code": 1, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "side": "server", + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Group Key Management", + "code": 61444, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ { - "name": "current group", - "code": 2, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "scene valid", - "code": 3, + "name": "groups", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "name support", - "code": 4, + "name": "group keys", + "code": 1, "mfgCode": null, "side": "server", "included": 1, @@ -3443,14 +3771,40 @@ "reportableChange": 0 } ] - }, + } + ] + }, + { + "name": "Anonymous Endpoint Type", + "deviceTypeName": null, + "deviceTypeCode": null, + "deviceTypeProfileId": null, + "clusters": [ { - "name": "On/off", - "code": 6, + "name": "Identify", + "code": 3, "mfgCode": null, - "define": "ON_OFF_CLUSTER", + "define": "IDENTIFY_CLUSTER", "side": "client", "enabled": 0, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "IdentifyQuery", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], "attributes": [ { "name": "cluster revision", @@ -3467,42 +3821,25 @@ "maxInterval": 65344, "reportableChange": 0 } - ], + ] + }, + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 0, "commands": [ { - "name": "Off", + "name": "IdentifyQueryResponse", "code": 0, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "On", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "Toggle", - "code": 2, - "mfgCode": null, - "source": "client", + "source": "server", "incoming": 1, "outgoing": 1 } - ] - }, - { - "name": "On/off", - "code": 6, - "mfgCode": null, - "define": "ON_OFF_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], + ], "attributes": [ { "name": "cluster revision", @@ -3520,7 +3857,7 @@ "reportableChange": 0 }, { - "name": "on/off", + "name": "identify time", "code": 0, "mfgCode": null, "side": "server", @@ -3528,8 +3865,8 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, + "defaultValue": "0x0000", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -3537,15 +3874,15 @@ ] }, { - "name": "Level Control", - "code": 8, + "name": "Groups", + "code": 4, "mfgCode": null, - "define": "LEVEL_CONTROL_CLUSTER", + "define": "GROUPS_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "MoveToLevel", + "name": "AddGroup", "code": 0, "mfgCode": null, "source": "client", @@ -3553,7 +3890,7 @@ "outgoing": 1 }, { - "name": "Move", + "name": "ViewGroup", "code": 1, "mfgCode": null, "source": "client", @@ -3561,7 +3898,7 @@ "outgoing": 1 }, { - "name": "Step", + "name": "GetGroupMembership", "code": 2, "mfgCode": null, "source": "client", @@ -3569,7 +3906,7 @@ "outgoing": 1 }, { - "name": "Stop", + "name": "RemoveGroup", "code": 3, "mfgCode": null, "source": "client", @@ -3577,7 +3914,7 @@ "outgoing": 1 }, { - "name": "MoveToLevelWithOnOff", + "name": "RemoveAllGroups", "code": 4, "mfgCode": null, "source": "client", @@ -3585,28 +3922,12 @@ "outgoing": 1 }, { - "name": "MoveWithOnOff", + "name": "AddGroupIfIdentifying", "code": 5, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 - }, - { - "name": "StepWithOnOff", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StopWithOnOff", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 } ], "attributes": [ @@ -3628,13 +3949,46 @@ ] }, { - "name": "Level Control", - "code": 8, + "name": "Groups", + "code": 4, "mfgCode": null, - "define": "LEVEL_CONTROL_CLUSTER", + "define": "GROUPS_CLUSTER", "side": "server", - "enabled": 1, - "commands": [], + "enabled": 0, + "commands": [ + { + "name": "AddGroupResponse", + "code": 0, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ViewGroupResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetGroupMembershipResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveGroupResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], "attributes": [ { "name": "cluster revision", @@ -3652,7 +4006,7 @@ "reportableChange": 0 }, { - "name": "current level", + "name": "name support", "code": 0, "mfgCode": null, "side": "server", @@ -3660,8 +4014,8 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -3669,20 +4023,68 @@ ] }, { - "name": "Basic", - "code": 40, + "name": "Scenes", + "code": 5, "mfgCode": null, - "define": "BASIC_CLUSTER", + "define": "SCENES_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "MfgSpecificPing", + "name": "AddScene", "code": 0, - "mfgCode": "4098", + "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 0 + "outgoing": 1 + }, + { + "name": "ViewScene", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveScene", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RemoveAllScenes", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StoreScene", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "RecallScene", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetSceneMembership", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 } ], "attributes": [ @@ -3693,7 +4095,7 @@ "side": "client", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, "defaultValue": "3", "reportable": 0, @@ -3704,15 +4106,15 @@ ] }, { - "name": "Basic", - "code": 40, + "name": "Scenes", + "code": 5, "mfgCode": null, - "define": "BASIC_CLUSTER", + "define": "SCENES_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [ { - "name": "StartUp", + "name": "AddSceneResponse", "code": 0, "mfgCode": null, "source": "server", @@ -3720,7 +4122,7 @@ "outgoing": 1 }, { - "name": "ShutDown", + "name": "ViewSceneResponse", "code": 1, "mfgCode": null, "source": "server", @@ -3728,12 +4130,36 @@ "outgoing": 1 }, { - "name": "Leave", + "name": "RemoveSceneResponse", "code": 2, "mfgCode": null, "source": "server", "incoming": 1, "outgoing": 1 + }, + { + "name": "RemoveAllScenesResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StoreSceneResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetSceneMembershipResponse", + "code": 6, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 } ], "attributes": [ @@ -3744,7 +4170,7 @@ "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, "defaultValue": "3", "reportable": 0, @@ -3753,166 +4179,300 @@ "reportableChange": 0 }, { - "name": "InteractionModelVersion", + "name": "scene count", "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "VendorName", + "name": "current scene", "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "VendorID", + "name": "current group", "code": 2, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "ProductName", + "name": "scene valid", "code": 3, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "ProductID", + "name": "name support", "code": 4, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Off", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "UserLabel", - "code": 5, + "name": "On", + "code": 1, "mfgCode": null, - "side": "server", + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "Toggle", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, - { - "name": "Location", - "code": 6, - "mfgCode": null, - "side": "server", - "included": 1, + } + ] + }, + { + "name": "On/off", + "code": 6, + "mfgCode": null, + "define": "ON_OFF_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "HardwareVersion", - "code": 7, + "name": "on/off", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, "defaultValue": "0x00", - "reportable": 0, + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MoveToLevel", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "HardwareVersionString", - "code": 8, + "name": "Move", + "code": 1, "mfgCode": null, - "side": "server", + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "Step", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "Stop", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveToLevelWithOnOff", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveWithOnOff", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StepWithOnOff", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StopWithOnOff", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Level Control", + "code": 8, + "mfgCode": null, + "define": "LEVEL_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "SoftwareVersion", - "code": 9, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "SoftwareVersionString", - "code": 10, + "name": "current level", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 1, + "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x00", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -3920,38 +4480,13 @@ ] }, { - "name": "General Commissioning", - "code": 48, + "name": "Basic", + "code": 40, "mfgCode": null, - "define": "GENERAL_COMMISSIONING_CLUSTER", + "define": "BASIC_CLUSTER", "side": "client", "enabled": 0, - "commands": [ - { - "name": "SetFabric", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "ArmFailSafe", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "CommissioningComplete", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3960,9 +4495,9 @@ "side": "client", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3971,32 +4506,32 @@ ] }, { - "name": "General Commissioning", - "code": 48, + "name": "Basic", + "code": 40, "mfgCode": null, - "define": "GENERAL_COMMISSIONING_CLUSTER", + "define": "BASIC_CLUSTER", "side": "server", "enabled": 1, "commands": [ { - "name": "SetFabricResponse", - "code": 1, + "name": "StartUp", + "code": 0, "mfgCode": null, "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "ArmFailSafeResponse", - "code": 3, + "name": "ShutDown", + "code": 1, "mfgCode": null, "source": "server", "incoming": 1, "outgoing": 1 }, { - "name": "CommissioningCompleteResponse", - "code": 7, + "name": "Leave", + "code": 2, "mfgCode": null, "source": "server", "incoming": 1, @@ -4011,229 +4546,174 @@ "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "FabricId", + "name": "InteractionModelVersion", "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, - "defaultValue": "o", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "Breadcrumb", + "name": "VendorName", "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Network Commissioning", - "code": 49, - "mfgCode": null, - "define": "NETWORK_COMMISSIONING_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ - { - "name": "ScanNetworks", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 }, { - "name": "AddWiFiNetwork", + "name": "VendorID", "code": 2, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "UpdateWiFiNetwork", - "code": 4, + "name": "ProductName", + "code": 3, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "AddThreadNetwork", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "UpdateThreadNetwork", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "RemoveNetwork", - "code": 10, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "EnableNetwork", - "code": 12, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "DisableNetwork", - "code": 14, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "GetLastNetworkCommissioningResult", - "code": 16, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Network Commissioning", - "code": 49, - "mfgCode": null, - "define": "NETWORK_COMMISSIONING_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "ScanNetworksResponse", - "code": 1, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 }, { - "name": "AddWiFiNetworkResponse", - "code": 3, + "name": "ProductID", + "code": 4, "mfgCode": null, - "source": "server", - "incoming": 0, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "UpdateWiFiNetworkResponse", + "name": "UserLabel", "code": 5, "mfgCode": null, - "source": "server", - "incoming": 0, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "AddThreadNetworkResponse", - "code": 7, + "name": "Location", + "code": 6, "mfgCode": null, - "source": "server", - "incoming": 0, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "UpdateThreadNetworkResponse", - "code": 9, + "name": "HardwareVersion", + "code": 7, "mfgCode": null, - "source": "server", - "incoming": 0, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "RemoveNetworkResponse", - "code": 11, + "name": "HardwareVersionString", + "code": 8, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "EnableNetworkResponse", - "code": 13, + "name": "SoftwareVersion", + "code": 9, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "DisableNetworkResponse", - "code": 15, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, + "name": "SoftwareVersionString", + "code": 10, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", - "singleton": 0, + "singleton": 1, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -4458,7 +4938,7 @@ "mfgCode": null, "define": "DOOR_LOCK_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [ { "name": "LockDoorResponse", @@ -4502,7 +4982,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4783,658 +5263,208 @@ "code": 52, "mfgCode": null, "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "alarm mask", - "code": 64, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "keypad operation event mask", - "code": 65, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "RF operation event mask", - "code": 66, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "manual operation event mask", - "code": 67, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "rfid operation event mask", - "code": 68, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "keypad programming event mask", - "code": 69, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "rf programming event mask", - "code": 70, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "rfid programming event mask", - "code": 71, - "mfgCode": null, - "side": "server", - "included": 0, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, - { - "name": "Barrier Control", - "code": 259, - "mfgCode": null, - "define": "BARRIER_CONTROL_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ - { - "name": "BarrierControlGoToPercent", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "BarrierControlStop", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "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": "Barrier Control", - "code": 259, - "mfgCode": null, - "define": "BARRIER_CONTROL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "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": "barrier moving state", - "code": 1, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "barrier safety status", - "code": 2, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "barrier capabilities", - "code": 3, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "barrier position", - "code": 10, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ], - "commands": [] - }, - { - "name": "Color Control", - "code": 768, - "mfgCode": null, - "define": "COLOR_CONTROL_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ - { - "name": "MoveToHue", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveHue", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StepHue", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveToSaturation", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveSaturation", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StepSaturation", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveToHueAndSaturation", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveToColor", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveColor", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StepColor", - "code": 9, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveToColorTemperature", - "code": 10, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StopMoveStep", - "code": 71, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "MoveColorTemperature", - "code": 75, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StepColorTemperature", - "code": 76, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, - { - "name": "Color Control", - "code": 768, - "mfgCode": null, - "define": "COLOR_CONTROL_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "3", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "current hue", - "code": 0, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "current saturation", - "code": 1, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "remaining time", - "code": 2, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "current x", - "code": 3, - "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x616B", - "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, - { - "name": "current y", - "code": 4, - "mfgCode": null, - "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x607D", + "defaultValue": "0x00", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "drift compensation", - "code": 5, + "name": "alarm mask", + "code": 64, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "compensation text", - "code": 6, + "name": "keypad operation event mask", + "code": 65, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color temperature", - "code": 7, + "name": "RF operation event mask", + "code": 66, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00FA", + "defaultValue": "0x0000", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color mode", - "code": 8, + "name": "manual operation event mask", + "code": 67, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color control options", - "code": 15, + "name": "rfid operation event mask", + "code": 68, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "number of primaries", - "code": 16, + "name": "keypad programming event mask", + "code": 69, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 1 x", - "code": 17, + "name": "rf programming event mask", + "code": 70, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 1 y", - "code": 18, + "name": "rfid programming event mask", + "code": 71, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x0000", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + } + ] + }, + { + "name": "Barrier Control", + "code": 259, + "mfgCode": null, + "define": "BARRIER_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "BarrierControlGoToPercent", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "primary 1 intensity", - "code": 19, + "name": "BarrierControlStop", + "code": 1, "mfgCode": null, - "side": "server", + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "cluster revision", + "code": 65533, + "mfgCode": null, + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Barrier Control", + "code": 259, + "mfgCode": null, + "define": "BARRIER_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "primary 2 x", - "code": 21, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0001", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 2 y", - "code": 22, + "name": "barrier moving state", + "code": 1, "mfgCode": null, "side": "server", "included": 1, @@ -5448,8 +5478,8 @@ "reportableChange": 0 }, { - "name": "primary 2 intensity", - "code": 23, + "name": "barrier safety status", + "code": 2, "mfgCode": null, "side": "server", "included": 1, @@ -5463,8 +5493,8 @@ "reportableChange": 0 }, { - "name": "primary 3 x", - "code": 25, + "name": "barrier capabilities", + "code": 3, "mfgCode": null, "side": "server", "included": 1, @@ -5478,8 +5508,8 @@ "reportableChange": 0 }, { - "name": "primary 3 y", - "code": 26, + "name": "barrier position", + "code": 10, "mfgCode": null, "side": "server", "included": 1, @@ -5491,145 +5521,250 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + } + ] + }, + { + "name": "Color Control", + "code": 768, + "mfgCode": null, + "define": "COLOR_CONTROL_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "MoveToHue", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveHue", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StepHue", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveToSaturation", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveSaturation", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StepSaturation", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveToHueAndSaturation", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveToColor", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveColor", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StepColor", + "code": 9, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "MoveToColorTemperature", + "code": 10, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "StopMoveStep", + "code": 71, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "primary 3 intensity", - "code": 27, + "name": "MoveColorTemperature", + "code": 75, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 + "source": "client", + "incoming": 1, + "outgoing": 1 }, { - "name": "primary 4 x", - "code": 32, + "name": "StepColorTemperature", + "code": 76, "mfgCode": null, - "side": "server", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - }, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ { - "name": "primary 4 y", - "code": 33, + "name": "cluster revision", + "code": 65533, "mfgCode": null, - "side": "server", + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Color Control", + "code": 768, + "mfgCode": null, + "define": "COLOR_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ { - "name": "primary 4 intensity", - "code": 34, + "name": "cluster revision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 5 x", - "code": 36, + "name": "current hue", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x00", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 5 y", - "code": 37, + "name": "current saturation", + "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x00", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 5 intensity", - "code": 38, + "name": "remaining time", + "code": 2, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 6 x", - "code": 40, + "name": "current x", + "code": 3, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x616B", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 6 y", - "code": 41, + "name": "current y", + "code": 4, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x607D", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "primary 6 intensity", - "code": 42, + "name": "drift compensation", + "code": 5, "mfgCode": null, "side": "server", "included": 1, @@ -5643,8 +5778,8 @@ "reportableChange": 0 }, { - "name": "white point x", - "code": 48, + "name": "compensation text", + "code": 6, "mfgCode": null, "side": "server", "included": 1, @@ -5658,53 +5793,53 @@ "reportableChange": 0 }, { - "name": "white point y", - "code": 49, + "name": "color temperature", + "code": 7, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", - "reportable": 0, + "defaultValue": "0x00FA", + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r x", - "code": 50, + "name": "color mode", + "code": 8, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x01", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r y", - "code": 51, + "name": "color control options", + "code": 15, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color point r intensity", - "code": 52, + "name": "number of primaries", + "code": 16, "mfgCode": null, "side": "server", "included": 1, @@ -5718,8 +5853,8 @@ "reportableChange": 0 }, { - "name": "color point g x", - "code": 54, + "name": "primary 1 x", + "code": 17, "mfgCode": null, "side": "server", "included": 1, @@ -5733,8 +5868,8 @@ "reportableChange": 0 }, { - "name": "color point g y", - "code": 55, + "name": "primary 1 y", + "code": 18, "mfgCode": null, "side": "server", "included": 1, @@ -5748,8 +5883,8 @@ "reportableChange": 0 }, { - "name": "color point g intensity", - "code": 56, + "name": "primary 1 intensity", + "code": 19, "mfgCode": null, "side": "server", "included": 1, @@ -5763,8 +5898,8 @@ "reportableChange": 0 }, { - "name": "color point b x", - "code": 58, + "name": "primary 2 x", + "code": 21, "mfgCode": null, "side": "server", "included": 1, @@ -5778,8 +5913,8 @@ "reportableChange": 0 }, { - "name": "color point b y", - "code": 59, + "name": "primary 2 y", + "code": 22, "mfgCode": null, "side": "server", "included": 1, @@ -5793,8 +5928,8 @@ "reportableChange": 0 }, { - "name": "color point b intensity", - "code": 60, + "name": "primary 2 intensity", + "code": 23, "mfgCode": null, "side": "server", "included": 1, @@ -5808,8 +5943,8 @@ "reportableChange": 0 }, { - "name": "couple color temp to level min-mireds", - "code": 16397, + "name": "primary 3 x", + "code": 25, "mfgCode": null, "side": "server", "included": 1, @@ -5823,8 +5958,8 @@ "reportableChange": 0 }, { - "name": "start up color temperature mireds", - "code": 16400, + "name": "primary 3 y", + "code": 26, "mfgCode": null, "side": "server", "included": 1, @@ -5838,333 +5973,248 @@ "reportableChange": 0 }, { - "name": "enhanced current hue", - "code": 16384, + "name": "primary 3 intensity", + "code": 27, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "enhanced color mode", - "code": 16385, + "name": "primary 4 x", + "code": 32, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color loop active", - "code": 16386, + "name": "primary 4 y", + "code": 33, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color loop direction", - "code": 16387, + "name": "primary 4 intensity", + "code": 34, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color loop time", - "code": 16388, + "name": "primary 5 x", + "code": 36, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0019", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color capabilities", - "code": 16394, + "name": "primary 5 y", + "code": 37, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color temp physical min", - "code": 16395, + "name": "primary 5 intensity", + "code": 38, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "color temp physical max", - "code": 16396, + "name": "primary 6 x", + "code": 40, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xFEFF", - "reportable": 0, - "minInterval": 0, - "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, - { - "name": "Temperature Measurement", - "code": 1026, - "mfgCode": null, - "define": "TEMP_MEASUREMENT_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": "3", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, - "reportableChange": 0 - } - ] - }, - { - "name": "Temperature Measurement", - "code": 1026, - "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ + "reportableChange": 0 + }, { - "name": "cluster revision", - "code": 65533, + "name": "primary 6 y", + "code": 41, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "measured value", - "code": 0, + "name": "primary 6 intensity", + "code": 42, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", - "reportable": 1, + "defaultValue": "", + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "min measured value", - "code": 1, + "name": "white point x", + "code": 48, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "max measured value", - "code": 2, + "name": "white point y", + "code": 49, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "tolerance", - "code": 3, + "name": "color point r x", + "code": 50, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "IAS Zone", - "code": 1280, - "mfgCode": null, - "define": "IAS_ZONE_CLUSTER", - "side": "client", - "enabled": 0, - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "color point r y", + "code": 51, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ], - "commands": [ - { - "name": "ZoneEnrollResponse", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ] - }, - { - "name": "IAS Zone", - "code": 1280, - "mfgCode": null, - "define": "IAS_ZONE_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "ZoneStatusChangeNotification", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 }, { - "name": "ZoneEnrollRequest", - "code": 1, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, + "name": "color point r intensity", + "code": 52, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "zone state", - "code": 0, + "name": "color point g x", + "code": 54, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "zone type", - "code": 1, + "name": "color point g y", + "code": 55, "mfgCode": null, "side": "server", "included": 1, @@ -6178,23 +6228,23 @@ "reportableChange": 0 }, { - "name": "zone status", - "code": 2, + "name": "color point g intensity", + "code": 56, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "IAS CIE address", - "code": 16, + "name": "color point b x", + "code": 58, "mfgCode": null, "side": "server", "included": 1, @@ -6208,265 +6258,195 @@ "reportableChange": 0 }, { - "name": "Zone ID", - "code": 17, + "name": "color point b y", + "code": 59, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0xff", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Low Power", - "code": 1288, - "mfgCode": null, - "define": "LOW_POWER_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ - { - "name": "Sleep", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "color point b intensity", + "code": 60, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Low Power", - "code": 1288, - "mfgCode": null, - "define": "LOW_POWER_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "couple color temp to level min-mireds", + "code": 16397, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Application Basic", - "code": 1293, - "mfgCode": null, - "define": "APPLICATION_BASIC_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "start up color temperature mireds", + "code": 16400, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Application Basic", - "code": 1293, - "mfgCode": null, - "define": "APPLICATION_BASIC_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "enhanced current hue", + "code": 16384, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "vendor name", - "code": 0, + "name": "enhanced color mode", + "code": 16385, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x01", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "vendor id", - "code": 1, + "name": "color loop active", + "code": 16386, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "application name", - "code": 2, + "name": "color loop direction", + "code": 16387, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "product id", - "code": 3, + "name": "color loop time", + "code": 16388, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0019", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "application id", - "code": 5, + "name": "color capabilities", + "code": 16394, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "catalog vendor id", - "code": 6, + "name": "color temp physical min", + "code": 16395, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "application satus", - "code": 7, + "name": "color temp physical max", + "code": 16396, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "0xFEFF", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 } - ], - "commands": [] + ] }, { - "name": "Binding", - "code": 61440, + "name": "Temperature Measurement", + "code": 1026, "mfgCode": null, - "define": "BINDING_CLUSTER", + "define": "TEMP_MEASUREMENT_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": "cluster revision", @@ -6477,7 +6457,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -6486,12 +6466,12 @@ ] }, { - "name": "Binding", - "code": 61440, + "name": "Temperature Measurement", + "code": 1026, "mfgCode": null, - "define": "BINDING_CLUSTER", + "define": "TEMP_MEASUREMENT_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [], "attributes": [ { @@ -6503,165 +6483,68 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "3", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Media Playback", - "code": 61441, - "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [ + }, { - "name": "PlayRequest", + "name": "measured value", "code": 0, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x8000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 }, { - "name": "PauseRequest", + "name": "min measured value", "code": 1, "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StopRequest", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StartOverRequest", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "PreviousRequest", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "NextRequest", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RewindRequest", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "FastForwardRequest", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipForwardRequest", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipBackwardRequest", - "code": 9, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0x8000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Media Playback", - "code": 61441, - "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [ - { - "name": "Playback", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "max measured value", + "code": 2, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0x8000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "current state", - "code": 0, + "name": "tolerance", + "code": 3, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -6669,28 +6552,20 @@ ] }, { - "name": "Content Launch", - "code": 61442, + "name": "IAS Zone", + "code": 1280, "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", + "define": "IAS_ZONE_CLUSTER", "side": "client", "enabled": 0, "commands": [ { - "name": "LaunchContent", + "name": "ZoneEnrollResponse", "code": 0, "mfgCode": null, "source": "client", "incoming": 1, "outgoing": 1 - }, - { - "name": "LaunchURL", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 } ], "attributes": [ @@ -6703,7 +6578,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -6712,15 +6587,15 @@ ] }, { - "name": "Content Launch", - "code": 61442, + "name": "IAS Zone", + "code": 1280, "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", + "define": "IAS_ZONE_CLUSTER", "side": "server", - "enabled": 1, + "enabled": 0, "commands": [ { - "name": "LaunchContentResponse", + "name": "ZoneStatusChangeNotification", "code": 0, "mfgCode": null, "source": "server", @@ -6728,7 +6603,7 @@ "outgoing": 1 }, { - "name": "LaunchURLResponse", + "name": "ZoneEnrollRequest", "code": 1, "mfgCode": null, "source": "server", @@ -6746,82 +6621,60 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "2", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Group Key Management", - "code": 61444, - "mfgCode": null, - "define": "GROUP_KEY_MANAGEMENT_CLUSTER", - "side": "client", - "enabled": 0, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "zone state", + "code": 0, "mfgCode": null, - "side": "client", + "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "0x00", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Group Key Management", - "code": 61444, - "mfgCode": null, - "define": "GROUP_KEY_MANAGEMENT_CLUSTER", - "side": "server", - "enabled": 1, - "commands": [], - "attributes": [ + }, { - "name": "cluster revision", - "code": 65533, + "name": "zone type", + "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "groups", - "code": 0, + "name": "zone status", + "code": 2, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0x0000", "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "group keys", - "code": 1, + "name": "IAS CIE address", + "code": 16, "mfgCode": null, "side": "server", "included": 1, @@ -6833,6 +6686,21 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 + }, + { + "name": "Zone ID", + "code": 17, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xff", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] } @@ -6842,17 +6710,18 @@ "endpoints": [ { "endpointTypeName": "Anonymous Endpoint Type", - "endpointTypeIndex": 1, + "endpointTypeIndex": 0, "profileId": "0x0103", "endpointId": 1, "networkId": 0 }, { "endpointTypeName": "Anonymous Endpoint Type", - "endpointTypeIndex": 0, + "endpointTypeIndex": 1, "profileId": "0x0103", "endpointId": 2, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.h b/examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.h +++ b/examples/all-clusters-app/all-clusters-common/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/all-clusters-app/all-clusters-common/gen/af-structs.h b/examples/all-clusters-app/all-clusters-common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/af-structs.h +++ b/examples/all-clusters-app/all-clusters-common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..0c54dfaf662d34 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp @@ -0,0 +1,256 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + case 0x001D: // Descriptor Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (am->attributeId) + { + case 0x0000: // device list + { + entryLength = 6; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + // Struct _DeviceType + _DeviceType * entry = reinterpret_cast<_DeviceType *>(write ? src : dest); + copyListMember(write ? dest : (uint8_t *) &entry->type, write ? (uint8_t *) &entry->type : src, write, &entryOffset, + sizeof(entry->type)); // DEVICE_TYPE_ID + copyListMember(write ? dest : (uint8_t *) &entry->revision, write ? (uint8_t *) &entry->revision : src, write, + &entryOffset, sizeof(entry->revision)); // INT16U + break; + } + case 0x0001: // server list + { + entryLength = 2; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // CLUSTER_ID + break; + } + case 0x0002: // client list + { + entryLength = 2; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // CLUSTER_ID + break; + } + case 0x0003: // parts list + { + entryLength = 1; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // ENDPOINT_ID + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (am->attributeId) + { + case 0x0000: // groups + { + entryLength = 6; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + // Struct _GroupState + _GroupState * entry = reinterpret_cast<_GroupState *>(write ? src : dest); + copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, + &entryOffset, sizeof(entry->VendorId)); // INT16U + copyListMember(write ? dest : (uint8_t *) &entry->VendorGroupId, write ? (uint8_t *) &entry->VendorGroupId : src, write, + &entryOffset, sizeof(entry->VendorGroupId)); // INT16U + copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySetIndex, write ? (uint8_t *) &entry->GroupKeySetIndex : src, + write, &entryOffset, sizeof(entry->GroupKeySetIndex)); // INT16U + break; + } + case 0x0001: // group keys + { + entryLength = 29; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + // Struct _GroupKey + _GroupKey * entry = reinterpret_cast<_GroupKey *>(write ? src : dest); + copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write, + &entryOffset, sizeof(entry->VendorId)); // INT16U + copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyIndex, write ? (uint8_t *) &entry->GroupKeyIndex : src, write, + &entryOffset, sizeof(entry->GroupKeyIndex)); // INT16U + copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyRoot, write ? (uint8_t *) &entry->GroupKeyRoot : src, write, + &entryOffset, 16); // OCTET_STRING + copyListMember(write ? dest : (uint8_t *) &entry->GroupKeyEpochStartTime, + write ? (uint8_t *) &entry->GroupKeyEpochStartTime : src, write, &entryOffset, + sizeof(entry->GroupKeyEpochStartTime)); // INT64U + copyListMember(write ? dest : (uint8_t *) &entry->GroupKeySecurityPolicy, + write ? (uint8_t *) &entry->GroupKeySecurityPolicy : src, write, &entryOffset, + sizeof(entry->GroupKeySecurityPolicy)); // GroupKeySecurityPolicy + break; + } + } + break; + } + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + case 0x001D: // Descriptor Cluster + switch (attributeId) + { + case 0x0000: // device list + // Struct _DeviceType + entryLength = 6; + break; + case 0x0001: // server list + // chip::ClusterId + entryLength = 2; + break; + case 0x0002: // client list + // chip::ClusterId + entryLength = 2; + break; + case 0x0003: // parts list + // chip::EndpointId + entryLength = 1; + break; + } + break; + case 0xF004: // Group Key Management Cluster + switch (attributeId) + { + case 0x0000: // groups + // Struct _GroupState + entryLength = 6; + break; + case 0x0001: // group keys + // Struct _GroupKey + entryLength = 29; + break; + } + break; + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp index 2ccd916d44cbbc..24920f10f3c1a3 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp @@ -33,6 +33,7 @@ EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterComma EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfDescriptorClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGeneralCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGroupKeyManagementClusterServerCommandParse(EmberAfClusterCommand * cmd); @@ -101,6 +102,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) case ZCL_COLOR_CONTROL_CLUSTER_ID: result = emberAfColorControlClusterServerCommandParse(cmd); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + // No commands are enabled for cluster Descriptor + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: result = emberAfDoorLockClusterServerCommandParse(cmd); break; diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp index 78c771016aa1f9..1845be88085c1b 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp @@ -44,6 +44,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_COLOR_CONTROL_CLUSTER_ID: emberAfColorControlClusterInitCallback(endpoint); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + emberAfDescriptorClusterInitCallback(endpoint); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: emberAfDoorLockClusterInitCallback(endpoint); break; @@ -111,6 +114,11 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfDescriptorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/all-clusters-app/all-clusters-common/gen/callback.h b/examples/all-clusters-app/all-clusters-common/gen/callback.h index d368a6e74dd0cd..b8af681d2922cd 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/callback.h +++ b/examples/all-clusters-app/all-clusters-common/gen/callback.h @@ -79,6 +79,14 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint); */ void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Descriptor Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterInitCallback(chip::EndpointId endpoint); + /** @brief Door Lock Cluster Init * * Cluster Init @@ -527,6 +535,76 @@ EmberAfStatus emberAfColorControlClusterServerPreAttributeChangedCallback(chip:: */ void emberAfColorControlClusterServerTickCallback(chip::EndpointId endpoint); +// +// Descriptor Cluster server +// + +/** @brief Descriptor Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Descriptor Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfDescriptorClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Descriptor Cluster Server Manufacturer Specific Attribute Changed + * + * Server Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfDescriptorClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Descriptor Cluster Server Message Sent + * + * Server Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfDescriptorClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Descriptor Cluster Server Pre Attribute Changed + * + * server Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfDescriptorClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Descriptor Cluster Server Tick + * + * server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDescriptorClusterServerTickCallback(chip::EndpointId endpoint); + // // Door Lock Cluster server // diff --git a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h index 44504b93d97ac0..6f6f31f224f3d1 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h @@ -26,43 +26,107 @@ #if BIGENDIAN_CPU #define GENERATED_DEFAULTS \ { \ - /* 0 - Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ \ + /* 0 - Default for cluster: "Descriptor", attribute: "device list". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 254 - Default for cluster: "Descriptor", attribute: "server list". side: server, big-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 32 - Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ \ + /* 508 - Default for cluster: "Descriptor", attribute: "client list". side: server, big-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 762 - Default for cluster: "Descriptor", attribute: "parts list". side: server, big-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 1016 - Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 1048 - Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 64 - Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ \ + /* 1080 - Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 96 - Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ \ + /* 1112 - Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 112 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ \ + /* 1128 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 176 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ \ + /* 1192 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 180 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ \ + /* 1196 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 244 - Default for cluster: "General Commissioning", attribute: "FabricId". side: server, big-endian */ \ + /* 1260 - Default for cluster: "General Commissioning", attribute: "FabricId". side: server, big-endian */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 252 - Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, big-endian */ \ + /* 1268 - Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 260 - Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ \ + /* 1276 - Default for cluster: "Color Control", attribute: "compensation text". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -78,22 +142,22 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 514 - Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ \ + /* 1530 - Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 522 - Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ \ + /* 1538 - Default for cluster: "Application Basic", attribute: "vendor name". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 554 - Default for cluster: "Application Basic", attribute: "application name". side: server, big-endian */ \ + /* 1570 - Default for cluster: "Application Basic", attribute: "application name". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 586 - Default for cluster: "Application Basic", attribute: "application id". side: server, big-endian */ \ + /* 1602 - Default for cluster: "Application Basic", attribute: "application id". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 618 - Default for cluster: "Group Key Management", attribute: "groups". side: server, big-endian */ \ + /* 1634 - Default for cluster: "Group Key Management", attribute: "groups". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -109,7 +173,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 872 - Default for cluster: "Group Key Management", attribute: "group keys". side: server, big-endian */ \ + /* 1888 - Default for cluster: "Group Key Management", attribute: "group keys". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -125,31 +189,31 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1126 - Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ \ + /* 2142 - Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1158 - Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ \ + /* 2174 - Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1190 - Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ \ + /* 2206 - Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1222 - Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ \ + /* 2238 - Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1238 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ \ + /* 2254 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1302 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ \ + /* 2318 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 1306 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ \ + /* 2322 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -159,43 +223,107 @@ #else // !BIGENDIAN_CPU #define GENERATED_DEFAULTS \ { \ - /* 0 - Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ \ + /* 0 - Default for cluster: "Descriptor", attribute: "device list". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 254 - Default for cluster: "Descriptor", attribute: "server list". side: server, little-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 508 - Default for cluster: "Descriptor", attribute: "client list". side: server, little-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 32 - Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ \ + /* 762 - Default for cluster: "Descriptor", attribute: "parts list". side: server, little-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 1016 - Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 64 - Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ \ + /* 1048 - Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 96 - Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ \ + /* 1080 - Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 1112 - Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 112 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ \ + /* 1128 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 176 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ \ + /* 1192 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 180 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ \ + /* 1196 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 244 - Default for cluster: "General Commissioning", attribute: "FabricId". side: server, little-endian */ \ + /* 1260 - Default for cluster: "General Commissioning", attribute: "FabricId". side: server, little-endian */ \ 1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 252 - Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, little-endian */ \ + /* 1268 - Default for cluster: "General Commissioning", attribute: "Breadcrumb". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 260 - Default for cluster: "Color Control", attribute: "compensation text". side: server, little-endian */ \ + /* 1276 - Default for cluster: "Color Control", attribute: "compensation text". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -211,22 +339,22 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 514 - Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ \ + /* 1530 - Default for cluster: "IAS Zone", attribute: "IAS CIE address". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 522 - Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ \ + /* 1538 - Default for cluster: "Application Basic", attribute: "vendor name". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 554 - Default for cluster: "Application Basic", attribute: "application name". side: server, little-endian */ \ + /* 1570 - Default for cluster: "Application Basic", attribute: "application name". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 586 - Default for cluster: "Application Basic", attribute: "application id". side: server, little-endian */ \ + /* 1602 - Default for cluster: "Application Basic", attribute: "application id". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 618 - Default for cluster: "Group Key Management", attribute: "groups". side: server, little-endian */ \ + /* 1634 - Default for cluster: "Group Key Management", attribute: "groups". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -242,7 +370,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 872 - Default for cluster: "Group Key Management", attribute: "group keys". side: server, little-endian */ \ + /* 1888 - Default for cluster: "Group Key Management", attribute: "group keys". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -258,31 +386,31 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1126 - Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ \ + /* 2142 - Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1158 - Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ \ + /* 2174 - Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1190 - Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ \ + /* 2206 - Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1222 - Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ \ + /* 2238 - Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1238 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ \ + /* 2254 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 1302 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ \ + /* 2318 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 1306 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ \ + /* 2322 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -291,7 +419,7 @@ #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (23) +#define GENERATED_DEFAULTS_COUNT (27) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -319,50 +447,56 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 127 +#define GENERATED_ATTRIBUTE_COUNT 132 #define GENERATED_ATTRIBUTES \ { \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* Identify (server): cluster revision */ \ { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_SIMPLE_DEFAULT(0x0000) }, /* Identify (server): identify time */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Groups (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Groups (server): name support */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Scenes (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): scene count */ \ - { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): current scene */ \ - { 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* Scenes (server): current group */ \ - { 0x0003, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): scene valid */ \ - { 0x0004, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Scenes (server): name support */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Level Control (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Level Control (server): current level */ \ + ZAP_SIMPLE_DEFAULT(0x0000) }, /* Identify (server): identify time */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Groups (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Groups (server): name support */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Scenes (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): scene count */ \ + { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): current scene */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* Scenes (server): current group */ \ + { 0x0003, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Scenes (server): scene valid */ \ + { 0x0004, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Scenes (server): name support */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Level Control (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Level Control (server): current level */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Descriptor (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(0) }, /* Descriptor (server): device list */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(254) }, /* Descriptor (server): server list */ \ + { 0x0002, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(508) }, /* Descriptor (server): client list */ \ + { 0x0003, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(762) }, /* Descriptor (server): parts list */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(3) }, /* Basic (server): cluster revision */ \ { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* Basic (server): InteractionModelVersion */ \ { 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(0) }, /* Basic (server): VendorName */ \ + ZAP_LONG_DEFAULTS_INDEX(1016) }, /* Basic (server): VendorName */ \ { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): VendorID */ \ { 0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(32) }, /* Basic (server): ProductName */ \ + ZAP_LONG_DEFAULTS_INDEX(1048) }, /* Basic (server): ProductName */ \ { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): ProductID */ \ { 0x0005, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(64) }, /* Basic (server): UserLabel */ \ + ZAP_LONG_DEFAULTS_INDEX(1080) }, /* Basic (server): UserLabel */ \ { 0x0006, ZAP_TYPE(CHAR_STRING), 16, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(96) }, /* Basic (server): Location */ \ + ZAP_LONG_DEFAULTS_INDEX(1112) }, /* Basic (server): Location */ \ { 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(0x00) }, /* Basic (server): HardwareVersion */ \ { 0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(112) }, /* Basic (server): HardwareVersionString */ \ + ZAP_LONG_DEFAULTS_INDEX(1128) }, /* Basic (server): HardwareVersionString */ \ { 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(176) }, /* Basic (server): SoftwareVersion */ \ + ZAP_LONG_DEFAULTS_INDEX(1192) }, /* Basic (server): SoftwareVersion */ \ { 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(180) }, /* Basic (server): SoftwareVersionString */ \ - { 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(244) }, /* General Commissioning (server): FabricId */ \ - { 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(252) }, /* General Commissioning (server): Breadcrumb */ \ + ZAP_LONG_DEFAULTS_INDEX(1196) }, /* Basic (server): SoftwareVersionString */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* General Commissioning (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, \ + ZAP_LONG_DEFAULTS_INDEX(1260) }, /* General Commissioning (server): FabricId */ \ + { 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_LONG_DEFAULTS_INDEX(1268) }, /* General Commissioning (server): Breadcrumb */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Network Commissioning (server): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Door Lock (server): cluster revision */ \ { 0x0000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* Door Lock (server): lock state */ \ @@ -381,7 +515,7 @@ { 0x0004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* Color Control (server): current y */ \ { 0x0005, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Color Control (server): drift compensation */ \ { 0x0006, ZAP_TYPE(CHAR_STRING), 254, 0, \ - ZAP_LONG_DEFAULTS_INDEX(260) }, /* Color Control (server): compensation text */ \ + ZAP_LONG_DEFAULTS_INDEX(1276) }, /* Color Control (server): compensation text */ \ { 0x0007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* Color Control (server): color temperature */ \ { 0x0008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Color Control (server): color mode */ \ { 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -450,47 +584,48 @@ { 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* IAS Zone (server): zone type */ \ { 0x0002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* IAS Zone (server): zone status */ \ { 0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(514) }, /* IAS Zone (server): IAS CIE address */ \ - { 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(522) }, /* Application Basic (server): vendor name */ \ - { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): vendor id */ \ - { 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, \ - ZAP_LONG_DEFAULTS_INDEX(554) }, /* Application Basic (server): application name */ \ + ZAP_LONG_DEFAULTS_INDEX(1530) }, /* IAS Zone (server): IAS CIE address */ \ + { 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \ - { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \ + { 0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, \ + ZAP_LONG_DEFAULTS_INDEX(1538) }, /* Application Basic (server): vendor name */ \ + { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): vendor id */ \ + { 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, \ + ZAP_LONG_DEFAULTS_INDEX(1570) }, /* Application Basic (server): application name */ \ + { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \ { 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, \ - ZAP_LONG_DEFAULTS_INDEX(586) }, /* Application Basic (server): application id */ \ - { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \ - { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Application Basic (server): application satus */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(618) }, /* Group Key Management (server): groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(872) }, /* Group Key Management (server): group keys */ \ + ZAP_LONG_DEFAULTS_INDEX(1602) }, /* Application Basic (server): application id */ \ + { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \ + { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Application Basic (server): application satus */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (server): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (server): cluster revision */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \ - { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1634) }, /* Group Key Management (server): groups */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(1888) }, /* Group Key Management (server): group keys */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \ + { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(3) }, /* Basic (server): cluster revision */ \ { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* Basic (server): InteractionModelVersion */ \ { 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(1126) }, /* Basic (server): VendorName */ \ + ZAP_LONG_DEFAULTS_INDEX(2142) }, /* Basic (server): VendorName */ \ { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): VendorID */ \ { 0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(1158) }, /* Basic (server): ProductName */ \ + ZAP_LONG_DEFAULTS_INDEX(2174) }, /* Basic (server): ProductName */ \ { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): ProductID */ \ { 0x0005, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(1190) }, /* Basic (server): UserLabel */ \ + ZAP_LONG_DEFAULTS_INDEX(2206) }, /* Basic (server): UserLabel */ \ { 0x0006, ZAP_TYPE(CHAR_STRING), 16, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(1222) }, /* Basic (server): Location */ \ + ZAP_LONG_DEFAULTS_INDEX(2238) }, /* Basic (server): Location */ \ { 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(0x00) }, /* Basic (server): HardwareVersion */ \ { 0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(1238) }, /* Basic (server): HardwareVersionString */ \ + ZAP_LONG_DEFAULTS_INDEX(2254) }, /* Basic (server): HardwareVersionString */ \ { 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(1302) }, /* Basic (server): SoftwareVersion */ \ + ZAP_LONG_DEFAULTS_INDEX(2318) }, /* Basic (server): SoftwareVersion */ \ { 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \ - ZAP_LONG_DEFAULTS_INDEX(1306) }, /* Basic (server): SoftwareVersionString */ \ + ZAP_LONG_DEFAULTS_INDEX(2322) }, /* Basic (server): SoftwareVersionString */ \ } // This is an array of EmberAfCluster structures. @@ -527,7 +662,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 19 +#define GENERATED_CLUSTER_COUNT 20 #define GENERATED_CLUSTERS \ { \ { 0x0003, \ @@ -561,59 +696,62 @@ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x0028, ZAP_ATTRIBUTE_INDEX(14), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(14), 5, 1018, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ + { \ + 0x0028, ZAP_ATTRIBUTE_INDEX(19), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Basic (server) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(26), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0030, ZAP_ATTRIBUTE_INDEX(31), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: General Commissioning (server) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(29), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Network Commissioning (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(30), \ + ZAP_ATTRIBUTE_INDEX(35), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(34), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(39), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(39), \ + ZAP_ATTRIBUTE_INDEX(44), \ 51, \ 336, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(90), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(95), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(94), \ + ZAP_ATTRIBUTE_INDEX(99), \ 6, \ 16, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(100), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(105), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(101), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(106), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(109), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(114), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { \ - 0xF004, ZAP_ATTRIBUTE_INDEX(110), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF004, ZAP_ATTRIBUTE_INDEX(115), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Group Key Management (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(113), \ + ZAP_ATTRIBUTE_INDEX(118), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { \ - 0x0028, ZAP_ATTRIBUTE_INDEX(115), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0028, ZAP_ATTRIBUTE_INDEX(120), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Basic (server) */ \ } @@ -622,7 +760,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 17, 1286 }, { ZAP_CLUSTER_INDEX(17), 2, 257 }, \ + { ZAP_CLUSTER_INDEX(0), 18, 2304 }, { ZAP_CLUSTER_INDEX(18), 2, 257 }, \ } // Largest attribute size is needed for various buffers @@ -632,7 +770,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (508) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (1543) +#define ATTRIBUTE_MAX_SIZE (2561) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h index 4b14a4f05c80b9..bcc56fb2c568fe 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/gen_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/gen_config.h @@ -34,6 +34,7 @@ #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -78,6 +79,11 @@ #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV +// Use this macro to check if the server side of the Descriptor cluster is included +#define ZCL_USING_DESCRIPTOR_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_DESCRIPTOR_SERVER +#define EMBER_AF_PLUGIN_DESCRIPTOR + // Use this macro to check if the server side of the Door Lock cluster is included #define ZCL_USING_DOOR_LOCK_CLUSTER_SERVER #define EMBER_AF_PLUGIN_DOOR_LOCK_SERVER diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 1ce17f2950b842..063e69d6de5aa5 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -30,6 +30,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify" diff --git a/examples/all-clusters-app/esp32/main/component.mk b/examples/all-clusters-app/esp32/main/component.mk index 7c436b39c25a85..cd199c5bb78c40 100644 --- a/examples/all-clusters-app/esp32/main/component.mk +++ b/examples/all-clusters-app/esp32/main/component.mk @@ -27,6 +27,7 @@ COMPONENT_SRCDIRS := ../third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/gen \ ../third_party/connectedhomeip/src/app/server \ ../third_party/connectedhomeip/src/app/util \ + ../third_party/connectedhomeip/src/app/clusters/descriptor \ ../third_party/connectedhomeip/src/app/clusters/on-off-server \ ../third_party/connectedhomeip/src/app/clusters/level-control \ ../third_party/connectedhomeip/src/app/clusters/identify \ diff --git a/examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.h b/examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.h +++ b/examples/bridge-app/bridge-common/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/bridge-app/bridge-common/gen/af-structs.h b/examples/bridge-app/bridge-common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/bridge-app/bridge-common/gen/af-structs.h +++ b/examples/bridge-app/bridge-common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/bridge-app/bridge-common/gen/attribute-size.cpp b/examples/bridge-app/bridge-common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/bridge-app/bridge-common/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/chip-tool/chip-tool.zap b/examples/chip-tool/chip-tool.zap index 55a9cdbb4cf495..8fb3c35ab90952 100644 --- a/examples/chip-tool/chip-tool.zap +++ b/examples/chip-tool/chip-tool.zap @@ -1,6 +1,5 @@ { - "writeTime": "Thu Mar 11 2021 18:15:06 GMT+0100 (Central European Standard Time)", - "featureLevel": 11, + "featureLevel": 19, "creator": "zap", "keyValuePairs": [ { @@ -19,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -736,6 +735,118 @@ } ] }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_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": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "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": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Basic", "code": 40, @@ -1119,6 +1230,196 @@ } ] }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddWiFiNetwork", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UpdateWiFiNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "AddThreadNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UpdateThreadNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveNetwork", + "code": 10, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "EnableNetwork", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "DisableNetwork", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetLastNetworkCommissioningResult", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "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": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddWiFiNetworkResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "UpdateWiFiNetworkResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "AddThreadNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "UpdateThreadNetworkResponse", + "code": 9, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveNetworkResponse", + "code": 11, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "EnableNetworkResponse", + "code": 13, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "DisableNetworkResponse", + "code": 15, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "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": "Door Lock", "code": 257, @@ -1984,23 +2285,6 @@ "define": "BARRIER_CONTROL_CLUSTER", "side": "client", "enabled": 1, - "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 - } - ], "commands": [ { "name": "BarrierControlGoToPercent", @@ -2018,6 +2302,23 @@ "incoming": 1, "outgoing": 1 } + ], + "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 + } ] }, { @@ -3574,94 +3875,13 @@ ] }, { - "name": "Media Playback", - "code": 61441, + "name": "Group Key Management", + "code": 61444, "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "client", "enabled": 1, - "commands": [ - { - "name": "PlayRequest", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "PauseRequest", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StopRequest", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StartOverRequest", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "PreviousRequest", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "NextRequest", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RewindRequest", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "FastForwardRequest", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipForwardRequest", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipBackwardRequest", - "code": 9, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3681,22 +3901,13 @@ ] }, { - "name": "Media Playback", - "code": 61441, + "name": "Group Key Management", + "code": 61444, "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "server", "enabled": 0, - "commands": [ - { - "name": "Playback", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3714,7 +3925,7 @@ "reportableChange": 0 }, { - "name": "current state", + "name": "groups", "code": 0, "mfgCode": null, "side": "server", @@ -3727,88 +3938,17 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Content Launch", - "code": 61442, - "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "LaunchContent", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "LaunchURL", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "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": "Content Launch", - "code": 61442, - "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", - "side": "server", - "enabled": 0, - "commands": [ - { - "name": "LaunchContentResponse", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 }, { - "name": "LaunchURLResponse", + "name": "group keys", "code": 1, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3827,5 +3967,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 496166d4251e14..ccd1427e1c76cd 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -356,6 +356,73 @@ static void OnIdentifyClusterIdentifyQueryResponse(void * context, uint16_t time command->SetCommandExitStatus(true); } +static void OnNetworkCommissioningClusterAddThreadNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterAddThreadNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterAddWiFiNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterAddWiFiNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterDisableNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterDisableNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterEnableNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterEnableNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterRemoveNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterRemoveNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void +OnNetworkCommissioningClusterScanNetworksResponse(void * context, uint8_t errorCode, uint8_t * debugText, + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterScanNetworksResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterUpdateThreadNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterUpdateThreadNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnNetworkCommissioningClusterUpdateWiFiNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(chipTool, "NetworkCommissioningClusterUpdateWiFiNetworkResponse"); + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + static void OnScenesClusterAddSceneResponse(void * context, uint16_t groupId, uint8_t sceneId) { ChipLogProgress(chipTool, "ScenesClusterAddSceneResponse"); @@ -407,6 +474,94 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u command->SetCommandExitStatus(true); } +static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t count, _DeviceType * entries) +{ + ChipLogProgress(chipTool, "OnDescriptorDeviceListListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "DeviceType[%lu]:", i); + ChipLogProgress(chipTool, " type: %" PRIu32 "", entries[i].type); + ChipLogProgress(chipTool, " revision: %" PRIu16 "", entries[i].revision); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnDescriptorServerListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) +{ + ChipLogProgress(chipTool, "OnDescriptorServerListListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "CLUSTER_ID[%lu]: %" PRIu16 "", i, entries[i]); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnDescriptorClientListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) +{ + ChipLogProgress(chipTool, "OnDescriptorClientListListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "CLUSTER_ID[%lu]: %" PRIu16 "", i, entries[i]); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t count, chip::EndpointId * entries) +{ + ChipLogProgress(chipTool, "OnDescriptorPartsListListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "ENDPOINT_ID[%lu]: %" PRIu8 "", i, entries[i]); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint16_t count, _GroupState * entries) +{ + ChipLogProgress(chipTool, "OnGroupKeyManagementGroupsListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "GroupState[%lu]:", i); + ChipLogProgress(chipTool, " VendorId: %" PRIu16 "", entries[i].VendorId); + ChipLogProgress(chipTool, " VendorGroupId: %" PRIu16 "", entries[i].VendorGroupId); + ChipLogProgress(chipTool, " GroupKeySetIndex: %" PRIu16 "", entries[i].GroupKeySetIndex); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, uint16_t count, _GroupKey * entries) +{ + ChipLogProgress(chipTool, "OnGroupKeyManagementGroupKeysListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + ChipLogProgress(chipTool, "GroupKey[%lu]:", i); + ChipLogProgress(chipTool, " VendorId: %" PRIu16 "", entries[i].VendorId); + ChipLogProgress(chipTool, " GroupKeyIndex: %" PRIu16 "", entries[i].GroupKeyIndex); + ChipLogProgress(chipTool, " GroupKeyRoot: %s", entries[i].GroupKeyRoot); + ChipLogProgress(chipTool, " GroupKeyEpochStartTime: %" PRIu64 "", entries[i].GroupKeyEpochStartTime); + ChipLogProgress(chipTool, " GroupKeySecurityPolicy: %" PRIu8 "", entries[i].GroupKeySecurityPolicy); + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + /*----------------------------------------------------------------------------*\ | Cluster Name | ID | |---------------------------------------------------------------------+--------| @@ -415,12 +570,15 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u | Basic | 0x0028 | | Binding | 0xF000 | | ColorControl | 0x0300 | +| Descriptor | 0x001D | | DoorLock | 0x0101 | | GeneralCommissioning | 0x0030 | +| GroupKeyManagement | 0xF004 | | Groups | 0x0004 | | Identify | 0x0003 | | LevelControl | 0x0008 | | LowPower | 0x0508 | +| NetworkCommissioning | 0x0031 | | OnOff | 0x0006 | | Scenes | 0x0005 | | TemperatureMeasurement | 0x0402 | @@ -431,12 +589,15 @@ constexpr chip::ClusterId kBarrierControlClusterId = 0x0103; constexpr chip::ClusterId kBasicClusterId = 0x0028; constexpr chip::ClusterId kBindingClusterId = 0xF000; constexpr chip::ClusterId kColorControlClusterId = 0x0300; +constexpr chip::ClusterId kDescriptorClusterId = 0x001D; constexpr chip::ClusterId kDoorLockClusterId = 0x0101; constexpr chip::ClusterId kGeneralCommissioningClusterId = 0x0030; +constexpr chip::ClusterId kGroupKeyManagementClusterId = 0xF004; constexpr chip::ClusterId kGroupsClusterId = 0x0004; constexpr chip::ClusterId kIdentifyClusterId = 0x0003; constexpr chip::ClusterId kLevelControlClusterId = 0x0008; constexpr chip::ClusterId kLowPowerClusterId = 0x0508; +constexpr chip::ClusterId kNetworkCommissioningClusterId = 0x0031; constexpr chip::ClusterId kOnOffClusterId = 0x0006; constexpr chip::ClusterId kScenesClusterId = 0x0005; constexpr chip::ClusterId kTemperatureMeasurementClusterId = 0x0402; @@ -4848,48 +5009,27 @@ class ReadColorControlClusterRevision : public ModelCommand }; /*----------------------------------------------------------------------------*\ -| Cluster DoorLock | 0x0101 | +| Cluster Descriptor | 0x001D | |------------------------------------------------------------------------------| | Commands: | | -| * ClearAllPins | 0x08 | -| * ClearAllRfids | 0x19 | -| * ClearHolidaySchedule | 0x13 | -| * ClearPin | 0x07 | -| * ClearRfid | 0x18 | -| * ClearWeekdaySchedule | 0x0D | -| * ClearYeardaySchedule | 0x10 | -| * GetHolidaySchedule | 0x12 | -| * GetLogRecord | 0x04 | -| * GetPin | 0x06 | -| * GetRfid | 0x17 | -| * GetUserType | 0x15 | -| * GetWeekdaySchedule | 0x0C | -| * GetYeardaySchedule | 0x0F | -| * LockDoor | 0x00 | -| * SetHolidaySchedule | 0x11 | -| * SetPin | 0x05 | -| * SetRfid | 0x16 | -| * SetUserType | 0x14 | -| * SetWeekdaySchedule | 0x0B | -| * SetYeardaySchedule | 0x0E | -| * UnlockDoor | 0x01 | -| * UnlockWithTimeout | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | -| * LockState | 0x0000 | -| * LockType | 0x0001 | -| * ActuatorEnabled | 0x0002 | +| * DeviceList | 0x0000 | +| * ServerList | 0x0001 | +| * ClientList | 0x0002 | +| * PartsList | 0x0003 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ /* - * Command ClearAllPins + * Discover Attributes */ -class DoorLockClearAllPins : public ModelCommand +class DiscoverDescriptorAttributes : public ModelCommand { public: - DoorLockClearAllPins() : ModelCommand("clear-all-pins") { ModelCommand::AddArguments(); } - ~DoorLockClearAllPins() + DiscoverDescriptorAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverDescriptorAttributes() { delete onSuccessCallback; delete onFailureCallback; @@ -4897,28 +5037,33 @@ class DoorLockClearAllPins : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x08) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearAllPins(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDoorLockClusterClearAllPinsResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; /* - * Command ClearAllRfids + * Attribute DeviceList */ -class DoorLockClearAllRfids : public ModelCommand +class ReadDescriptorDeviceList : public ModelCommand { public: - DoorLockClearAllRfids() : ModelCommand("clear-all-rfids") { ModelCommand::AddArguments(); } - ~DoorLockClearAllRfids() + ReadDescriptorDeviceList() : ModelCommand("read") + { + AddArgument("attr-name", "device-list"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorDeviceList() { delete onSuccessCallback; delete onFailureCallback; @@ -4926,32 +5071,33 @@ class DoorLockClearAllRfids : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x19) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearAllRfids(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.ReadAttributeDeviceList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDoorLockClusterClearAllRfidsResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorDeviceListListAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; /* - * Command ClearHolidaySchedule + * Attribute ServerList */ -class DoorLockClearHolidaySchedule : public ModelCommand +class ReadDescriptorServerList : public ModelCommand { public: - DoorLockClearHolidaySchedule() : ModelCommand("clear-holiday-schedule") + ReadDescriptorServerList() : ModelCommand("read") { - AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId); + AddArgument("attr-name", "server-list"); ModelCommand::AddArguments(); } - ~DoorLockClearHolidaySchedule() + + ~ReadDescriptorServerList() { delete onSuccessCallback; delete onFailureCallback; @@ -4959,34 +5105,33 @@ class DoorLockClearHolidaySchedule : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x13) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearHolidaySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mScheduleId); + return cluster.ReadAttributeServerList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback( - OnDoorLockClusterClearHolidayScheduleResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorServerListListAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mScheduleId; }; /* - * Command ClearPin + * Attribute ClientList */ -class DoorLockClearPin : public ModelCommand +class ReadDescriptorClientList : public ModelCommand { public: - DoorLockClearPin() : ModelCommand("clear-pin") + ReadDescriptorClientList() : ModelCommand("read") { - AddArgument("userId", 0, UINT16_MAX, &mUserId); + AddArgument("attr-name", "client-list"); ModelCommand::AddArguments(); } - ~DoorLockClearPin() + + ~ReadDescriptorClientList() { delete onSuccessCallback; delete onFailureCallback; @@ -4994,33 +5139,33 @@ class DoorLockClearPin : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x07) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearPin(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId); + return cluster.ReadAttributeClientList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDoorLockClusterClearPinResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorClientListListAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint16_t mUserId; }; /* - * Command ClearRfid + * Attribute PartsList */ -class DoorLockClearRfid : public ModelCommand +class ReadDescriptorPartsList : public ModelCommand { public: - DoorLockClearRfid() : ModelCommand("clear-rfid") + ReadDescriptorPartsList() : ModelCommand("read") { - AddArgument("userId", 0, UINT16_MAX, &mUserId); + AddArgument("attr-name", "parts-list"); ModelCommand::AddArguments(); } - ~DoorLockClearRfid() + + ~ReadDescriptorPartsList() { delete onSuccessCallback; delete onFailureCallback; @@ -5028,34 +5173,33 @@ class DoorLockClearRfid : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x18) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearRfid(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId); + return cluster.ReadAttributePartsList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDoorLockClusterClearRfidResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorPartsListListAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint16_t mUserId; }; /* - * Command ClearWeekdaySchedule + * Attribute ClusterRevision */ -class DoorLockClearWeekdaySchedule : public ModelCommand +class ReadDescriptorClusterRevision : public ModelCommand { public: - DoorLockClearWeekdaySchedule() : ModelCommand("clear-weekday-schedule") + ReadDescriptorClusterRevision() : ModelCommand("read") { - AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId); - AddArgument("userId", 0, UINT16_MAX, &mUserId); + AddArgument("attr-name", "cluster-revision"); ModelCommand::AddArguments(); } - ~DoorLockClearWeekdaySchedule() + + ~ReadDescriptorClusterRevision() { delete onSuccessCallback; delete onFailureCallback; @@ -5063,30 +5207,260 @@ class DoorLockClearWeekdaySchedule : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x0D) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::DoorLockCluster cluster; + chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - return cluster.ClearWeekdaySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mScheduleId, mUserId); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback( - OnDoorLockClusterClearWeekdayScheduleResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mScheduleId; - uint16_t mUserId; }; +/*----------------------------------------------------------------------------*\ +| Cluster DoorLock | 0x0101 | +|------------------------------------------------------------------------------| +| Commands: | | +| * ClearAllPins | 0x08 | +| * ClearAllRfids | 0x19 | +| * ClearHolidaySchedule | 0x13 | +| * ClearPin | 0x07 | +| * ClearRfid | 0x18 | +| * ClearWeekdaySchedule | 0x0D | +| * ClearYeardaySchedule | 0x10 | +| * GetHolidaySchedule | 0x12 | +| * GetLogRecord | 0x04 | +| * GetPin | 0x06 | +| * GetRfid | 0x17 | +| * GetUserType | 0x15 | +| * GetWeekdaySchedule | 0x0C | +| * GetYeardaySchedule | 0x0F | +| * LockDoor | 0x00 | +| * SetHolidaySchedule | 0x11 | +| * SetPin | 0x05 | +| * SetRfid | 0x16 | +| * SetUserType | 0x14 | +| * SetWeekdaySchedule | 0x0B | +| * SetYeardaySchedule | 0x0E | +| * UnlockDoor | 0x01 | +| * UnlockWithTimeout | 0x03 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * LockState | 0x0000 | +| * LockType | 0x0001 | +| * ActuatorEnabled | 0x0002 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + /* - * Command ClearYeardaySchedule + * Command ClearAllPins */ -class DoorLockClearYeardaySchedule : public ModelCommand +class DoorLockClearAllPins : public ModelCommand { public: - DoorLockClearYeardaySchedule() : ModelCommand("clear-yearday-schedule") + DoorLockClearAllPins() : ModelCommand("clear-all-pins") { ModelCommand::AddArguments(); } + ~DoorLockClearAllPins() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x08) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearAllPins(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDoorLockClusterClearAllPinsResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Command ClearAllRfids + */ +class DoorLockClearAllRfids : public ModelCommand +{ +public: + DoorLockClearAllRfids() : ModelCommand("clear-all-rfids") { ModelCommand::AddArguments(); } + ~DoorLockClearAllRfids() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x19) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearAllRfids(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDoorLockClusterClearAllRfidsResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Command ClearHolidaySchedule + */ +class DoorLockClearHolidaySchedule : public ModelCommand +{ +public: + DoorLockClearHolidaySchedule() : ModelCommand("clear-holiday-schedule") + { + AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId); + ModelCommand::AddArguments(); + } + ~DoorLockClearHolidaySchedule() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x13) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearHolidaySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mScheduleId); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnDoorLockClusterClearHolidayScheduleResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mScheduleId; +}; + +/* + * Command ClearPin + */ +class DoorLockClearPin : public ModelCommand +{ +public: + DoorLockClearPin() : ModelCommand("clear-pin") + { + AddArgument("userId", 0, UINT16_MAX, &mUserId); + ModelCommand::AddArguments(); + } + ~DoorLockClearPin() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x07) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearPin(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDoorLockClusterClearPinResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mUserId; +}; + +/* + * Command ClearRfid + */ +class DoorLockClearRfid : public ModelCommand +{ +public: + DoorLockClearRfid() : ModelCommand("clear-rfid") + { + AddArgument("userId", 0, UINT16_MAX, &mUserId); + ModelCommand::AddArguments(); + } + ~DoorLockClearRfid() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x18) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearRfid(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mUserId); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDoorLockClusterClearRfidResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mUserId; +}; + +/* + * Command ClearWeekdaySchedule + */ +class DoorLockClearWeekdaySchedule : public ModelCommand +{ +public: + DoorLockClearWeekdaySchedule() : ModelCommand("clear-weekday-schedule") + { + AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId); + AddArgument("userId", 0, UINT16_MAX, &mUserId); + ModelCommand::AddArguments(); + } + ~DoorLockClearWeekdaySchedule() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x0D) on endpoint %" PRIu16, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ClearWeekdaySchedule(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mScheduleId, mUserId); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnDoorLockClusterClearWeekdayScheduleResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mScheduleId; + uint16_t mUserId; +}; + +/* + * Command ClearYeardaySchedule + */ +class DoorLockClearYeardaySchedule : public ModelCommand +{ +public: + DoorLockClearYeardaySchedule() : ModelCommand("clear-yearday-schedule") { AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId); AddArgument("userId", 0, UINT16_MAX, &mUserId); @@ -6226,34 +6600,25 @@ class ReadGeneralCommissioningClusterRevision : public ModelCommand }; /*----------------------------------------------------------------------------*\ -| Cluster Groups | 0x0004 | +| Cluster GroupKeyManagement | 0xF004 | |------------------------------------------------------------------------------| | Commands: | | -| * AddGroup | 0x00 | -| * AddGroupIfIdentifying | 0x05 | -| * GetGroupMembership | 0x02 | -| * RemoveAllGroups | 0x04 | -| * RemoveGroup | 0x03 | -| * ViewGroup | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | -| * NameSupport | 0x0000 | +| * Groups | 0x0000 | +| * GroupKeys | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ /* - * Command AddGroup + * Discover Attributes */ -class GroupsAddGroup : public ModelCommand +class DiscoverGroupKeyManagementAttributes : public ModelCommand { public: - GroupsAddGroup() : ModelCommand("add-group") - { - AddArgument("groupId", 0, UINT16_MAX, &mGroupId); - AddArgument("groupName", &mGroupName); - ModelCommand::AddArguments(); - } - ~GroupsAddGroup() + DiscoverGroupKeyManagementAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverGroupKeyManagementAttributes() { delete onSuccessCallback; delete onFailureCallback; @@ -6261,36 +6626,33 @@ class GroupsAddGroup : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::GroupsCluster cluster; + chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - return cluster.AddGroup(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, - chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName))); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnGroupsClusterAddGroupResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint16_t mGroupId; - char * mGroupName; }; /* - * Command AddGroupIfIdentifying + * Attribute Groups */ -class GroupsAddGroupIfIdentifying : public ModelCommand +class ReadGroupKeyManagementGroups : public ModelCommand { public: - GroupsAddGroupIfIdentifying() : ModelCommand("add-group-if-identifying") + ReadGroupKeyManagementGroups() : ModelCommand("read") { - AddArgument("groupId", 0, UINT16_MAX, &mGroupId); - AddArgument("groupName", &mGroupName); + AddArgument("attr-name", "groups"); ModelCommand::AddArguments(); } - ~GroupsAddGroupIfIdentifying() + + ~ReadGroupKeyManagementGroups() { delete onSuccessCallback; delete onFailureCallback; @@ -6298,36 +6660,34 @@ class GroupsAddGroupIfIdentifying : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x05) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0xF004) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::GroupsCluster cluster; + chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - return cluster.AddGroupIfIdentifying(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, - chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName))); + return cluster.ReadAttributeGroups(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnGroupKeyManagementGroupsListAttributeResponse, + this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint16_t mGroupId; - char * mGroupName; }; /* - * Command GetGroupMembership + * Attribute GroupKeys */ -class GroupsGetGroupMembership : public ModelCommand +class ReadGroupKeyManagementGroupKeys : public ModelCommand { public: - GroupsGetGroupMembership() : ModelCommand("get-group-membership") + ReadGroupKeyManagementGroupKeys() : ModelCommand("read") { - AddArgument("groupCount", 0, UINT8_MAX, &mGroupCount); - AddArgument("groupList", 0, UINT16_MAX, &mGroupList); + AddArgument("attr-name", "group-keys"); ModelCommand::AddArguments(); } - ~GroupsGetGroupMembership() + + ~ReadGroupKeyManagementGroupKeys() { delete onSuccessCallback; delete onFailureCallback; @@ -6335,17 +6695,176 @@ class GroupsGetGroupMembership : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x02) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0xF004) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::GroupsCluster cluster; + chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - return cluster.GetGroupMembership(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupCount, mGroupList); + return cluster.ReadAttributeGroupKeys(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnGroupsClusterGetGroupMembershipResponse, - this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnGroupKeyManagementGroupKeysListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ClusterRevision + */ +class ReadGroupKeyManagementClusterRevision : public ModelCommand +{ +public: + ReadGroupKeyManagementClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0xF004) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/*----------------------------------------------------------------------------*\ +| Cluster Groups | 0x0004 | +|------------------------------------------------------------------------------| +| Commands: | | +| * AddGroup | 0x00 | +| * AddGroupIfIdentifying | 0x05 | +| * GetGroupMembership | 0x02 | +| * RemoveAllGroups | 0x04 | +| * RemoveGroup | 0x03 | +| * ViewGroup | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * NameSupport | 0x0000 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command AddGroup + */ +class GroupsAddGroup : public ModelCommand +{ +public: + GroupsAddGroup() : ModelCommand("add-group") + { + AddArgument("groupId", 0, UINT16_MAX, &mGroupId); + AddArgument("groupName", &mGroupName); + ModelCommand::AddArguments(); + } + ~GroupsAddGroup() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, endpointId); + return cluster.AddGroup(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, + chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName))); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnGroupsClusterAddGroupResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mGroupId; + char * mGroupName; +}; + +/* + * Command AddGroupIfIdentifying + */ +class GroupsAddGroupIfIdentifying : public ModelCommand +{ +public: + GroupsAddGroupIfIdentifying() : ModelCommand("add-group-if-identifying") + { + AddArgument("groupId", 0, UINT16_MAX, &mGroupId); + AddArgument("groupName", &mGroupName); + ModelCommand::AddArguments(); + } + ~GroupsAddGroupIfIdentifying() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x05) on endpoint %" PRIu16, endpointId); + + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, endpointId); + return cluster.AddGroupIfIdentifying(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupId, + chip::ByteSpan(chip::Uint8::from_char(mGroupName), strlen(mGroupName))); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint16_t mGroupId; + char * mGroupName; +}; + +/* + * Command GetGroupMembership + */ +class GroupsGetGroupMembership : public ModelCommand +{ +public: + GroupsGetGroupMembership() : ModelCommand("get-group-membership") + { + AddArgument("groupCount", 0, UINT8_MAX, &mGroupCount); + AddArgument("groupList", 0, UINT16_MAX, &mGroupList); + ModelCommand::AddArguments(); + } + ~GroupsGetGroupMembership() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x02) on endpoint %" PRIu16, endpointId); + + chip::Controller::GroupsCluster cluster; + cluster.Associate(device, endpointId); + return cluster.GetGroupMembership(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mGroupCount, mGroupList); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnGroupsClusterGetGroupMembershipResponse, + this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); uint8_t mGroupCount; @@ -6873,11 +7392,411 @@ class LevelControlMoveToLevelWithOnOff : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x04) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x04) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.MoveToLevelWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mLevel, mTransitionTime); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mLevel; + uint16_t mTransitionTime; +}; + +/* + * Command MoveWithOnOff + */ +class LevelControlMoveWithOnOff : public ModelCommand +{ +public: + LevelControlMoveWithOnOff() : ModelCommand("move-with-on-off") + { + AddArgument("moveMode", 0, UINT8_MAX, &mMoveMode); + AddArgument("rate", 0, UINT8_MAX, &mRate); + ModelCommand::AddArguments(); + } + ~LevelControlMoveWithOnOff() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x05) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.MoveWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMoveMode, mRate); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mMoveMode; + uint8_t mRate; +}; + +/* + * Command Step + */ +class LevelControlStep : public ModelCommand +{ +public: + LevelControlStep() : ModelCommand("step") + { + AddArgument("stepMode", 0, UINT8_MAX, &mStepMode); + AddArgument("stepSize", 0, UINT8_MAX, &mStepSize); + AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); + AddArgument("optionMask", 0, UINT8_MAX, &mOptionMask); + AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride); + ModelCommand::AddArguments(); + } + ~LevelControlStep() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x02) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.Step(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mStepMode, mStepSize, mTransitionTime, + mOptionMask, mOptionOverride); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mStepMode; + uint8_t mStepSize; + uint16_t mTransitionTime; + uint8_t mOptionMask; + uint8_t mOptionOverride; +}; + +/* + * Command StepWithOnOff + */ +class LevelControlStepWithOnOff : public ModelCommand +{ +public: + LevelControlStepWithOnOff() : ModelCommand("step-with-on-off") + { + AddArgument("stepMode", 0, UINT8_MAX, &mStepMode); + AddArgument("stepSize", 0, UINT8_MAX, &mStepSize); + AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); + ModelCommand::AddArguments(); + } + ~LevelControlStepWithOnOff() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.StepWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mStepMode, mStepSize, + mTransitionTime); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mStepMode; + uint8_t mStepSize; + uint16_t mTransitionTime; +}; + +/* + * Command Stop + */ +class LevelControlStop : public ModelCommand +{ +public: + LevelControlStop() : ModelCommand("stop") + { + AddArgument("optionMask", 0, UINT8_MAX, &mOptionMask); + AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride); + ModelCommand::AddArguments(); + } + ~LevelControlStop() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x03) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.Stop(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mOptionMask, mOptionOverride); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint8_t mOptionMask; + uint8_t mOptionOverride; +}; + +/* + * Command StopWithOnOff + */ +class LevelControlStopWithOnOff : public ModelCommand +{ +public: + LevelControlStopWithOnOff() : ModelCommand("stop-with-on-off") { ModelCommand::AddArguments(); } + ~LevelControlStopWithOnOff() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x07) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.StopWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Discover Attributes + */ +class DiscoverLevelControlAttributes : public ModelCommand +{ +public: + DiscoverLevelControlAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverLevelControlAttributes() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute CurrentLevel + */ +class ReadLevelControlCurrentLevel : public ModelCommand +{ +public: + ReadLevelControlCurrentLevel() : ModelCommand("read") + { + AddArgument("attr-name", "current-level"); + ModelCommand::AddArguments(); + } + + ~ReadLevelControlCurrentLevel() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeCurrentLevel(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +class ReportLevelControlCurrentLevel : public ModelCommand +{ +public: + ReportLevelControlCurrentLevel() : ModelCommand("report") + { + AddArgument("attr-name", "current-level"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("change", 0, UINT8_MAX, &mChange); + ModelCommand::AddArguments(); + } + + ~ReportLevelControlCurrentLevel() + { + delete onSuccessCallback; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x06) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + + CHIP_ERROR err = cluster.ReportAttributeCurrentLevel(onReportCallback->Cancel()); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return cluster.ConfigureAttributeCurrentLevel(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, + mMaxInterval, mChange); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + uint8_t mChange; +}; + +/* + * Attribute ClusterRevision + */ +class ReadLevelControlClusterRevision : public ModelCommand +{ +public: + ReadLevelControlClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadLevelControlClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::LevelControlCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/*----------------------------------------------------------------------------*\ +| Cluster LowPower | 0x0508 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Sleep | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command Sleep + */ +class LowPowerSleep : public ModelCommand +{ +public: + LowPowerSleep() : ModelCommand("sleep") { ModelCommand::AddArguments(); } + ~LowPowerSleep() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::LowPowerCluster cluster; + cluster.Associate(device, endpointId); + return cluster.Sleep(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Discover Attributes + */ +class DiscoverLowPowerAttributes : public ModelCommand +{ +public: + DiscoverLowPowerAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverLowPowerAttributes() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::LowPowerCluster cluster; cluster.Associate(device, endpointId); - return cluster.MoveToLevelWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mLevel, mTransitionTime); + return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: @@ -6885,23 +7804,21 @@ class LevelControlMoveToLevelWithOnOff : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mLevel; - uint16_t mTransitionTime; }; /* - * Command MoveWithOnOff + * Attribute ClusterRevision */ -class LevelControlMoveWithOnOff : public ModelCommand +class ReadLowPowerClusterRevision : public ModelCommand { public: - LevelControlMoveWithOnOff() : ModelCommand("move-with-on-off") + ReadLowPowerClusterRevision() : ModelCommand("read") { - AddArgument("moveMode", 0, UINT8_MAX, &mMoveMode); - AddArgument("rate", 0, UINT8_MAX, &mRate); + AddArgument("attr-name", "cluster-revision"); ModelCommand::AddArguments(); } - ~LevelControlMoveWithOnOff() + + ~ReadLowPowerClusterRevision() { delete onSuccessCallback; delete onFailureCallback; @@ -6909,38 +7826,52 @@ class LevelControlMoveWithOnOff : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x05) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::LowPowerCluster cluster; cluster.Associate(device, endpointId); - return cluster.MoveWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMoveMode, mRate); + return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt16uAttributeResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mMoveMode; - uint8_t mRate; }; +/*----------------------------------------------------------------------------*\ +| Cluster NetworkCommissioning | 0x0031 | +|------------------------------------------------------------------------------| +| Commands: | | +| * AddThreadNetwork | 0x06 | +| * AddWiFiNetwork | 0x02 | +| * DisableNetwork | 0x0E | +| * EnableNetwork | 0x0C | +| * GetLastNetworkCommissioningResult | 0x10 | +| * RemoveNetwork | 0x0A | +| * ScanNetworks | 0x00 | +| * UpdateThreadNetwork | 0x08 | +| * UpdateWiFiNetwork | 0x04 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + /* - * Command Step + * Command AddThreadNetwork */ -class LevelControlStep : public ModelCommand +class NetworkCommissioningAddThreadNetwork : public ModelCommand { public: - LevelControlStep() : ModelCommand("step") + NetworkCommissioningAddThreadNetwork() : ModelCommand("add-thread-network") { - AddArgument("stepMode", 0, UINT8_MAX, &mStepMode); - AddArgument("stepSize", 0, UINT8_MAX, &mStepSize); - AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); - AddArgument("optionMask", 0, UINT8_MAX, &mOptionMask); - AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride); + AddArgument("operationalDataset", &mOperationalDataset); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - ~LevelControlStep() + ~NetworkCommissioningAddThreadNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -6948,40 +7879,41 @@ class LevelControlStep : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x02) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x06) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.Step(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mStepMode, mStepSize, mTransitionTime, - mOptionMask, mOptionOverride); + return cluster.AddThreadNetwork(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mOperationalDataset), strlen(mOperationalDataset)), + mBreadcrumb, mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterAddThreadNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mStepMode; - uint8_t mStepSize; - uint16_t mTransitionTime; - uint8_t mOptionMask; - uint8_t mOptionOverride; + char * mOperationalDataset; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* - * Command StepWithOnOff + * Command AddWiFiNetwork */ -class LevelControlStepWithOnOff : public ModelCommand +class NetworkCommissioningAddWiFiNetwork : public ModelCommand { public: - LevelControlStepWithOnOff() : ModelCommand("step-with-on-off") + NetworkCommissioningAddWiFiNetwork() : ModelCommand("add-wi-fi-network") { - AddArgument("stepMode", 0, UINT8_MAX, &mStepMode); - AddArgument("stepSize", 0, UINT8_MAX, &mStepSize); - AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime); + AddArgument("ssid", &mSsid); + AddArgument("credentials", &mCredentials); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - ~LevelControlStepWithOnOff() + ~NetworkCommissioningAddWiFiNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -6989,37 +7921,41 @@ class LevelControlStepWithOnOff : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x06) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x02) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.StepWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mStepMode, mStepSize, - mTransitionTime); + return cluster.AddWiFiNetwork( + onSuccessCallback->Cancel(), onFailureCallback->Cancel(), chip::ByteSpan(chip::Uint8::from_char(mSsid), strlen(mSsid)), + chip::ByteSpan(chip::Uint8::from_char(mCredentials), strlen(mCredentials)), mBreadcrumb, mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterAddWiFiNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mStepMode; - uint8_t mStepSize; - uint16_t mTransitionTime; + char * mSsid; + char * mCredentials; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* - * Command Stop + * Command DisableNetwork */ -class LevelControlStop : public ModelCommand +class NetworkCommissioningDisableNetwork : public ModelCommand { public: - LevelControlStop() : ModelCommand("stop") + NetworkCommissioningDisableNetwork() : ModelCommand("disable-network") { - AddArgument("optionMask", 0, UINT8_MAX, &mOptionMask); - AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride); + AddArgument("networkID", &mNetworkID); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - ~LevelControlStop() + ~NetworkCommissioningDisableNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -7027,30 +7963,40 @@ class LevelControlStop : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x03) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0E) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.Stop(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mOptionMask, mOptionOverride); + return cluster.DisableNetwork(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mNetworkID), strlen(mNetworkID)), mBreadcrumb, + mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterDisableNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - uint8_t mOptionMask; - uint8_t mOptionOverride; + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* - * Command StopWithOnOff + * Command EnableNetwork */ -class LevelControlStopWithOnOff : public ModelCommand +class NetworkCommissioningEnableNetwork : public ModelCommand { public: - LevelControlStopWithOnOff() : ModelCommand("stop-with-on-off") { ModelCommand::AddArguments(); } - ~LevelControlStopWithOnOff() + NetworkCommissioningEnableNetwork() : ModelCommand("enable-network") + { + AddArgument("networkID", &mNetworkID); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningEnableNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -7058,29 +8004,38 @@ class LevelControlStopWithOnOff : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x07) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.StopWithOnOff(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.EnableNetwork(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mNetworkID), strlen(mNetworkID)), mBreadcrumb, + mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterEnableNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* - * Discover Attributes + * Command GetLastNetworkCommissioningResult */ -class DiscoverLevelControlAttributes : public ModelCommand +class NetworkCommissioningGetLastNetworkCommissioningResult : public ModelCommand { public: - DiscoverLevelControlAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } - - ~DiscoverLevelControlAttributes() + NetworkCommissioningGetLastNetworkCommissioningResult() : ModelCommand("get-last-network-commissioning-result") + { + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningGetLastNetworkCommissioningResult() { delete onSuccessCallback; delete onFailureCallback; @@ -7088,11 +8043,11 @@ class DiscoverLevelControlAttributes : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x10) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.GetLastNetworkCommissioningResult(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mTimeoutMs); } private: @@ -7100,21 +8055,23 @@ class DiscoverLevelControlAttributes : public ModelCommand new chip::Callback::Callback(OnDefaultSuccessResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint32_t mTimeoutMs; }; /* - * Attribute CurrentLevel + * Command RemoveNetwork */ -class ReadLevelControlCurrentLevel : public ModelCommand +class NetworkCommissioningRemoveNetwork : public ModelCommand { public: - ReadLevelControlCurrentLevel() : ModelCommand("read") + NetworkCommissioningRemoveNetwork() : ModelCommand("remove-network") { - AddArgument("attr-name", "current-level"); + AddArgument("networkID", &mNetworkID); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - - ~ReadLevelControlCurrentLevel() + ~NetworkCommissioningRemoveNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -7122,81 +8079,80 @@ class ReadLevelControlCurrentLevel : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0A) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeCurrentLevel(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.RemoveNetwork(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mNetworkID), strlen(mNetworkID)), mBreadcrumb, + mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterRemoveNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; -class ReportLevelControlCurrentLevel : public ModelCommand +/* + * Command ScanNetworks + */ +class NetworkCommissioningScanNetworks : public ModelCommand { public: - ReportLevelControlCurrentLevel() : ModelCommand("report") + NetworkCommissioningScanNetworks() : ModelCommand("scan-networks") { - AddArgument("attr-name", "current-level"); - AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); - AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); - AddArgument("change", 0, UINT8_MAX, &mChange); + AddArgument("ssid", &mSsid); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - - ~ReportLevelControlCurrentLevel() + ~NetworkCommissioningScanNetworks() { delete onSuccessCallback; delete onFailureCallback; - delete onReportCallback; } CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x06) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - - CHIP_ERROR err = cluster.ReportAttributeCurrentLevel(onReportCallback->Cancel()); - if (err != CHIP_NO_ERROR) - { - return err; - } - - return cluster.ConfigureAttributeCurrentLevel(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mMinInterval, - mMaxInterval, mChange); + return cluster.ScanNetworks(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mSsid), strlen(mSsid)), mBreadcrumb, mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterScanNetworksResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeResponse, this); - uint16_t mMinInterval; - uint16_t mMaxInterval; - uint8_t mChange; + char * mSsid; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* - * Attribute ClusterRevision + * Command UpdateThreadNetwork */ -class ReadLevelControlClusterRevision : public ModelCommand +class NetworkCommissioningUpdateThreadNetwork : public ModelCommand { public: - ReadLevelControlClusterRevision() : ModelCommand("read") + NetworkCommissioningUpdateThreadNetwork() : ModelCommand("update-thread-network") { - AddArgument("attr-name", "cluster-revision"); + AddArgument("operationalDataset", &mOperationalDataset); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); ModelCommand::AddArguments(); } - - ~ReadLevelControlClusterRevision() + ~NetworkCommissioningUpdateThreadNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -7204,38 +8160,41 @@ class ReadLevelControlClusterRevision : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x08) on endpoint %" PRIu16, endpointId); - chip::Controller::LevelControlCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.UpdateThreadNetwork(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), + chip::ByteSpan(chip::Uint8::from_char(mOperationalDataset), strlen(mOperationalDataset)), + mBreadcrumb, mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnInt16uAttributeResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterUpdateThreadNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mOperationalDataset; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; -/*----------------------------------------------------------------------------*\ -| Cluster LowPower | 0x0508 | -|------------------------------------------------------------------------------| -| Commands: | | -| * Sleep | 0x00 | -|------------------------------------------------------------------------------| -| Attributes: | | -| * ClusterRevision | 0xFFFD | -\*----------------------------------------------------------------------------*/ - /* - * Command Sleep + * Command UpdateWiFiNetwork */ -class LowPowerSleep : public ModelCommand +class NetworkCommissioningUpdateWiFiNetwork : public ModelCommand { public: - LowPowerSleep() : ModelCommand("sleep") { ModelCommand::AddArguments(); } - ~LowPowerSleep() + NetworkCommissioningUpdateWiFiNetwork() : ModelCommand("update-wi-fi-network") + { + AddArgument("ssid", &mSsid); + AddArgument("credentials", &mCredentials); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningUpdateWiFiNetwork() { delete onSuccessCallback; delete onFailureCallback; @@ -7243,29 +8202,36 @@ class LowPowerSleep : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x04) on endpoint %" PRIu16, endpointId); - chip::Controller::LowPowerCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - return cluster.Sleep(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + return cluster.UpdateWiFiNetwork( + onSuccessCallback->Cancel(), onFailureCallback->Cancel(), chip::ByteSpan(chip::Uint8::from_char(mSsid), strlen(mSsid)), + chip::ByteSpan(chip::Uint8::from_char(mCredentials), strlen(mCredentials)), mBreadcrumb, mTimeoutMs); } private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback( + OnNetworkCommissioningClusterUpdateWiFiNetworkResponse, this); chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mSsid; + char * mCredentials; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; }; /* * Discover Attributes */ -class DiscoverLowPowerAttributes : public ModelCommand +class DiscoverNetworkCommissioningAttributes : public ModelCommand { public: - DiscoverLowPowerAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + DiscoverNetworkCommissioningAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } - ~DiscoverLowPowerAttributes() + ~DiscoverNetworkCommissioningAttributes() { delete onSuccessCallback; delete onFailureCallback; @@ -7275,7 +8241,7 @@ class DiscoverLowPowerAttributes : public ModelCommand { ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); - chip::Controller::LowPowerCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } @@ -7290,16 +8256,16 @@ class DiscoverLowPowerAttributes : public ModelCommand /* * Attribute ClusterRevision */ -class ReadLowPowerClusterRevision : public ModelCommand +class ReadNetworkCommissioningClusterRevision : public ModelCommand { public: - ReadLowPowerClusterRevision() : ModelCommand("read") + ReadNetworkCommissioningClusterRevision() : ModelCommand("read") { AddArgument("attr-name", "cluster-revision"); ModelCommand::AddArguments(); } - ~ReadLowPowerClusterRevision() + ~ReadNetworkCommissioningClusterRevision() { delete onSuccessCallback; delete onFailureCallback; @@ -7307,9 +8273,9 @@ class ReadLowPowerClusterRevision : public ModelCommand CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x00) on endpoint %" PRIu16, endpointId); - chip::Controller::LowPowerCluster cluster; + chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); } @@ -8470,6 +9436,18 @@ void registerClusterColorControl(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterDescriptor(Commands & commands) +{ + const char * clusterName = "Descriptor"; + + commands_list clusterCommands = { + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterDoorLock(Commands & commands) { const char * clusterName = "DoorLock"; @@ -8521,6 +9499,19 @@ void registerClusterGeneralCommissioning(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterGroupKeyManagement(Commands & commands) +{ + const char * clusterName = "GroupKeyManagement"; + + commands_list clusterCommands = { + make_unique(), + make_unique(), + make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterGroups(Commands & commands) { const char * clusterName = "Groups"; @@ -8584,6 +9575,26 @@ void registerClusterLowPower(Commands & commands) commands.Register(clusterName, clusterCommands); } +void registerClusterNetworkCommissioning(Commands & commands) +{ + const char * clusterName = "NetworkCommissioning"; + + commands_list clusterCommands = { + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterOnOff(Commands & commands) { const char * clusterName = "OnOff"; @@ -8634,12 +9645,15 @@ void registerClusters(Commands & commands) registerClusterBasic(commands); registerClusterBinding(commands); registerClusterColorControl(commands); + registerClusterDescriptor(commands); registerClusterDoorLock(commands); registerClusterGeneralCommissioning(commands); + registerClusterGroupKeyManagement(commands); registerClusterGroups(commands); registerClusterIdentify(commands); registerClusterLevelControl(commands); registerClusterLowPower(commands); + registerClusterNetworkCommissioning(commands); registerClusterOnOff(commands); registerClusterScenes(commands); registerClusterTemperatureMeasurement(commands); diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.cpp b/examples/chip-tool/gen/CHIPClientCallbacks.cpp index 2f78e0b4c1b817..ed9e0758a0a463 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.cpp +++ b/examples/chip-tool/gen/CHIPClientCallbacks.cpp @@ -272,7 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag case 0x38: // semi / Semi-precision case 0x39: // single / Single precision case 0x3A: // double / Double precision - case 0x48: // array / Array case 0x49: // struct / Structure case 0x50: // set / Set case 0x51: // bag / Bag @@ -326,6 +325,138 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag cb->mCall(cb->mContext, chip::ByteSpan(message, length)); break; } + case 0x48: // array / Array + { + CHECK_MESSAGE_LENGTH(2); + uint16_t count = chip::Encoding::LittleEndian::Read16(message); + ChipLogProgress(Zcl, " count: %lu", count); + + switch (clusterId) + { + case 0x001D: + switch (attributeId) + { + case 0x0000: // DeviceType + { + _DeviceType data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].type = emberAfGetInt32u(message, 0, messageLen); + message += 4; + CHECK_MESSAGE_LENGTH(4); + data[i].revision = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0002: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0003: // ENDPOINT_ID + { + chip::EndpointId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + case 0xF004: + switch (attributeId) + { + case 0x0000: // GroupState + { + _GroupState data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].VendorGroupId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeySetIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // GroupKey + { + _GroupKey data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyRoot = emberAfGetString(message, 0, messageLen); + message += 16; + CHECK_MESSAGE_LENGTH(16); + data[i].GroupKeyEpochStartTime = emberAfGetInt64u(message, 0, messageLen); + message += 8; + CHECK_MESSAGE_LENGTH(8); + data[i].GroupKeySecurityPolicy = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + } + break; + } case 0x08: // data8 / 8-bit data case 0x18: // map8 / 8-bit bitmap @@ -1308,6 +1439,122 @@ bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout) return true; } +bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "AddThreadNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "AddWiFiNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "DisableNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "EnableNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "RemoveNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( + uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults) +{ + ChipLogProgress(Zcl, "ScanNetworksResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults); + ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterScanNetworksResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText, wifiScanResults, threadScanResults); + return true; +} + +bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + bool emberAfScenesClusterAddSceneResponseCallback(uint8_t status, uint16_t groupId, uint8_t sceneId) { ChipLogProgress(Zcl, "AddSceneResponse:"); diff --git a/examples/chip-tool/gen/CHIPClientCallbacks.h b/examples/chip-tool/gen/CHIPClientCallbacks.h index a6adcbc4a710b6..7e2107a76628c6 100644 --- a/examples/chip-tool/gen/CHIPClientCallbacks.h +++ b/examples/chip-tool/gen/CHIPClientCallbacks.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -80,6 +81,18 @@ typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context, typedef void (*GroupsClusterRemoveGroupResponseCallback)(void * context, uint16_t groupId); typedef void (*GroupsClusterViewGroupResponseCallback)(void * context, uint16_t groupId, uint8_t * groupName); typedef void (*IdentifyClusterIdentifyQueryResponseCallback)(void * context, uint16_t timeout); +typedef void (*NetworkCommissioningClusterAddThreadNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterAddWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterDisableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterEnableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterRemoveNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterScanNetworksResponseCallback)( + void * context, uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults); +typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); +typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId); typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId, uint8_t sceneCount, @@ -90,3 +103,11 @@ typedef void (*ScenesClusterStoreSceneResponseCallback)(void * context, uint16_t typedef void (*ScenesClusterViewSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName, /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); + +// List specific responses +typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16_t count, _DeviceType * entries); +typedef void (*DescriptorServerListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorClientListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_t count, chip::EndpointId * entries); +typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); +typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); diff --git a/examples/chip-tool/gen/CHIPClustersObjc.h b/examples/chip-tool/gen/CHIPClustersObjc.h index 93e5db92ed0c08..bb9a207ae6a9ea 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.h +++ b/examples/chip-tool/gen/CHIPClustersObjc.h @@ -300,6 +300,16 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Descriptor + * + */ +@interface CHIPDescriptor : CHIPCluster + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Door Lock * @@ -388,6 +398,16 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Group Key Management + * + */ +@interface CHIPGroupKeyManagement : CHIPCluster + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Groups * @@ -478,6 +498,52 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Network Commissioning + * + */ +@interface CHIPNetworkCommissioning : CHIPCluster + +- (void)addThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)addWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)disableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)enableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler; +- (void)removeNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)scanNetworks:(NSData *)ssid + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)updateThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)updateWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster On/off * diff --git a/examples/chip-tool/gen/CHIPClustersObjc.mm b/examples/chip-tool/gen/CHIPClustersObjc.mm index 3a8c26eb57f995..0daa43b0c1c7f5 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.mm +++ b/examples/chip-tool/gen/CHIPClustersObjc.mm @@ -1337,6 +1337,276 @@ static void CallbackFn(void * context, uint16_t timeout) dispatch_queue_t mQueue; }; +class CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText, + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults) + { + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + // wifiScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Objc is not properly implemented yet + // threadScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Objc is not properly implemented yet + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback { public: CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -4482,6 +4752,42 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPDescriptor () +@property (readonly) Controller::DescriptorCluster cppCluster; +@end + +@implementation CHIPDescriptor + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPDoorLock () @property (readonly) Controller::DoorLockCluster cppCluster; @end @@ -5381,6 +5687,42 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPGroupKeyManagement () +@property (readonly) Controller::GroupKeyManagementCluster cppCluster; +@end + +@implementation CHIPGroupKeyManagement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPGroups () @property (readonly) Controller::GroupsCluster cppCluster; @end @@ -6066,6 +6408,285 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPNetworkCommissioning () +@property (readonly) Controller::NetworkCommissioningCluster cppCluster; +@end + +@implementation CHIPNetworkCommissioning + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)addThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.AddThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)addWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.AddWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), + chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)disableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.DisableNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)enableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.EnableNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetLastNetworkCommissioningResult(onSuccess->Cancel(), onFailure->Cancel(), timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)removeNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.RemoveNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)scanNetworks:(NSData *)ssid + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ScanNetworks( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)updateThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.UpdateThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)updateWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.UpdateWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), + chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPOnOff () @property (readonly) Controller::OnOffCluster cppCluster; @end diff --git a/examples/chip-tool/gen/IMClusterCommandHandler.cpp b/examples/chip-tool/gen/IMClusterCommandHandler.cpp index 8398b130687fdc..0bda6495f98aa9 100644 --- a/examples/chip-tool/gen/IMClusterCommandHandler.cpp +++ b/examples/chip-tool/gen/IMClusterCommandHandler.cpp @@ -2703,6 +2703,708 @@ void DispatchClientCommand(app::Command * command, CommandId commandId, Endpoint } // namespace Identify +namespace NetworkCommissioning { + +void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv) +{ + { + switch (commandId) + { + case ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults; + bool wifiScanResultsExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults; + bool threadScanResultsExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + case 2: + if (wifiScanResultsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = dataTlv.GetDataPtr(const_cast(wifiScanResults)); + if (CHIP_NO_ERROR == TLVUnpackError) + { + wifiScanResultsExists = true; + validArgumentCount++; + } + break; + case 3: + if (threadScanResultsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = dataTlv.GetDataPtr(const_cast(threadScanResults)); + if (CHIP_NO_ERROR == TLVUnpackError) + { + threadScanResultsExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterScanNetworksResponseCallback(errorCode, const_cast(debugText), + wifiScanResults, threadScanResults); + } + else if (4 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 4, + validArgumentCount); + } + break; + } + case ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + // TODO: Encode response for command not found + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID); + break; + } + } + } +} + +} // namespace NetworkCommissioning + namespace Scenes { void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv) diff --git a/examples/chip-tool/gen/af-structs.h b/examples/chip-tool/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/chip-tool/gen/af-structs.h +++ b/examples/chip-tool/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/chip-tool/gen/attribute-size.cpp b/examples/chip-tool/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/chip-tool/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/chip-tool/gen/call-command-handler.cpp b/examples/chip-tool/gen/call-command-handler.cpp index 66538a88f18d42..377448a7a84919 100644 --- a/examples/chip-tool/gen/call-command-handler.cpp +++ b/examples/chip-tool/gen/call-command-handler.cpp @@ -33,12 +33,15 @@ EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterComma EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfDescriptorClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfGroupKeyManagementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLevelControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -92,12 +95,20 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Color Control result = status(false, true, cmd->mfgSpecific); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + // No commands are enabled for cluster Descriptor + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: result = emberAfDoorLockClusterClientCommandParse(cmd); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: result = emberAfGeneralCommissioningClusterClientCommandParse(cmd); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + // No commands are enabled for cluster Group Key Management + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_GROUPS_CLUSTER_ID: result = emberAfGroupsClusterClientCommandParse(cmd); break; @@ -112,6 +123,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Low Power result = status(false, true, cmd->mfgSpecific); break; + case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: + result = emberAfNetworkCommissioningClusterClientCommandParse(cmd); + break; case ZCL_ON_OFF_CLUSTER_ID: // No commands are enabled for cluster On/off result = status(false, true, cmd->mfgSpecific); @@ -869,6 +883,188 @@ EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * c } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults; + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + emberAfStringLength(debugText) + 1u); + wifiScanResults = cmd->buffer + payloadOffset; + threadScanResults = cmd->buffer + payloadOffset; + + wasHandled = emberAfNetworkCommissioningClusterScanNetworksResponseCallback(errorCode, debugText, wifiScanResults, + threadScanResults); + break; + } + case ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(errorCode, debugText); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; diff --git a/examples/chip-tool/gen/callback-stub.cpp b/examples/chip-tool/gen/callback-stub.cpp index 2e044efde235ed..0ff0367697811e 100644 --- a/examples/chip-tool/gen/callback-stub.cpp +++ b/examples/chip-tool/gen/callback-stub.cpp @@ -44,12 +44,18 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_COLOR_CONTROL_CLUSTER_ID: emberAfColorControlClusterInitCallback(endpoint); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + emberAfDescriptorClusterInitCallback(endpoint); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: emberAfDoorLockClusterInitCallback(endpoint); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: emberAfGeneralCommissioningClusterInitCallback(endpoint); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + emberAfGroupKeyManagementClusterInitCallback(endpoint); + break; case ZCL_GROUPS_CLUSTER_ID: emberAfGroupsClusterInitCallback(endpoint); break; @@ -62,6 +68,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_LOW_POWER_CLUSTER_ID: emberAfLowPowerClusterInitCallback(endpoint); break; + case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: + emberAfNetworkCommissioningClusterInitCallback(endpoint); + break; case ZCL_ON_OFF_CLUSTER_ID: emberAfOnOffClusterInitCallback(endpoint); break; @@ -102,6 +111,11 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfDescriptorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -112,6 +126,11 @@ void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(Endpoi // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfGroupKeyManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -132,6 +151,11 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/examples/chip-tool/gen/callback.h b/examples/chip-tool/gen/callback.h index 0de9f0dd4cae33..4623cdec559034 100644 --- a/examples/chip-tool/gen/callback.h +++ b/examples/chip-tool/gen/callback.h @@ -79,6 +79,14 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint); */ void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Descriptor Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterInitCallback(chip::EndpointId endpoint); + /** @brief Door Lock Cluster Init * * Cluster Init @@ -95,6 +103,14 @@ void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint); */ void emberAfGeneralCommissioningClusterInitCallback(chip::EndpointId endpoint); +/** @brief Group Key Management Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Groups Cluster Init * * Cluster Init @@ -127,6 +143,14 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint); */ void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint); +/** @brief Network Commissioning Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint); + /** @brief On/off Cluster Init * * Cluster Init @@ -503,6 +527,76 @@ EmberAfStatus emberAfColorControlClusterClientPreAttributeChangedCallback(chip:: */ void emberAfColorControlClusterClientTickCallback(chip::EndpointId endpoint); +// +// Descriptor Cluster client +// + +/** @brief Descriptor Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Descriptor Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfDescriptorClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Descriptor Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Descriptor Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Descriptor Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfDescriptorClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Descriptor Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDescriptorClusterClientTickCallback(chip::EndpointId endpoint); + // // Door Lock Cluster client // @@ -644,6 +738,77 @@ EmberAfStatus emberAfGeneralCommissioningClusterClientPreAttributeChangedCallbac */ void emberAfGeneralCommissioningClusterClientTickCallback(chip::EndpointId endpoint); +// +// Group Key Management Cluster client +// + +/** @brief Group Key Management Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Group Key Management Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfGroupKeyManagementClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Group Key Management Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Group Key Management Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Group Key Management Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfGroupKeyManagementClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Group Key Management Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfGroupKeyManagementClusterClientTickCallback(chip::EndpointId endpoint); + // // Groups Cluster client // @@ -924,6 +1089,77 @@ EmberAfStatus emberAfLowPowerClusterClientPreAttributeChangedCallback(chip::Endp */ void emberAfLowPowerClusterClientTickCallback(chip::EndpointId endpoint); +// +// Network Commissioning Cluster client +// + +/** @brief Network Commissioning Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfNetworkCommissioningClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Network Commissioning Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfNetworkCommissioningClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Network Commissioning Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Network Commissioning Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Network Commissioning Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfNetworkCommissioningClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Network Commissioning Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfNetworkCommissioningClusterClientTickCallback(chip::EndpointId endpoint); + // // On/off Cluster client // @@ -1395,6 +1631,74 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout); +/** + * @brief Network Commissioning Cluster AddThreadNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster AddWiFiNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster DisableNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster EnableNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster RemoveNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster ScanNetworksResponse Command callback + * @param errorCode + * @param debugText + * @param wifiScanResults + * @param threadScanResults + */ + +bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( + uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults); + +/** + * @brief Network Commissioning Cluster UpdateThreadNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster UpdateWiFiNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + /** * @brief Scenes Cluster AddSceneResponse Command callback * @param status diff --git a/examples/chip-tool/gen/endpoint_config.h b/examples/chip-tool/gen/endpoint_config.h index 7f78df5818c6b8..c0681f294176bf 100644 --- a/examples/chip-tool/gen/endpoint_config.h +++ b/examples/chip-tool/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 14 +#define GENERATED_ATTRIBUTE_COUNT 17 #define GENERATED_ATTRIBUTES \ { \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ @@ -76,10 +76,14 @@ ZAP_SIMPLE_DEFAULT(2) }, /* On/off (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(3) }, /* Level Control (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Descriptor (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(3) }, /* Basic (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(0x0001) }, /* General Commissioning (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Network Commissioning (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(3) }, /* Door Lock (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ @@ -94,6 +98,8 @@ ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (client): cluster revision */ \ } // This is an array of EmberAfCluster structures. @@ -103,7 +109,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 14 +#define GENERATED_CLUSTER_COUNT 17 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -113,31 +119,40 @@ { \ 0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Level Control (client) */ \ - { 0x0028, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Descriptor (client) */ \ + { 0x0028, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ + { \ + 0x0030, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: General Commissioning (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { \ + 0x0101, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0300, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ + { \ + 0xF004, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index])) @@ -145,7 +160,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 14, 28 }, \ + { ZAP_CLUSTER_INDEX(0), 17, 34 }, \ } // Largest attribute size is needed for various buffers @@ -155,7 +170,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (28) +#define ATTRIBUTE_MAX_SIZE (34) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -199,7 +214,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (114) +#define EMBER_AF_GENERATED_COMMAND_COUNT (131) #define GENERATED_COMMANDS \ { \ { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */ \ @@ -250,6 +265,24 @@ { 0x0030, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): CommissioningComplete */ \ { 0x0030, 0x07, \ ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): CommissioningCompleteResponse */ \ + { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): ScanNetworks */ \ + { 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): ScanNetworksResponse */ \ + { 0x0031, 0x02, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): AddWiFiNetwork */ \ + { 0x0031, 0x03, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): AddWiFiNetworkResponse */ \ + { 0x0031, 0x04, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): UpdateWiFiNetwork */ \ + { 0x0031, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): UpdateWiFiNetworkResponse */ \ + { 0x0031, 0x06, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): AddThreadNetwork */ \ + { 0x0031, 0x07, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): AddThreadNetworkResponse */ \ + { 0x0031, 0x08, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): UpdateThreadNetwork */ \ + { 0x0031, 0x09, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): UpdateThreadNetworkResponse */ \ + { 0x0031, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): RemoveNetwork */ \ + { 0x0031, 0x0B, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): RemoveNetworkResponse */ \ + { 0x0031, 0x0C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): EnableNetwork */ \ + { 0x0031, 0x0D, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): EnableNetworkResponse */ \ + { 0x0031, 0x0E, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): DisableNetwork */ \ + { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): DisableNetworkResponse */ \ + { 0x0031, 0x10, \ + ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): GetLastNetworkCommissioningResult */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): LockDoor */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Door Lock (client): LockDoorResponse */ \ { 0x0101, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): UnlockDoor */ \ diff --git a/examples/chip-tool/gen/gen_config.h b/examples/chip-tool/gen/gen_config.h index a61e278bdebe97..600167c3ae9b7b 100644 --- a/examples/chip-tool/gen/gen_config.h +++ b/examples/chip-tool/gen/gen_config.h @@ -34,12 +34,15 @@ #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GROUPS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LOW_POWER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -66,6 +69,10 @@ #define ZCL_USING_COLOR_CONTROL_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_COLOR_CONTROL_CLIENT +// Use this macro to check if the client side of the Descriptor cluster is included +#define ZCL_USING_DESCRIPTOR_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_DESCRIPTOR_CLIENT + // Use this macro to check if the client side of the Door Lock cluster is included #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT @@ -74,6 +81,10 @@ #define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_CLIENT +// Use this macro to check if the client side of the Group Key Management cluster is included +#define ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT_CLIENT + // Use this macro to check if the client side of the Groups cluster is included #define ZCL_USING_GROUPS_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GROUPS_CLIENT @@ -90,6 +101,10 @@ #define ZCL_USING_LOW_POWER_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_LOW_POWER_CLIENT +// Use this macro to check if the client side of the Network Commissioning cluster is included +#define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_CLIENT + // Use this macro to check if the client side of the On/off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_ON_OFF_CLIENT diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index ed838af66806ae..cbc1e0707aa48a 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -109,13 +109,40 @@ static void On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false {{/if}} {{/all_user_clusters}} +{{#chip_client_clusters}} +{{#chip_server_cluster_attributes}} +{{#if isList}} +static void On{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeResponse(void * context, uint16_t count, {{chipType}} * entries) +{ + ChipLogProgress(chipTool, "On{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeResponse: %lu entries", count); + + for (uint16_t i = 0; i < count; i++) + { + {{#if isStruct}} + ChipLogProgress(chipTool, "{{type}}[%lu]:", i); + {{#chip_attribute_list_entryTypes}} + ChipLogProgress(chipTool, " {{name}}: {{asPrintFormat type}}", entries[i].{{name}}); + {{/chip_attribute_list_entryTypes}} + {{else}} + ChipLogProgress(chipTool, "{{type}}[%lu]: {{asPrintFormat type}}", i, entries[i]); + {{/if}} + } + + ModelCommand * command = reinterpret_cast(context); + command->SetCommandExitStatus(true); +} + +{{/if}} +{{/chip_server_cluster_attributes}} +{{/chip_client_clusters}} + {{> clusters_header}} -{{#chip_clusters}} +{{#chip_client_clusters}} constexpr chip::ClusterId k{{asCamelCased name false}}ClusterId = {{asHex code 4}}; -{{/chip_clusters}} +{{/chip_client_clusters}} -{{#chip_clusters}} +{{#chip_client_clusters}} {{> cluster_header}} {{#chip_server_cluster_commands}} @@ -229,7 +256,11 @@ public: } private: +{{#if isList}} + chip::Callback::Callback<{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeCallback> * onSuccessCallback = new chip::Callback::Callback<{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeCallback>(On{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeResponse, this); +{{else}} chip::Callback::Callback<{{asCallbackAttributeType atomicTypeId}}AttributeCallback> * onSuccessCallback = new chip::Callback::Callback<{{asCallbackAttributeType atomicTypeId}}AttributeCallback>(On{{asCallbackAttributeType atomicTypeId}}AttributeResponse, this); +{{/if}} chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); }; @@ -284,8 +315,10 @@ public: AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); {{#unless (isDiscreteType)}} + {{#unless (isString type)}} AddArgument("change", {{asTypeMinValue type}}, {{asTypeMaxValue type}}, &mChange); {{/unless}} + {{/unless}} ModelCommand::AddArguments(); } @@ -319,18 +352,20 @@ private: uint16_t mMinInterval; uint16_t mMaxInterval; {{#unless (isDiscreteType)}} + {{#unless (isString type)}} {{chipType}} mChange; {{/unless}} + {{/unless}} }; {{/if}} {{/chip_server_cluster_attributes}} -{{/chip_clusters}} +{{/chip_client_clusters}} /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ -{{#chip_clusters}} +{{#chip_client_clusters}} void registerCluster{{asCamelCased name false}}(Commands & commands) { const char * clusterName = "{{asCamelCased name false}}"; @@ -353,11 +388,11 @@ void registerCluster{{asCamelCased name false}}(Commands & commands) commands.Register(clusterName, clusterCommands); } -{{/chip_clusters}} +{{/chip_client_clusters}} void registerClusters(Commands & commands) { -{{#chip_clusters}} +{{#chip_client_clusters}} registerCluster{{asCamelCased name false}}(commands); -{{/chip_clusters}} +{{/chip_client_clusters}} } diff --git a/examples/chip-tool/templates/helper.js b/examples/chip-tool/templates/helper.js index 8028578770d4f9..b263cbde229241 100644 --- a/examples/chip-tool/templates/helper.js +++ b/examples/chip-tool/templates/helper.js @@ -17,44 +17,11 @@ // Import helpers from zap core const zapPath = '../../../third_party/zap/repo/src-electron/'; -const queryImpexp = require(zapPath + 'db/query-impexp.js') const templateUtil = require(zapPath + 'generator/template-util.js') const zclHelper = require(zapPath + 'generator/helper-zcl.js') -const zclQuery = require(zapPath + 'db/query-zcl.js') -const cHelper = require(zapPath + 'generator/helper-c.js') -const StringHelper = require('../../../src/app/zap-templates/common/StringHelper.js'); const ChipTypesHelper = require('../../../src/app/zap-templates/common/ChipTypesHelper.js'); -function hasSpecificResponse(commandName) -{ - // Retrieve the clusterName and the clusterSide. If any if not available, an error will be thrown. - const clusterName = this.parent.name; - const clusterSide = this.parent.side; - if (clusterName == undefined || clusterSide == undefined) { - const error = 'chip_server_cluster_commands: Could not find relevant parent cluster.'; - console.log(error); - throw error; - } - - function filterCommand(cmd) - { - return cmd.clusterName == clusterName && cmd.name == (commandName + "Response"); - } - - function fn(pkgId) - { - const db = this.global.db; - return queryImpexp.exportendPointTypeIds(db, this.global.sessionId) - .then(endpointTypes => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(db, endpointTypes)) - .then(endpointsAndClusters => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters(db, endpointsAndClusters)) - .then(endpointCommands => endpointCommands.filter(filterCommand).length) - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise); -} - function asDelimitedCommand(name) { return name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); @@ -80,7 +47,7 @@ function asTypeMinValue(type) case 'uint64_t': return '0'; default: - error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; + error = 'asTypeMinValue: Unhandled underlying type ' + zclType + ' for original type ' + type; throw error; } }) @@ -110,7 +77,7 @@ function asTypeMaxValue(type) return 'UINT' + parseInt(basicType.slice(4)) + '_MAX'; default: return 'err'; - error = 'Unhandled underlying type ' + zclType + ' for original type ' + type; + error = 'asTypeMaxValue: Unhandled underlying type ' + zclType + ' for original type ' + type; throw error; } }) @@ -120,16 +87,9 @@ function asTypeMaxValue(type) return templateUtil.templatePromise(this.global, promise); } -function isStrEndsWith(str, substr) -{ - return str.endsWith(substr); -} - // // Module exports // -exports.hasSpecificResponse = hasSpecificResponse; -exports.asDelimitedCommand = asDelimitedCommand; -exports.asTypeMinValue = asTypeMinValue; -exports.asTypeMaxValue = asTypeMaxValue; -exports.isStrEndsWith = isStrEndsWith; +exports.asDelimitedCommand = asDelimitedCommand; +exports.asTypeMinValue = asTypeMinValue; +exports.asTypeMaxValue = asTypeMaxValue; diff --git a/examples/chip-tool/templates/reporting-commands.zapt b/examples/chip-tool/templates/reporting-commands.zapt index 6bc5229f92e6cc..b77c9c139c2762 100644 --- a/examples/chip-tool/templates/reporting-commands.zapt +++ b/examples/chip-tool/templates/reporting-commands.zapt @@ -31,7 +31,7 @@ public: {{#chip_clusters}} {{#chip_server_cluster_attributes}} {{#if (isReportableAttribute)}} - callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, {{asHex parent.code 4}}, {{asHex attributeCode 4}}, onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback->Cancel()); + callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, {{asHex parent.code 4}}, {{asHex code 4}}, onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback->Cancel()); {{/if}} {{/chip_server_cluster_attributes}} {{/chip_clusters}} diff --git a/examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.h b/examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.h +++ b/examples/lighting-app/lighting-common/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/lighting-app/lighting-common/gen/af-structs.h b/examples/lighting-app/lighting-common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/lighting-app/lighting-common/gen/af-structs.h +++ b/examples/lighting-app/lighting-common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/lighting-app/lighting-common/gen/attribute-size.cpp b/examples/lighting-app/lighting-common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/lighting-app/lighting-common/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index cbd847dfb5e3dd..df57d33f91fc9b 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -42,6 +42,7 @@ target_sources(app PRIVATE main/LightingManager.cpp main/main.cpp main/ZclCallbacks.cpp + ${LIGHTING_COMMON}/gen/attribute-size.cpp ${LIGHTING_COMMON}/gen/call-command-handler.cpp ${LIGHTING_COMMON}/gen/callback-stub.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp diff --git a/examples/lock-app/lock-common/gen/CHIPClientCallbacks.h b/examples/lock-app/lock-common/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/lock-app/lock-common/gen/CHIPClientCallbacks.h +++ b/examples/lock-app/lock-common/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/lock-app/lock-common/gen/af-structs.h b/examples/lock-app/lock-common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/lock-app/lock-common/gen/af-structs.h +++ b/examples/lock-app/lock-common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/lock-app/lock-common/gen/attribute-size.cpp b/examples/lock-app/lock-common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/lock-app/lock-common/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index d7295e2ff23aa8..145082f2432002 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -42,6 +42,7 @@ target_sources(app PRIVATE main/BoltLockManager.cpp main/main.cpp main/ZclCallbacks.cpp + ${LOCK_COMMON}/gen/attribute-size.cpp ${LOCK_COMMON}/gen/call-command-handler.cpp ${LOCK_COMMON}/gen/callback-stub.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp diff --git a/examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.h b/examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.h +++ b/examples/temperature-measurement-app/esp32/main/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/temperature-measurement-app/esp32/main/gen/af-structs.h b/examples/temperature-measurement-app/esp32/main/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/temperature-measurement-app/esp32/main/gen/af-structs.h +++ b/examples/temperature-measurement-app/esp32/main/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/temperature-measurement-app/esp32/main/gen/attribute-size.cpp b/examples/temperature-measurement-app/esp32/main/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/tv-app/tv-common/gen/CHIPClientCallbacks.cpp b/examples/tv-app/tv-common/gen/CHIPClientCallbacks.cpp index c4a6c900db7c1b..98450403c13300 100644 --- a/examples/tv-app/tv-common/gen/CHIPClientCallbacks.cpp +++ b/examples/tv-app/tv-common/gen/CHIPClientCallbacks.cpp @@ -272,7 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag case 0x38: // semi / Semi-precision case 0x39: // single / Single precision case 0x3A: // double / Double precision - case 0x48: // array / Array case 0x49: // struct / Structure case 0x50: // set / Set case 0x51: // bag / Bag @@ -326,6 +325,17 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag cb->mCall(cb->mContext, chip::ByteSpan(message, length)); break; } + case 0x48: // array / Array + { + CHECK_MESSAGE_LENGTH(2); + uint16_t count = chip::Encoding::LittleEndian::Read16(message); + ChipLogProgress(Zcl, " count: %lu", count); + + switch (clusterId) + { + } + break; + } case 0x08: // data8 / 8-bit data case 0x18: // map8 / 8-bit bitmap diff --git a/examples/tv-app/tv-common/gen/CHIPClientCallbacks.h b/examples/tv-app/tv-common/gen/CHIPClientCallbacks.h index 2fc3557cf7582d..2954a52e9d7b70 100644 --- a/examples/tv-app/tv-common/gen/CHIPClientCallbacks.h +++ b/examples/tv-app/tv-common/gen/CHIPClientCallbacks.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -41,3 +42,5 @@ typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint1 // Cluster Specific Response Callbacks typedef void (*DoorLockClusterLockDoorResponseCallback)(void * context); typedef void (*DoorLockClusterUnlockDoorResponseCallback)(void * context); + +// List specific responses diff --git a/examples/tv-app/tv-common/gen/af-structs.h b/examples/tv-app/tv-common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/tv-app/tv-common/gen/af-structs.h +++ b/examples/tv-app/tv-common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/tv-app/tv-common/gen/attribute-size.cpp b/examples/tv-app/tv-common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/tv-app/tv-common/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/examples/tv-app/tv-common/gen/endpoint_config.h b/examples/tv-app/tv-common/gen/endpoint_config.h index 7456853451a5d1..143d6e20e3bbe6 100644 --- a/examples/tv-app/tv-common/gen/endpoint_config.h +++ b/examples/tv-app/tv-common/gen/endpoint_config.h @@ -316,15 +316,15 @@ { 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* IAS Zone (server): zone type */ \ { 0x0002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* IAS Zone (server): zone status */ \ { 0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(498) }, /* IAS Zone (server): IAS CIE address */ \ - { 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \ + ZAP_LONG_DEFAULTS_INDEX(498) }, /* IAS Zone (server): IAS CIE address */ \ + { 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \ { 0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(506) }, /* Application Basic (server): vendor name */ \ { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): vendor id */ \ { 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, \ - ZAP_LONG_DEFAULTS_INDEX(538) }, /* Application Basic (server): application name */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \ - { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \ + ZAP_LONG_DEFAULTS_INDEX(538) }, /* Application Basic (server): application name */ \ + { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \ { 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, \ ZAP_LONG_DEFAULTS_INDEX(570) }, /* Application Basic (server): application id */ \ { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \ diff --git a/examples/window-app/common/gen/CHIPClientCallbacks.h b/examples/window-app/common/gen/CHIPClientCallbacks.h index 759d13c5028d26..302d36ce5d8076 100644 --- a/examples/window-app/common/gen/CHIPClientCallbacks.h +++ b/examples/window-app/common/gen/CHIPClientCallbacks.h @@ -16,3 +16,5 @@ */ // THIS FILE IS GENERATED BY ZAP + +// List specific responses diff --git a/examples/window-app/common/gen/IMClusterCommandHandler.cpp b/examples/window-app/common/gen/IMClusterCommandHandler.cpp index d34505ecee8538..fd600b4e6caac5 100644 --- a/examples/window-app/common/gen/IMClusterCommandHandler.cpp +++ b/examples/window-app/common/gen/IMClusterCommandHandler.cpp @@ -47,120 +47,275 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint switch (commandId) { case ZCL_WINDOW_COVERING_DOWN_CLOSE_COMMAND_ID: { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. emberAfWindowCoveringClusterWindowCoveringDownCloseCallback(); break; } case ZCL_WINDOW_COVERING_GO_TO_LIFT_PERCENTAGE_COMMAND_ID: { - CHIP_ERROR TLVError = CHIP_NO_ERROR; + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t percentageLiftValue; + bool percentageLiftValueExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(dataTlv.GetTag())) { case 0: - TLVError = dataTlv.Get(percentageLiftValue); + if (percentageLiftValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(percentageLiftValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + percentageLiftValueExists = true; + validArgumentCount++; + } break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); break; } - if (TLVError != CHIP_NO_ERROR) + if (TLVUnpackError != CHIP_NO_ERROR) { ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, - TLV::TagNumFromTag(dataTlv.GetTag()), TLVError); + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; } } - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfWindowCoveringClusterWindowCoveringGoToLiftPercentageCallback(percentageLiftValue); + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfWindowCoveringClusterWindowCoveringGoToLiftPercentageCallback(percentageLiftValue); + } + else if (1 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 1, + validArgumentCount); + } break; } case ZCL_WINDOW_COVERING_GO_TO_LIFT_VALUE_COMMAND_ID: { - CHIP_ERROR TLVError = CHIP_NO_ERROR; + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint16_t liftValue; + bool liftValueExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(dataTlv.GetTag())) { case 0: - TLVError = dataTlv.Get(liftValue); + if (liftValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(liftValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + liftValueExists = true; + validArgumentCount++; + } break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); break; } - if (TLVError != CHIP_NO_ERROR) + if (TLVUnpackError != CHIP_NO_ERROR) { ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, - TLV::TagNumFromTag(dataTlv.GetTag()), TLVError); + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; } } - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfWindowCoveringClusterWindowCoveringGoToLiftValueCallback(liftValue); + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfWindowCoveringClusterWindowCoveringGoToLiftValueCallback(liftValue); + } + else if (1 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 1, + validArgumentCount); + } break; } case ZCL_WINDOW_COVERING_GO_TO_TILT_PERCENTAGE_COMMAND_ID: { - CHIP_ERROR TLVError = CHIP_NO_ERROR; + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint8_t percentageTiltValue; + bool percentageTiltValueExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(dataTlv.GetTag())) { case 0: - TLVError = dataTlv.Get(percentageTiltValue); + if (percentageTiltValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(percentageTiltValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + percentageTiltValueExists = true; + validArgumentCount++; + } break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); break; } - if (TLVError != CHIP_NO_ERROR) + if (TLVUnpackError != CHIP_NO_ERROR) { ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, - TLV::TagNumFromTag(dataTlv.GetTag()), TLVError); + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; } } - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfWindowCoveringClusterWindowCoveringGoToTiltPercentageCallback(percentageTiltValue); + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfWindowCoveringClusterWindowCoveringGoToTiltPercentageCallback(percentageTiltValue); + } + else if (1 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 1, + validArgumentCount); + } break; } case ZCL_WINDOW_COVERING_GO_TO_TILT_VALUE_COMMAND_ID: { - CHIP_ERROR TLVError = CHIP_NO_ERROR; + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; uint16_t tiltValue; + bool tiltValueExists = false; + uint32_t validArgumentCount = 0; while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) { switch (TLV::TagNumFromTag(dataTlv.GetTag())) { case 0: - TLVError = dataTlv.Get(tiltValue); + if (tiltValueExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(tiltValue); + if (CHIP_NO_ERROR == TLVUnpackError) + { + tiltValueExists = true; + validArgumentCount++; + } break; default: // Unsupported tag, ignore it. ChipLogProgress(Zcl, "Unknown TLV tag during processing."); break; } - if (TLVError != CHIP_NO_ERROR) + if (TLVUnpackError != CHIP_NO_ERROR) { ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, - TLV::TagNumFromTag(dataTlv.GetTag()), TLVError); + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; } } - // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. - emberAfWindowCoveringClusterWindowCoveringGoToTiltValueCallback(tiltValue); + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfWindowCoveringClusterWindowCoveringGoToTiltValueCallback(tiltValue); + } + else if (1 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 1, + validArgumentCount); + } break; } case ZCL_WINDOW_COVERING_STOP_COMMAND_ID: { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. emberAfWindowCoveringClusterWindowCoveringStopCallback(); break; } case ZCL_WINDOW_COVERING_UP_OPEN_COMMAND_ID: { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. emberAfWindowCoveringClusterWindowCoveringUpOpenCallback(); break; diff --git a/examples/window-app/common/gen/af-structs.h b/examples/window-app/common/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/examples/window-app/common/gen/af-structs.h +++ b/examples/window-app/common/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/examples/window-app/common/gen/attribute-size.cpp b/examples/window-app/common/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/examples/window-app/common/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index 45c654ea984b0c..7e49b7d56cb668 100644 --- a/src/app/chip-zcl-zpro-codec-api.h +++ b/src/app/chip-zcl-zpro-codec-api.h @@ -33,6 +33,7 @@ | Basic | 0x0028 | | Binding | 0xF000 | | ColorControl | 0x0300 | +| Descriptor | 0x001D | | DoorLock | 0x0101 | | GeneralCommissioning | 0x0030 | | GroupKeyManagement | 0xF004 | @@ -1063,6 +1064,60 @@ encodeColorControlClusterWriteStartUpColorTemperatureMiredsAttribute(uint8_t seq chip::System::PacketBufferHandle encodeColorControlClusterReadClusterRevisionAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/*----------------------------------------------------------------------------*\ +| Cluster Descriptor | 0x001D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceList | 0x0000 | +| * ServerList | 0x0001 | +| * ClientList | 0x0002 | +| * PartsList | 0x0003 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/** + * @brief + * Encode a Descriptor server discover command into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Descriptor server read command for the device list attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterReadDeviceListAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Descriptor server read command for the server list attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterReadServerListAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Descriptor server read command for the client list attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterReadClientListAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Descriptor server read command for the parts list attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterReadPartsListAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Descriptor server read command for the cluster revision attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeDescriptorClusterReadClusterRevisionAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /*----------------------------------------------------------------------------*\ | Cluster DoorLock | 0x0101 | |------------------------------------------------------------------------------| diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index f2468ba61f7ead..a53928c9dd4ed8 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -123,6 +123,7 @@ template("chip_data_model") { if (defined(invoker.zap_pregenerated_dir)) { sources += [ + "${invoker.zap_pregenerated_dir}/attribute-size.cpp", "${invoker.zap_pregenerated_dir}/call-command-handler.cpp", "${invoker.zap_pregenerated_dir}/callback-stub.cpp", ] diff --git a/src/app/clusters/descriptor/descriptor.cpp b/src/app/clusters/descriptor/descriptor.cpp new file mode 100644 index 00000000000000..1c5d0b43d554b2 --- /dev/null +++ b/src/app/clusters/descriptor/descriptor.cpp @@ -0,0 +1,149 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/**************************************************************************** + * @file + * @brief Implementation for the Descriptor Server Cluster + ***************************************************************************/ + +#include "af.h" +#include +#include +#include + +#include "gen/af-structs.h" +#include "gen/attribute-id.h" +#include "gen/attribute-type.h" +#include "gen/cluster-id.h" + +using namespace chip; + +constexpr const char * kErrorStr = "Descriptor cluster (0x%02x) Error setting '%s' attribute: 0x%02x"; + +EmberAfStatus writeAttribute(uint8_t endpoint, AttributeId attributeId, uint8_t * buffer, int32_t index = -1) +{ + EmberAfAttributeSearchRecord record; + record.endpoint = endpoint; + record.clusterId = ZCL_DESCRIPTOR_CLUSTER_ID; + record.clusterMask = CLUSTER_MASK_SERVER; + record.manufacturerCode = EMBER_AF_NULL_MANUFACTURER_CODE; + record.attributeId = attributeId; + + // When reading or writing a List attribute the 'index' value could have 3 types of values: + // -1: Read/Write the whole list content, including the number of elements in the list + // 0: Read/Write the number of elements in the list, represented as a uint16_t + // n: Read/Write the nth element of the list + // + // Since the first 2 bytes of the attribute are used to store the number of elements, elements indexing starts + // at 1. In order to hide this to the rest of the code of this file, the element index is incremented by 1 here. + // This also allows calling writeAttribute() with no index arg to mean "write the length". + return emAfReadOrWriteAttribute(&record, NULL, buffer, 0, true, index + 1); +} + +EmberAfStatus writeClientServerAttribute(uint8_t endpoint, bool server) +{ + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + AttributeId attributeId = server ? ZCL_SERVER_LIST_ATTRIBUTE_ID : ZCL_CLIENT_LIST_ATTRIBUTE_ID; + + uint16_t clusterCount = emberAfClusterCount(endpoint, server); + + EmberAfCluster * cluster; + for (uint8_t clusterIndex = 0; clusterIndex < clusterCount; clusterIndex++) + { + cluster = emberAfGetNthCluster(endpoint, clusterIndex, server); + status = writeAttribute(endpoint, attributeId, (uint8_t *) &cluster->clusterId, clusterIndex); + VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); + } + + return writeAttribute(endpoint, attributeId, (uint8_t *) &clusterCount); +} + +EmberAfStatus writeServerAttribute(uint8_t endpoint) +{ + return writeClientServerAttribute(endpoint, true); +} + +EmberAfStatus writeClientAttribute(uint8_t endpoint) +{ + return writeClientServerAttribute(endpoint, false); +} + +EmberAfStatus writeDeviceAttribute(uint8_t endpoint) +{ + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + AttributeId attributeId = ZCL_DEVICE_LIST_ATTRIBUTE_ID; + + uint16_t deviceTypeCount = 1; + DeviceTypeId deviceTypeId = emberAfDeviceIdFromIndex(endpoint); + uint16_t revision = emberAfDeviceVersionFromIndex(endpoint); + + EmberAfDeviceType deviceType; + deviceType.type = deviceTypeId; + deviceType.revision = revision; + + status = writeAttribute(endpoint, attributeId, (uint8_t *) &deviceType, 0); + VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); + + return writeAttribute(endpoint, attributeId, (uint8_t *) &deviceTypeCount); +} + +EmberAfStatus writePartsAttribute(uint8_t endpoint) +{ + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + AttributeId attributeId = ZCL_PARTS_LIST_ATTRIBUTE_ID; + + uint16_t partsCount = 0; + + if (endpoint == 0x00) + { + for (uint8_t endpointIndex = 1; endpointIndex < emberAfEndpointCount(); endpointIndex++) + { + EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); + status = writeAttribute(endpoint, attributeId, (uint8_t *) &endpointId, partsCount); + VerifyOrReturnError(status == EMBER_ZCL_STATUS_SUCCESS, status); + partsCount++; + } + } + + return writeAttribute(endpoint, attributeId, (uint8_t *) &partsCount); +} + +void emberAfPluginDescriptorServerInitCallback(void) +{ + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + + for (uint8_t index = 0; index < emberAfEndpointCount(); index++) + { + EndpointId endpoint = emberAfEndpointFromIndex(index); + if (!emberAfContainsCluster(endpoint, ZCL_DESCRIPTOR_CLUSTER_ID)) + { + continue; + } + + status = writeDeviceAttribute(endpoint); + VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "device", status)); + + status = writeServerAttribute(endpoint); + VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "server", status)); + + status = writeClientAttribute(endpoint); + VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "client", status)); + + status = writePartsAttribute(endpoint); + VerifyOrReturn(status == EMBER_ZCL_STATUS_SUCCESS, ChipLogError(Zcl, kErrorStr, endpoint, "parts", status)); + } +} diff --git a/src/app/encoder.cpp b/src/app/encoder.cpp index 5ec5c60ec4b64c..30a85a197127b1 100644 --- a/src/app/encoder.cpp +++ b/src/app/encoder.cpp @@ -104,6 +104,7 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a | Basic | 0x0028 | | Binding | 0xF000 | | ColorControl | 0x0300 | +| Descriptor | 0x001D | | DoorLock | 0x0101 | | GeneralCommissioning | 0x0030 | | GroupKeyManagement | 0xF004 | @@ -174,6 +175,8 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a #define ZCL_STEP_SATURATION_COMMAND_ID (0x05) #define ZCL_STOP_MOVE_STEP_COMMAND_ID (0x47) +#define DESCRIPTOR_CLUSTER_ID 0x001D + #define DOOR_LOCK_CLUSTER_ID 0x0101 #define ZCL_CLEAR_ALL_PINS_COMMAND_ID (0x08) #define ZCL_CLEAR_ALL_RFIDS_COMMAND_ID (0x19) @@ -1865,6 +1868,76 @@ PacketBufferHandle encodeColorControlClusterReadClusterRevisionAttribute(uint8_t COMMAND_FOOTER(); } +/*----------------------------------------------------------------------------*\ +| Cluster Descriptor | 0x001D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceList | 0x0000 | +| * ServerList | 0x0001 | +| * ClientList | 0x0002 | +| * PartsList | 0x0003 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +PacketBufferHandle encodeDescriptorClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("DiscoverDescriptorAttributes", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF); + COMMAND_FOOTER(); +} + +/* + * Attribute DeviceList + */ +PacketBufferHandle encodeDescriptorClusterReadDeviceListAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadDescriptorDeviceList", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000); + COMMAND_FOOTER(); +} + +/* + * Attribute ServerList + */ +PacketBufferHandle encodeDescriptorClusterReadServerListAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadDescriptorServerList", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0001); + COMMAND_FOOTER(); +} + +/* + * Attribute ClientList + */ +PacketBufferHandle encodeDescriptorClusterReadClientListAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadDescriptorClientList", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0002); + COMMAND_FOOTER(); +} + +/* + * Attribute PartsList + */ +PacketBufferHandle encodeDescriptorClusterReadPartsListAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadDescriptorPartsList", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0003); + COMMAND_FOOTER(); +} + +/* + * Attribute ClusterRevision + */ +PacketBufferHandle encodeDescriptorClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadDescriptorClusterRevision", DESCRIPTOR_CLUSTER_ID); + buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD); + COMMAND_FOOTER(); +} + /*----------------------------------------------------------------------------*\ | Cluster DoorLock | 0x0101 | |------------------------------------------------------------------------------| diff --git a/src/app/reporting/reporting.cpp b/src/app/reporting/reporting.cpp index 28c752f9fa33f2..52406f0eb2ee3b 100644 --- a/src/app/reporting/reporting.cpp +++ b/src/app/reporting/reporting.cpp @@ -245,7 +245,7 @@ void emberAfPluginReportingTickEventHandler(void) } // find size of current report - dataSize = emberAfAttributeValueSize(dataType, readData); + dataSize = emberAfAttributeValueSize(entry.clusterId, entry.attributeId, dataType, readData); reportSize = static_cast(sizeof(entry.attributeId) + sizeof(dataType) + dataSize); // If we have already started a report for a different attribute or diff --git a/src/app/util/af.h b/src/app/util/af.h index 41f37741aad6b2..e6a04d8aaa1f36 100644 --- a/src/app/util/af.h +++ b/src/app/util/af.h @@ -569,13 +569,47 @@ uint8_t emberAfStringLength(const uint8_t * buffer); */ uint16_t emberAfLongStringLength(const uint8_t * buffer); +/* + * @brief Function that copies (part of) a ZCL typed list into a buffer. The index parameter + * may indicate a specific member of the list, or the list length, or the whole list if it + * is equal to -1. + * + * Individual elements may be accessed by an index of type 16-bit unsigned integer. + * Elements are numbered from 1 upwards. The element with index 0 is always of type + * uint16, and holds the number of elements contained in the list, which may be zero. + * If the zeroth element contains 0xffff, the list is a non value and is considered + * undefined. + * + * When writing, dest points to the list to write to, src points to the value to write, and index is the index to write at. + * + * When reading (i.e write is false), dest is the location to read into, src points to the list, and index is the index to read + * from. + * + * When reading or writing if the index leads to read or write outside of the + * allocated size for the list, this function will return 0. + * + * @return The number of bytes copied + */ +uint16_t emberAfCopyList(chip::ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index); + /* * @brief Function that determines the size of a zigbee Cluster Library * attribute value (where the attribute could be non-string, string, or long * string). For strings, the size includes the length of the string plus the * number of the string's length prefix byte(s). */ -uint16_t emberAfAttributeValueSize(EmberAfAttributeType dataType, const uint8_t * buffer); +uint16_t emberAfAttributeValueSize(chip::ClusterId clusterId, chip::AttributeId attributeId, EmberAfAttributeType dataType, + const uint8_t * buffer); + +/* + * @brief Function that determines the size of a zigbee Cluster Library + * attribute List[T] where T could be of any type. + * The size is expressed in bytes, and includes the used length consumed + * by list entries plus the 2 bytes used to represent the number of actual + * entries in the list. + */ +uint16_t emberAfAttributeValueListSize(chip::ClusterId clusterId, chip::AttributeId attributeId, const uint8_t * buffer); /** @} END Attribute Storage */ @@ -645,6 +679,9 @@ bool emberAfIsStringAttributeType(EmberAfAttributeType attributeType); /** @brief Returns true if the given attribute type is a long string. */ bool emberAfIsLongStringAttributeType(EmberAfAttributeType attributeType); +/** @brief Returns true if a given ZCL data type is a list type. */ +bool emberAfIsThisDataTypeAListType(EmberAfAttributeType dataType); + /** * @brief The mask applied by ::emberAfNextSequence when generating ZCL * sequence numbers. diff --git a/src/app/util/attribute-size.cpp b/src/app/util/attribute-size.cpp index 164135e857090e..36ea019a9dda41 100644 --- a/src/app/util/attribute-size.cpp +++ b/src/app/util/attribute-size.cpp @@ -43,6 +43,8 @@ #include "gen/attribute-type.h" +using namespace chip; + static const uint8_t attributeSizes[] = { #include "gen/attribute-size.h" }; @@ -60,7 +62,7 @@ uint8_t emberAfGetDataSize(uint8_t dataType) return 0; } -uint16_t emberAfAttributeValueSize(EmberAfAttributeType dataType, const uint8_t * buffer) +uint16_t emberAfAttributeValueSize(ClusterId clusterId, AttributeId attrId, EmberAfAttributeType dataType, const uint8_t * buffer) { // If the dataType is a string or long string, refer to the buffer for the // string's length prefix; size is string length plus number of prefix bytes. @@ -87,6 +89,13 @@ uint16_t emberAfAttributeValueSize(EmberAfAttributeType dataType, const uint8_t } } } + else if (emberAfIsThisDataTypeAListType(dataType)) + { + if (buffer != 0) + { + dataSize = emberAfAttributeValueListSize(clusterId, attrId, buffer); + } + } else { dataSize = (uint16_t) emberAfGetDataSize(dataType); diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 497dd4fd5aff04..a84faced9d0317 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -180,6 +180,11 @@ bool emberAfIsLongStringAttributeType(EmberAfAttributeType attributeType) return (attributeType == ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE || attributeType == ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE); } +bool emberAfIsThisDataTypeAListType(EmberAfAttributeType dataType) +{ + return dataType == ZCL_ARRAY_ATTRIBUTE_TYPE; +} + // This function is used to call the per-cluster default response callback void emberAfClusterDefaultResponseWithMfgCodeCallback(EndpointId endpoint, ClusterId clusterId, uint8_t commandId, EmberAfStatus status, uint8_t clientServerMask, uint16_t manufacturerCode) @@ -370,8 +375,13 @@ static uint8_t * singletonAttributeLocation(EmberAfAttributeMetadata * am) // If src == NULL, then this method will set memory to zeroes // See documentation for emAfReadOrWriteAttribute for the semantics of // readLength when reading and writing. -static EmberAfStatus typeSensitiveMemCopy(uint8_t * dest, uint8_t * src, EmberAfAttributeMetadata * am, bool write, - uint16_t readLength) +// +// The index argument is used exclusively for List. When reading or writing a List attribute, it could take 3 types of values: +// -1: Read/Write the whole list content, including the number of elements in the list +// 0: Read/Write the number of elements in the list, represented as a uint16_t +// n: Read/Write the nth element of the list +static EmberAfStatus typeSensitiveMemCopy(ClusterId clusterId, uint8_t * dest, uint8_t * src, EmberAfAttributeMetadata * am, + bool write, uint16_t readLength, int32_t index) { EmberAfAttributeType attributeType = am->attributeType; // readLength == 0 for a read indicates that we should just trust that the @@ -395,6 +405,15 @@ static EmberAfStatus typeSensitiveMemCopy(uint8_t * dest, uint8_t * src, EmberAf } emberAfCopyLongString(dest, src, static_cast(bufferSize - 2)); } + else if (emberAfIsThisDataTypeAListType(attributeType)) + { + if (bufferSize < 2) + { + return EMBER_ZCL_STATUS_INSUFFICIENT_SPACE; + } + + emberAfCopyList(clusterId, am, write, dest, src, index); + } else { if (!ignoreReadLength && readLength < am->size) @@ -503,7 +522,7 @@ bool emAfMatchAttribute(EmberAfCluster * cluster, EmberAfAttributeMetadata * am, // attribute. This means the resulting string may be truncated. The length // byte(s) in the resulting string will reflect any truncated. EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, EmberAfAttributeMetadata ** metadata, - uint8_t * buffer, uint16_t readLength, bool write) + uint8_t * buffer, uint16_t readLength, bool write, int32_t index) { uint8_t i; uint16_t attributeOffsetIndex = 0; @@ -576,7 +595,7 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, attRecord->endpoint, attRecord->clusterId, am, emAfGetManufacturerCodeForAttribute(cluster, am), buffer, emberAfAttributeSize(am)) - : typeSensitiveMemCopy(dst, src, am, write, readLength)); + : typeSensitiveMemCopy(attRecord->clusterId, dst, src, am, write, readLength, index)); } } else diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index a8dc26d5e58534..5f67c4e9887640 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -94,7 +94,7 @@ bool emberAfExtractCommandIds(bool outgoing, EmberAfClusterCommand * cmd, chip:: uint16_t bufferLength, uint16_t * bufferIndex, uint8_t startId, uint8_t maxIdCount); EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, EmberAfAttributeMetadata ** metadata, - uint8_t * buffer, uint16_t readLength, bool write); + uint8_t * buffer, uint16_t readLength, bool write, int32_t index = -1); bool emAfMatchCluster(EmberAfCluster * cluster, EmberAfAttributeSearchRecord * attRecord); bool emAfMatchAttribute(EmberAfCluster * cluster, EmberAfAttributeMetadata * am, EmberAfAttributeSearchRecord * attRecord); diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index b8d6ed9712046b..e32260ec07fe55 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -357,7 +357,7 @@ void emberAfRetrieveAttributeAndCraftResponse(EndpointId endpoint, ClusterId clu status = emAfReadAttribute(endpoint, clusterId, attrId, mask, manufacturerCode, data, ATTRIBUTE_LARGEST, &dataType); if (status == EMBER_ZCL_STATUS_SUCCESS) { - dataLen = emberAfAttributeValueSize(dataType, data); + dataLen = emberAfAttributeValueSize(clusterId, attrId, dataType, data); if ((readLength - 4) < dataLen) { // Not enough space for attribute. return; @@ -428,7 +428,7 @@ EmberAfStatus emberAfAppendAttributeReportFields(EndpointId endpoint, ClusterId goto kickout; } - size = emberAfAttributeValueSize(type, data); + size = emberAfAttributeValueSize(clusterId, attributeId, type, data); if (bufLen16 - *bufIndex < 3 || size > bufLen16 - (*bufIndex + 3)) { status = EMBER_ZCL_STATUS_INSUFFICIENT_SPACE; diff --git a/src/app/util/process-global-message.cpp b/src/app/util/process-global-message.cpp index 9b2f43cc979dd9..e45f1dec9599c3 100644 --- a/src/app/util/process-global-message.cpp +++ b/src/app/util/process-global-message.cpp @@ -249,7 +249,7 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd) attrId = emberAfGetInt16u(message, msgIndex, msgLen); dataType = emberAfGetInt8u(message, msgIndex + 2, msgLen); - dataSize = emberAfAttributeValueSize(dataType, message + msgIndex + 3); + dataSize = emberAfAttributeValueSize(clusterId, attrId, dataType, message + msgIndex + 3); // Check to see if there are dataSize bytes left in the message if it is a string if (emberAfIsThisDataTypeAStringType(dataType) && (dataSize < msgLen - (msgIndex + 3))) @@ -327,7 +327,7 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd) attrId = emberAfGetInt16u(message, msgIndex, msgLen); dataType = emberAfGetInt8u(message, msgIndex + 2, msgLen); - dataSize = emberAfAttributeValueSize(dataType, message + msgIndex + 3); + dataSize = emberAfAttributeValueSize(clusterId, attrId, dataType, message + msgIndex + 3); // the data is sent little endian over-the-air, it needs to be // inserted into the table big endian for the EM250 and little diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 105babca186168..6df97ba600074b 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -139,6 +139,9 @@ void emberAfPluginBarrierControlServerInitCallback(void); #ifdef EMBER_AF_PLUGIN_DOOR_LOCK_SERVER void emberAfPluginDoorLockServerInitCallback(void); #endif +#ifdef ZCL_USING_DESCRIPTOR_CLUSTER_SERVER +void emberAfPluginDescriptorServerInitCallback(void); +#endif #ifdef EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS EMBER_AF_GENERATED_PLUGIN_TICK_FUNCTION_DECLARATIONS @@ -298,6 +301,9 @@ void emberAfInit(void) #ifdef EMBER_AF_PLUGIN_DOOR_LOCK_SERVER emberAfPluginDoorLockServerInitCallback(); #endif +#ifdef ZCL_USING_DESCRIPTOR_CLUSTER_SERVER + emberAfPluginDescriptorServerInitCallback(); +#endif emAfCallInits(); } diff --git a/src/app/zap-templates/app-templates.json b/src/app/zap-templates/app-templates.json index 01ab9eb959a4d7..01f8fa0edbe57e 100644 --- a/src/app/zap-templates/app-templates.json +++ b/src/app/zap-templates/app-templates.json @@ -2,6 +2,7 @@ "name": "CHIP Application templates", "version": "chip-v1", "helpers": [ + "common/ListHelper.js", "common/StringHelper.js", "templates/app/helper.js", "templates/chip/helper.js" @@ -50,6 +51,11 @@ "name": "ZCL attribute-type header", "output": "attribute-type.h" }, + { + "path": "templates/app/attribute-size-src.zapt", + "name": "ZCL attribute-size", + "output": "attribute-size.cpp" + }, { "path": "templates/app/attribute-size.zapt", "name": "ZCL attribute-size header", diff --git a/src/app/zap-templates/common/ClustersHelper.js b/src/app/zap-templates/common/ClustersHelper.js new file mode 100644 index 00000000000000..7e83868f3ec812 --- /dev/null +++ b/src/app/zap-templates/common/ClustersHelper.js @@ -0,0 +1,461 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Import helpers from zap core +const zapPath = '../../../../third_party/zap/repo/src-electron/'; +const queryConfig = require(zapPath + 'db/query-config.js') +const queryImpexp = require(zapPath + 'db/query-impexp.js') +const queryEndpoint = require(zapPath + 'db/query-endpoint.js') +const templateUtil = require(zapPath + 'generator/template-util.js') +const zclHelper = require(zapPath + 'generator/helper-zcl.js') +const zclQuery = require(zapPath + 'db/query-zcl.js') + +const { Deferred } = require('./Deferred.js'); +const ListHelper = require('./ListHelper.js'); +const StringHelper = require('./StringHelper.js'); +const ChipTypesHelper = require('./ChipTypesHelper.js'); + +// +// Load Step 1 +// +function loadAtomics(packageId) +{ + const { db, sessionId } = this.global; + const options = { 'hash' : {} }; + + const resolveZclTypes = atomics => Promise.all(atomics.map(atomic => { + return zclHelper.asUnderlyingZclType.call(this, atomic.name, options).then(zclType => { + atomic.chipType = zclType; + return atomic; + }); + })); + + return zclQuery.selectAllAtomics(db, packageId).then(resolveZclTypes); +} + +function loadBitmaps(packageId) +{ + const { db, sessionId } = this.global; + return zclQuery.selectAllBitmaps(db, packageId); +} + +function loadEnums(packageId) +{ + const { db, sessionId } = this.global; + return zclQuery.selectAllEnums(db, packageId); +} + +function loadStructItems(struct, packageId) +{ + const { db, sessionId } = this.global; + return zclQuery.selectAllStructItemsById(db, struct.id).then(structItems => { + struct.items = structItems; + return struct; + }); +} + +function loadStructs(packageId) +{ + const { db, sessionId } = this.global; + return zclQuery.selectAllStructs(db, packageId) + .then(structs => Promise.all(structs.map(struct => loadStructItems.call(this, struct, packageId)))); +} + +function loadClusters() +{ + const { db, sessionId } = this.global; + return queryImpexp.exportEndPointTypeIds(db, sessionId) + .then(endpointTypes => zclQuery.exportAllClustersDetailsFromEndpointTypes(db, endpointTypes)) + .then(clusters => clusters.filter(cluster => cluster.enabled == 1)); +} + +function loadCommandArguments(command, packageId) +{ + const { db, sessionId } = this.global; + return zclQuery.selectCommandArgumentsByCommandId(db, command.id, packageId).then(commandArguments => { + command.arguments = commandArguments; + return command; + }); +} + +function loadCommands(packageId) +{ + const { db, sessionId } = this.global; + return queryImpexp.exportEndPointTypeIds(db, sessionId) + .then(endpointTypes => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(db, endpointTypes)) + .then(endpointTypesAndClusters => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters(db, endpointTypesAndClusters)) + .then(commands => Promise.all(commands.map(command => loadCommandArguments.call(this, command, packageId)))); +} + +function loadAttributes(packageId) +{ + // The 'server' side is enforced here, because the list of attributes is used to generate client global + // commands to retrieve server side attributes. + const { db, sessionId } = this.global; + return queryImpexp.exportEndPointTypeIds(db, sessionId) + .then(endpointTypes => Promise.all( + endpointTypes.map(({ endpointTypeId }) => queryEndpoint.queryEndpointClusters(db, endpointTypeId)))) + .then(clusters => clusters.flat()) + .then(clusters => Promise.all( + clusters.map(({ clusterId, side, endpointTypeId }) => queryEndpoint.queryEndpointClusterAttributes( + db, clusterId, 'server', endpointTypeId)))) + .then(attributes => attributes.flat()) + .then(attributes => attributes.filter(attribute => attribute.isIncluded)) + .then(attributes => attributes.sort((a, b) => a.code - b.code)); + //.then(attributes => Promise.all(attributes.map(attribute => types.typeSizeAttribute(db, packageId, attribute)) +} + +// +// Load step 2 +// + +/** + * This method converts a ZCL type to the length expected for the + * BufferWriter.Put method. + * TODO + * Not all types are supported at the moment, so if there is any unsupported type + * that we are trying to convert, it will throw an error. + */ +function asPutLength(zclType) +{ + const type = ChipTypesHelper.asBasicType(zclType); + switch (type) { + case 'int8_t': + case 'int16_t': + case 'int32_t': + case 'int64_t': + case 'uint8_t': + case 'uint16_t': + case 'uint32_t': + case 'uint64_t': + return type.replace(/[^0-9]/g, ''); + default: + throw error = 'asPutLength: Unhandled type: ' + zclType; + } +} + +function asPutCastType(zclType) +{ + const type = ChipTypesHelper.asBasicType(zclType); + switch (type) { + case 'int8_t': + case 'int16_t': + case 'int32_t': + case 'int64_t': + return 'u' + type; + case 'uint8_t': + case 'uint16_t': + case 'uint32_t': + case 'uint64_t': + return type; + default: + throw error = 'asPutCastType: Unhandled type: ' + zclType; + } +} + +function getAtomic(atomics, type) +{ + return atomics.find(atomic => atomic.name == type.toLowerCase()); +} + +function getBitmap(bitmaps, type) +{ + return bitmaps.find(bitmap => bitmap.label == type); +} + +function getEnum(enums, type) +{ + return enums.find(enumItem => enumItem.label == type); +} + +function getStruct(structs, type) +{ + return structs.find(struct => struct.label == type); +} + +function handleString(item, [ atomics, enums, bitmaps, structs ]) +{ + if (!StringHelper.isString(item.type)) { + return false; + } + + const atomic = getAtomic(atomics, item.type); + if (!atomic) { + return false; + } + + item.atomicTypeId = atomic.atomicId; + item.chipType = 'chip::ByteSpan'; + item.size = item.maxLength; + item.name = item.name || item.label; + return true; +} + +function handleList(item, [ atomics, enums, bitmaps, structs ]) +{ + if (!ListHelper.isList(item.type)) { + return false; + } + + const entryType = item.entryType; + if (!entryType) { + console.log(item); + throw new Error(item.label, 'List[T] is missing type "T" information'); + } + + item.isList = true; + item.type = entryType; + enhancedItem(item, [ atomics, enums, bitmaps, structs ]); + + return true; +} + +function handleStruct(item, [ atomics, enums, bitmaps, structs ]) +{ + const struct = getStruct(structs, item.type); + if (!struct) { + return false; + } + + item.isStruct = true; + // Add a leading `_` before the name of struct to match what is done in the af-structs.zapt template. + // For instance structs are declared as "typedef struct _{{asType label}}". + item.chipType = '_' + item.type; + + struct.items.map(structItem => enhancedItem(structItem, [ atomics, enums, bitmaps, structs ])); + item.items = struct.items; + item.size = struct.items.map(type => type.size).reduce((accumulator, currentValue) => accumulator + currentValue, 0); + return true; +} + +function handleBasic(item, [ atomics, enums, bitmaps, structs ]) +{ + let itemType = item.type; + + const enumItem = getEnum(enums, itemType); + if (enumItem) { + itemType = enumItem.type; + } + + const bitmap = getBitmap(bitmaps, itemType); + if (bitmap) { + itemType = bitmap.type; + } + + const atomic = getAtomic(atomics, itemType); + if (atomic) { + item.name = item.name || item.label; + item.isStruct = false; + item.atomicTypeId = atomic.atomicId; + item.discrete = atomic.discrete; + item.size = atomic.size; + item.chipType = atomic.chipType; + // For the moment, SECURITY_KEY is unhandled. + if (atomic.atomicId != 0xF1) { + item.chipTypePutLength = asPutLength(atomic.chipType); + item.chipTypePutCastType = asPutCastType(atomic.chipType); + } + return true; + } + + return false; +} + +function enhancedItem(item, types) +{ + if (handleString(item, types)) { + return; + } + + if (handleList(item, types)) { + return; + } + + if (handleStruct(item, types)) { + return; + } + + if (handleBasic(item, types)) { + return; + } + + console.log(item); + throw new Error(item.type + ' not found.'); +} + +function inlineStructItems(args) +{ + const arguments = []; + args.forEach(argument => { + if (!argument.isStruct) { + arguments.push(argument); + return; + } + + argument.items.forEach(item => { + arguments.push(item); + }); + }); + + return arguments; +} + +function enhancedCommands(commands, types) +{ + commands.forEach(command => { + command.arguments.forEach(argument => { + enhancedItem(argument, types); + }); + }); + + // At this stage, 'command.arguments' may contains 'struct'. But controllers does not know (yet) how + // to handle them. So those needs to be inlined. + commands.forEach(command => { + command.arguments = inlineStructItems(command.arguments); + }); + return commands; +} + +function enhancedAttributes(attributes, types) +{ + attributes.forEach(attribute => { + enhancedItem(attribute, types); + }); + + // At this stage, the 'attributes' array contains all attributes enabled for all endpoints. It means + // that a lot of attributes are duplicated if a cluster is enabled on multiple endpoints but that's + // not what the templates expect. So let's deduplicate them. + const compare = (a, b) => (a.name == b.name && a.clusterId == b.clusterId && a.side == b.side); + return attributes.filter((att, index) => attributes.findIndex(att2 => compare(att, att2)) == index); +} + +const Clusters = { + ready : new Deferred() +}; + +Clusters.init = function(context, packageId) { + if (this.ready.running) + { + return this.ready; + } + this.ready.running = true; + + const loadTypes = [ + loadAtomics.call(context, packageId), + loadEnums.call(context, packageId), + loadBitmaps.call(context, packageId), + loadStructs.call(context, packageId), + ]; + + const promises = [ + Promise.all(loadTypes), + loadClusters.call(context), + loadCommands.call(context, packageId), + loadAttributes.call(context, packageId), + ]; + + return Promise.all(promises).then(([types, clusters, commands, attributes]) => { + this._clusters = clusters; + this._commands = enhancedCommands(commands, types); + this._attributes = enhancedAttributes(attributes, types); + + return this.ready.resolve(); + }); +} + + +// +// Helpers: All +// +Clusters.getClusters = function() +{ + return this.ready.then(() => this._clusters); +} + +Clusters.getCommands = function(name, side) +{ + const filter = command => command.clusterName == name && command.clusterSide == side && command.name.includes('Response') == false; + return this.ready.then(() => this._commands.filter(filter)); +} + +Clusters.getResponses = function(name, side) +{ + const filter = command => command.clusterName == name && command.clusterSide == side && command.name.includes('Response') == true; + return this.ready.then(() => this._commands.filter(filter)); +} + +Clusters.getAttributes = function(name, side) +{ + return this.ready.then(() => { + const code = this._clusters.find(cluster => cluster.name == name).id; + const filter = attribute => attribute.clusterId == code && attribute.side == side; + return this._attributes.filter(filter); + }); +} + +// +// Helpers: Client +// +Clusters.getClientClusters = function() +{ + const filter = cluster => cluster.side == 'client'; + return this.ready.then(() => this._clusters.filter(filter)); +} + +Clusters.getClientCommands = function(name) +{ + return this.getCommands(name, 'client'); +} + +Clusters.getClientResponses = function(name) +{ + return this.getResponses(name, 'client'); +} + +Clusters.getClientAttributes = function(name) +{ + return this.getAttributes(name, 'client'); +} + +// +// Helpers: Server +// +Clusters.getServerClusters = function() +{ + const filter = cluster => cluster.side == 'server'; + return this.ready.then(() => this._clusters.filter(filter)); +} + +Clusters.getServerCommands = function(name) +{ + return this.getCommands(name, 'server'); +} + +Clusters.getServerResponses = function(name) +{ + return this.getResponses(name, 'server'); +} + +Clusters.getServerAttributes = function(name) +{ + return this.getAttributes(name, 'server'); +} + +// +// Module exports +// +exports.Clusters = Clusters; diff --git a/src/app/zap-templates/common/Deferred.js b/src/app/zap-templates/common/Deferred.js new file mode 100644 index 00000000000000..fa6da232c0a75d --- /dev/null +++ b/src/app/zap-templates/common/Deferred.js @@ -0,0 +1,35 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function Deferred() +{ + let resolve, reject; + + let promise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + + promise.resolve = resolve; + promise.reject = reject; + return promise; +} + +// +// Module exports +// +exports.Deferred = Deferred; diff --git a/src/app/zap-templates/common/ListHelper.js b/src/app/zap-templates/common/ListHelper.js new file mode 100644 index 00000000000000..4e6011adfa5f95 --- /dev/null +++ b/src/app/zap-templates/common/ListHelper.js @@ -0,0 +1,28 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const listType = 'ARRAY'; + +function isList(type) +{ + return type.toUpperCase() == listType; +} + +// +// Module exports +// +exports.isList = isList; diff --git a/src/app/zap-templates/partials/cluster_header.zapt b/src/app/zap-templates/partials/cluster_header.zapt index 3db6ee83fbbef4..0b418b57acd411 100644 --- a/src/app/zap-templates/partials/cluster_header.zapt +++ b/src/app/zap-templates/partials/cluster_header.zapt @@ -8,6 +8,6 @@ {{pad "|" 79 '-'}}| {{pad "| Attributes: " 70 ' '}}{{pad "| " 9 ' '}}| {{#chip_server_cluster_attributes}} -{{pad (concat "| * " (asCamelCased name false)) 70 ' '}}{{pad (concat "| " (asHex attributeCode 4)) 9 ' '}}| +{{pad (concat "| * " (asCamelCased name false)) 70 ' '}}{{pad (concat "| " (asHex code 4)) 9 ' '}}| {{/chip_server_cluster_attributes}} {{pad '\*' 78 '-'}}*/ diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt index e2421ceea12438..1b522ba0aae612 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt @@ -254,7 +254,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag case 0x38: // semi / Semi-precision case 0x39: // single / Single precision case 0x3A: // double / Double precision - case 0x48: // array / Array case 0x49: // struct / Structure case 0x50: // set / Set case 0x51: // bag / Bag @@ -305,6 +304,52 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag cb->mCall(cb->mContext, chip::ByteSpan(message, length)); break; } + case 0x48: // array / Array + { + CHECK_MESSAGE_LENGTH(2); + uint16_t count = chip::Encoding::LittleEndian::Read16(message); + ChipLogProgress(Zcl, " count: %lu", count); + + switch (clusterId) + { +{{#chip_client_clusters}} +{{#if (chip_server_has_list_attributes)}} + case {{asHex code 4}}: + switch (attributeId) + { +{{#chip_server_cluster_attributes}} + {{#if isList}} + case {{asHex code 4}}: // {{type}} + { + {{chipType}} data[count]; + for (size_t i = 0; i < count; i++) + { + {{#if isStruct}} + {{#chip_attribute_list_entryTypes}} + data[i].{{name}} = emberAfGet{{asReadType type}}(message, 0, messageLen); + message += {{size}}; + CHECK_MESSAGE_LENGTH({{size}}); + {{/chip_attribute_list_entryTypes}} + {{else}} + data[i] = emberAfGet{{asReadType type}}(message, 0, messageLen); + message += {{size}}; + CHECK_MESSAGE_LENGTH({{size}}); + {{/if}} + } + + Callback::Callback<{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeCallback> * cb = Callback::Callback<{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeCallback>::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + {{/if}} +{{/chip_server_cluster_attributes}} + } + break; +{{/if}} +{{/chip_client_clusters}} + } + break; + } case 0x08: // data8 / 8-bit data case 0x18: // map8 / 8-bit bitmap diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt index cf67fd42ed816a..fd93e1eed281b1 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt @@ -4,6 +4,7 @@ #pragma once #include +#include #include // Global Response Callbacks @@ -35,3 +36,12 @@ typedef void (*{{asCamelCased parent.name false}}Cluster{{asCamelCased name fals {{/if}} {{/chip_client_clusters}} {{/if}} + +// List specific responses +{{#chip_client_clusters}} +{{#chip_server_cluster_attributes}} +{{#if isList}} +typedef void (*{{asCamelCased parent.name false}}{{asCamelCased name false}}ListAttributeCallback)(void * context, uint16_t count, {{chipType}} * entries); +{{/if}} +{{/chip_server_cluster_attributes}} +{{/chip_client_clusters}} diff --git a/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt b/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt index 5feb5d8e4172e8..794df9a610ddd0 100644 --- a/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt @@ -477,6 +477,7 @@ private: {{/chip_server_cluster_commands}} {{#chip_server_cluster_attributes}} +{{#unless isList}} - (void)readAttribute{{asCamelCased name false}}:(ResponseHandler)completionHandler { CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge * onSuccess = new CHIP{{asCallbackAttributeType atomicTypeId}}AttributeCallbackBridge(completionHandler, [self callbackQueue]{{#if (isString type)}},{{#if (isOctetString type)}}true{{else}}false{{/if}}{{/if}}); @@ -573,6 +574,7 @@ private: } {{/if}} +{{/unless}} {{/chip_server_cluster_attributes}} @end diff --git a/src/app/zap-templates/templates/app/CHIPClustersObjc.zapt b/src/app/zap-templates/templates/app/CHIPClustersObjc.zapt index b2df6231bc2cc7..085ac127e3eeb1 100644 --- a/src/app/zap-templates/templates/app/CHIPClustersObjc.zapt +++ b/src/app/zap-templates/templates/app/CHIPClustersObjc.zapt @@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN {{/chip_server_cluster_commands}} {{#chip_server_cluster_attributes}} +{{#unless isList}} - (void)readAttribute{{asCamelCased name false}}:(ResponseHandler)completionHandler; {{#if (isWritableAttribute)}} - (void)writeAttribute{{asCamelCased name false}}:({{asObjectiveCBasicType type}})value completionHandler:(ResponseHandler)completionHandler; @@ -50,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN - (void) configureAttribute{{asCamelCased name false}}:(uint16_t)minInterval maxInterval:(uint16_t)maxInterval{{#unless (isDiscreteType)}} change:({{chipType}})change{{/unless}} completionHandler:(ResponseHandler)completionHandler; - (void) reportAttribute{{asCamelCased name false}}:(ResponseHandler)reportHandler; {{/if}} +{{/unless}} {{/chip_server_cluster_attributes}} @end diff --git a/src/app/zap-templates/templates/app/attribute-size-src.zapt b/src/app/zap-templates/templates/app/attribute-size-src.zapt new file mode 100644 index 00000000000000..d80050f59c65e3 --- /dev/null +++ b/src/app/zap-templates/templates/app/attribute-size-src.zapt @@ -0,0 +1,152 @@ +{{> header}} + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dest is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dest is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + {{#chip_server_clusters}} + {{#if (chip_has_list_attributes)}} + case {{asHex code 4}}: // {{name}} Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (am->attributeId) + { + {{#chip_server_cluster_attributes}} + {{#if isList}} + case {{asHex code 4}}: // {{name}} + { + entryLength = {{size}}; + if (((index - 1) * entryLength) > (am->size - entryLength)) + { + ChipLogError(Zcl, "Index %l is invalid.", index); + return 0; + } + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + {{#if isStruct}} + // Struct {{chipType}} + {{chipType}} * entry = reinterpret_cast<{{chipType}} *>(write ? src : dest); + {{#chip_attribute_list_entryTypes}} + {{#if (isString type)}} + copyListMember(write ? dest : (uint8_t *)&entry->{{name}}, write ? (uint8_t *)&entry->{{name}} : src, write, &entryOffset, {{maxLength}}); // {{type}} + {{else}} + copyListMember(write ? dest : (uint8_t *)&entry->{{name}}, write ? (uint8_t *)&entry->{{name}} : src, write, &entryOffset, sizeof(entry->{{name}})); // {{type}} + {{/if}} + {{/chip_attribute_list_entryTypes}} + {{else}} + copyListMember(dest, src, write, &entryOffset, entryLength); // {{type}} + {{/if}} + break; + } + {{/if}} + {{/chip_server_cluster_attributes}} + } + break; + } +{{/if}} +{{/chip_server_clusters}} + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { +{{#chip_server_clusters}} +{{#if (chip_has_list_attributes)}} + case {{asHex code 4}}: // {{name}} Cluster + switch (attributeId) + { + {{#chip_server_cluster_attributes}} + {{#if isList}} + case {{asHex code 4}}: // {{name}} + {{#if isStruct}} + // Struct {{chipType}} + {{else}} + // {{chipType}} + {{/if}} + entryLength = {{size}}; + break; + {{/if}} + {{/chip_server_cluster_attributes}} + } + break; +{{/if}} +{{/chip_server_clusters}} + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index ca1ed681b5e53d..12d7818764883b 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -37,7 +37,7 @@ const ChipTypesHelper = require('../../common/ChipTypesHelper.js'); */ function user_cluster_has_enabled_manufacturer_command(name, side, options) { - return queryImpexp.exportendPointTypeIds(this.global.db, this.global.sessionId) + return queryImpexp.exportEndPointTypeIds(this.global.db, this.global.sessionId) .then((endpointTypes) => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(this.global.db, endpointTypes)) .then((endpointsAndClusters) => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters( this.global.db, endpointsAndClusters)) diff --git a/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt b/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt index c430ae2b37b85e..840f1b50d835be 100644 --- a/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt +++ b/src/app/zap-templates/templates/chip/CHIPClusters-src.zapt @@ -90,7 +90,7 @@ CHIP_ERROR {{asCamelCased parent.name false}}Cluster::ConfigureAttribute{{asCame CHIP_ERROR {{asCamelCased parent.name false}}Cluster::ReportAttribute{{asCamelCased name false}}(Callback::Cancelable * onReportCallback) { - return RequestAttributeReporting({{asHex attributeCode 4}}, onReportCallback); + return RequestAttributeReporting({{asHex code 4}}, onReportCallback); } {{/if}} diff --git a/src/app/zap-templates/templates/chip/ListHelper.js b/src/app/zap-templates/templates/chip/ListHelper.js new file mode 100644 index 00000000000000..0713e5d667310b --- /dev/null +++ b/src/app/zap-templates/templates/chip/ListHelper.js @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2020-2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const kListAttributeAtomicTypeId = 0x48; + +/** + * Returns the calculated length of the given attribute list + * + * This function is meant to be used inside a {{#chip_server_cluster_attributes}} block. + * It will throws otherwise. + * + * @param {*} options + */ +function asListEntryLength(options) +{ + return this.size; + if (this.atomicTypeId == undefined) { + const error = 'asListEntryLength: missing atomic type.'; + console.log(error); + throw error; + } + + if (this.atomicTypeId != kListAttributeAtomicTypeId) { + const error = 'asListEntryLength: Not a list.'; + console.log(error); + throw error; + } + + const entryType = this.entryType; + return entryType.size || entryType.map(type => type.size).reduce((accumulator, currentValue) => accumulator + currentValue, 0); +} + +// +// Module exports +// +exports.asListEntryLength = asListEntryLength; diff --git a/src/app/zap-templates/templates/chip/encoder-src.zapt b/src/app/zap-templates/templates/chip/encoder-src.zapt index eccb51867fa7f4..269aa65ce02e59 100644 --- a/src/app/zap-templates/templates/chip/encoder-src.zapt +++ b/src/app/zap-templates/templates/chip/encoder-src.zapt @@ -180,7 +180,7 @@ PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterRead{{asCamelC buf.Put8(kFrameControlGlobalCommand) .Put8(seqNum) .Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID) - .Put16({{asHex attributeCode 4}}); + .Put16({{asHex code 4}}); COMMAND_FOOTER(); } @@ -200,7 +200,7 @@ PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterWrite{{asCamel buf.Put8(kFrameControlGlobalCommand) .Put8(seqNum) .Put8(ZCL_WRITE_ATTRIBUTES_COMMAND_ID) - .Put16({{asHex attributeCode 4}}) + .Put16({{asHex code 4}}) .Put8({{atomicTypeId}}) {{#if (isString type)}} .Put(static_cast<{{#if (isShortString type)}}uint8_t{{else}}uint16_t{{/if}}>({{asCamelCased name}}StrLen)) @@ -221,7 +221,7 @@ PacketBufferHandle encode{{asCamelCased parent.name false}}ClusterConfigure{{asC .Put8(seqNum) .Put8(ZCL_CONFIGURE_REPORTING_COMMAND_ID) .Put8(EMBER_ZCL_REPORTING_DIRECTION_REPORTED) - .Put16({{asHex attributeCode 4}}) + .Put16({{asHex code 4}}) .Put8({{atomicTypeId}}) .Put16(minInterval) .Put16(maxInterval); diff --git a/src/app/zap-templates/templates/chip/helper.js b/src/app/zap-templates/templates/chip/helper.js index 9550fba80d8f16..c5879668014d9a 100644 --- a/src/app/zap-templates/templates/chip/helper.js +++ b/src/app/zap-templates/templates/chip/helper.js @@ -17,88 +17,76 @@ // Import helpers from zap core const zapPath = '../../../../../third_party/zap/repo/src-electron/'; -const queryConfig = require(zapPath + 'db/query-config.js') -const queryImpexp = require(zapPath + 'db/query-impexp.js') const templateUtil = require(zapPath + 'generator/template-util.js') const zclHelper = require(zapPath + 'generator/helper-zcl.js') -const zclQuery = require(zapPath + 'db/query-zcl.js') +const { Clusters } = require('../../common/ClustersHelper.js'); const StringHelper = require('../../common/StringHelper.js'); const ChipTypesHelper = require('../../common/ChipTypesHelper.js'); -/** - * This method converts a ZCL type to the length expected for the - * BufferWriter.Put method. - * TODO - * Not all types are supported at the moment, so if there is any unsupported type - * that we are trying to convert, it will throw an error. - */ -function asPutLength(zclType) +function asBlocks(promise, options) { - const type = ChipTypesHelper.asBasicType(zclType); - switch (type) { - case 'int8_t': - case 'int16_t': - case 'int32_t': - case 'int64_t': - case 'uint8_t': - case 'uint16_t': - case 'uint32_t': - case 'uint64_t': - return type.replace(/[^0-9]/g, ''); - default: - throw error = 'asPutLength: Unhandled type: ' + zclType; + function fn(pkgId) + { + return Clusters.init(this, pkgId).then(() => promise.then(data => templateUtil.collectBlocks(data, options, this))); } + return templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); } -function asPutCastType(zclType) +function asPromise(promise) { - const type = ChipTypesHelper.asBasicType(zclType); - switch (type) { - case 'int8_t': - case 'int16_t': - case 'int32_t': - case 'int64_t': - return 'u' + type; - case 'uint8_t': - case 'uint16_t': - case 'uint32_t': - case 'uint64_t': - return type; - default: - throw error = 'asPutCastType: Unhandled type: ' + zclType; - } + return templateUtil.templatePromise(this.global, promise); +} + +function throwErrorIfUndefined(item, errorMsg, conditions) +{ + conditions.forEach(condition => { + if (condition == undefined) { + console.log(item); + console.log(errorMsg); + throw error; + } + }); } -function getEnabledClustersForSide(clusters, side) +function checkIsInsideClusterBlock(context, name) { - clusters = clusters.filter(cluster => cluster.enabled == 1); + const clusterName = context.name; + const clusterSide = context.side; + const errorMsg = name + ': Not inside a ({#chip_server_clusters}} block.'; - if (side == 'all') { - return clusters; - } + throwErrorIfUndefined(context, errorMsg, [ clusterName, clusterSide ]); + + return { clusterName, clusterSide }; +} + +function checkIsInsideCommandBlock(context, name) +{ + const commandSource = context.commandSource; + const commandId = context.id; + const errorMsg = name + ': Not inside a ({#chip_cluster_commands}} block.'; - return clusters.filter(cluster => cluster.side == side); + throwErrorIfUndefined(context, errorMsg, [ commandId, commandSource ]); + + return commandId; } -function getClusters(options, side) +function checkIsInsideAttributeBlock(context, name) { - const db = this.global.db; - const sessionId = this.global.sessionId; + const code = context.code; + const errorMsg = name + ': Not inside a ({#chip_server_attributes}} block.'; - return queryImpexp.exportendPointTypeIds(db, sessionId) - .then(endpointTypes => zclQuery.exportAllClustersDetailsFromEndpointTypes(db, endpointTypes)) - .then(clusters => getEnabledClustersForSide(clusters, side)); + throwErrorIfUndefined(context, errorMsg, [ code ]); } -function getClustersAsBlocks(options, side) +function checkIsChipType(context, name) { - function fn(pkgId) - { - return getClusters.call(this, options, side).then(clusters => templateUtil.collectBlocks(clusters, options, this)) - } + const type = context.chipType; + const errorMsg = name + ': Could not find chipType'; - return templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); + throwErrorIfUndefined(context, errorMsg, [ type ]); + + return type; } /** @@ -108,7 +96,7 @@ function getClustersAsBlocks(options, side) */ function chip_server_clusters(options) { - return getClustersAsBlocks.call(this, options, 'server'); + return asBlocks.call(this, Clusters.getServerClusters(), options); } /** @@ -117,8 +105,7 @@ function chip_server_clusters(options) */ function chip_has_server_clusters(options) { - let promise = getClusters.call(this, options, 'server').then(clusters => !!clusters.length); - return templateUtil.templatePromise(this.global, promise); + return asPromise.call(this, Clusters.getServerClusters().then(clusters => !!clusters.length)); } /** @@ -128,7 +115,7 @@ function chip_has_server_clusters(options) */ function chip_client_clusters(options) { - return getClustersAsBlocks.call(this, options, 'client'); + return asBlocks.call(this, Clusters.getClientClusters(), options); } /** @@ -137,8 +124,7 @@ function chip_client_clusters(options) */ function chip_has_client_clusters(options) { - let promise = getClusters.call(this, options, 'client').then(clusters => !!clusters.length); - return templateUtil.templatePromise(this.global, promise); + return asPromise.call(this, Clusters.getClientClusters().then(clusters => !!clusters.length)); } /** @@ -148,7 +134,7 @@ function chip_has_client_clusters(options) */ function chip_clusters(options) { - return getClustersAsBlocks.call(this, options, 'all'); + return asBlocks.call(this, Clusters.getClusters(), options); } /** @@ -157,8 +143,7 @@ function chip_clusters(options) */ function chip_has_clusters(options) { - let promise = getClusters.call(this, options, 'client').then(clusters => !!clusters.length); - return templateUtil.templatePromise(this.global, promise); + return asPromise.call(this, Clusters.getClusters().then(clusters => !!clusters.length)); } /** @@ -172,26 +157,8 @@ function chip_has_clusters(options) */ function chip_server_cluster_commands(options) { - // Retrieve the clusterName and the clusterSide. If any if not available, an error will be thrown. - const clusterName = this.name; - const clusterSide = this.side; - if (clusterName == undefined || clusterSide == undefined) { - const error = 'chip_server_cluster_commands: Could not find relevant parent cluster.'; - console.log(error); - throw error; - } - - function filterCommand(cmd) - { - return cmd.clusterName == clusterName && cmd.clusterSide == 'client' && cmd.name.includes('Response') == false; - } - - const db = this.global.db; - return queryImpexp.exportendPointTypeIds(db, this.global.sessionId) - .then(endpointTypes => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(db, endpointTypes)) - .then(endpointsAndClusters => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters(db, endpointsAndClusters)) - .then(endpointCommands => endpointCommands.filter(filterCommand)) - .then(endpointCommands => templateUtil.collectBlocks(endpointCommands, options, this)) + const { clusterName, clusterSide } = checkIsInsideClusterBlock(this, 'chip_server_cluster_commands'); + return asBlocks.call(this, Clusters.getClientCommands(clusterName), options); } /** @@ -205,53 +172,60 @@ function chip_server_cluster_commands(options) */ function chip_server_cluster_command_arguments(options) { - const db = this.global.db; + const commandId = checkIsInsideCommandBlock(this, 'isManufacturerSpecificCommand'); + const { clusterName, clusterSide } = checkIsInsideClusterBlock(this.parent, 'isManufacturerSpecificCommand'); - function collectItem(arg, pkgId) - { - return zclHelper.isStruct(db, arg.type, pkgId).then(result => { - if (result == 'unknown') { - return arg; - } + const filter = command => command.id == commandId; + const promise = Clusters.getClientCommands(clusterName).then(commands => commands.find(filter).arguments); + return asBlocks.call(this, promise, options); +} - return zclQuery.selectStructByName(db, arg.type, pkgId).then(rec => { - return zclQuery.selectAllStructItemsById(db, rec.id).then(items => items.map(item => { - item.name = item.label; - return item; - })); - }) - }) - } +/** + * Returns if a given cluster has any attributes of type List[T] + * + * This function is meant to be used inside a {{#chip_server_clusters}} + * block. It will throws otherwise. + * + * @param {*} options + */ +function chip_has_list_attributes(options) +{ + const { clusterName, clusterSide } = checkIsInsideClusterBlock(this, 'chip_has_list_attributes'); - function collectItems(args, pkgId) - { - return Promise.all(args.map(arg => collectItem.call(this, arg, pkgId))).then(items => items.flat()).then(items => { - return Promise.all(items.map(item => { - if (StringHelper.isString(item.type)) { - item.chipType = 'chip::ByteSpan'; - return item; - } - - return zclHelper.asUnderlyingZclType.call(this, item.type, options).then(zclType => { - // Enhanced the command argument with 'chipType', 'chipTypePutLength', 'chipTypePutCastType' for conveniences. - item.chipType = zclType; - item.chipTypePutLength = asPutLength(zclType); - item.chipTypePutCastType = asPutCastType(zclType); - return item; - }) - })); - }); - } + const filter = attribute => attribute.isList; + return asPromise.call(this, Clusters.getAttributes(clusterName, clusterSide).then(attributes => attributes.find(filter))); +} - function fn(pkgId) - { - return zclQuery.selectCommandArgumentsByCommandId(db, this.id, pkgId) - .then(args => collectItems.call(this, args, pkgId)) - .then(items => templateUtil.collectBlocks(items, options, this)); - } +/** + * Returns if a given server cluster has any attributes of type List[T] + * + * This function is meant to be used inside a {{#chip_server_clusters}} + * block. It will throws otherwise. + * + * @param {*} options + */ +function chip_server_has_list_attributes(options) +{ + const { clusterName } = checkIsInsideClusterBlock(this, 'chip_server_has_list_attributes'); - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise) + const filter = attribute => attribute.isList; + return asPromise.call(this, Clusters.getServerAttributes(clusterName).then(attributes => attributes.find(filter))); +} + +/** + * Returns if a given client cluster has any attributes of type List[T] + * + * This function is meant to be used inside a {{#chip_client_clusters}} + * block. It will throws otherwise. + * + * @param {*} options + */ +function chip_client_has_list_attributes(options) +{ + const { clusterName } = checkIsInsideClusterBlock(this, 'chip_client_has_list_attributes'); + + const filter = attribute => attribute.isList; + return asPromise.call(this, Clusters.getClientAttributes(clusterName).then(attributes => attributes.find(filter))); } /** @@ -264,13 +238,7 @@ function chip_server_cluster_command_arguments(options) */ function isSignedType() { - const type = this.chipType; - if (!type) { - const error = 'isSignedType: Could not find chipType'; - console.log(error); - throw error; - } - + const type = checkIsChipType(this, 'isSignedType'); switch (type) { case 'int8_t': case 'int16_t': @@ -292,39 +260,10 @@ function isSignedType() */ function isDiscreteType() { - const type = this.chipType; - if (!type) { - const error = 'isDiscreteType: Could not find chipType'; - console.log(error); - throw error; - } - + checkIsChipType(this, 'isSignedType'); return this.discrete; } -function getAttributes(pkgId, options) -{ - const db = this.global.db; - return queryConfig.getAllSessionAttributes(db, this.global.sessionId).then(atts => { - return Promise.all(atts.map(att => zclQuery.selectAtomicByName(db, att.type, pkgId).then(atomic => { - // Enhanced the attribute with 'atomidId', 'discrete', chipType properties for convenience. - att.atomicTypeId = atomic.atomicId; - att.discrete = atomic.discrete; - - if (StringHelper.isString(att.type)) { - // Enhanced the command argument with 'chipType' for conveniences. - att.chipType = 'chip::ByteSpan'; - return att; - } - - return zclHelper.asUnderlyingZclType.call(this, att.type, options).then(zclType => { - att.chipType = zclType; - return att; - }); - }))); - }) -} - /** * Creates block iterator over the server side cluster attributes * for a given cluster. @@ -336,39 +275,8 @@ function getAttributes(pkgId, options) */ function chip_server_cluster_attributes(options) { - // Retrieve the clusterCode and the clusterSide. If any if not available, an error will be thrown. - const clusterCode = this.code; - const clusterSide = this.side; - if (clusterCode == undefined || clusterSide == undefined) { - const error = 'chip_server_cluster_attributes: Could not find relevant parent cluster.'; - console.log(error); - throw error; - } - - function fn(pkgId) - { - return getAttributes.call(this, pkgId, options).then(atts => { - atts = atts.filter(att => att.clusterCode == clusterCode && att.side == 'server'); - atts.forEach(att => { - const sameAttributes = atts.filter(att2 => att.name == att2.name); - let isWritable = !!sameAttributes.find(att2 => att2.writable); - let isReportable = !!sameAttributes.find(att2 => att2.reportable.included); - if (isWritable || isReportable) { - if (!StringHelper.isString(att.type)) { - att.chipTypePutLength = asPutLength(att.chipType); - att.chipTypePutCastType = asPutCastType(att.chipType); - } - att.writable = isWritable; - att.reportable.included = isReportable; - } - }) - atts = atts.filter((att, index) => atts.findIndex(att2 => att.name == att2.name) == index); - return templateUtil.collectBlocks(atts, options, this); - }) - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise); + const { clusterName, clusterSide } = checkIsInsideClusterBlock(this, 'chip_server_cluster_attributes'); + return asBlocks.call(this, Clusters.getServerAttributes(clusterName), options); } /** @@ -381,13 +289,8 @@ function chip_server_cluster_attributes(options) */ function isWritableAttribute(options) { - if (this.attributeCode == undefined) { - const error = 'isWritableAttribute: missing attribute code.'; - console.log(error); - throw error; - } - - return this.writable == 1; + checkIsInsideAttributeBlock(this, 'isWritableAttribute'); + return this.isWritable == 1; } /** @@ -400,13 +303,8 @@ function isWritableAttribute(options) */ function isReportableAttribute(options) { - if (this.attributeCode == undefined) { - const error = 'isReportableAttribute: missing attribute code.'; - console.log(error); - throw error; - } - - return this.reportable.included == 1; + checkIsInsideAttributeBlock(this, 'isReportableAttribute'); + return this.includedReportable == 1; } /** @@ -419,12 +317,7 @@ function isReportableAttribute(options) */ function isManufacturerSpecificCommand() { - if (this.commandSource == undefined) { - const error = 'isManufacturerSpecificCommand: Not inside a ({#chip_server_cluster_commands}} block.'; - console.log(error); - throw error; - } - + checkIsInsideCommandBlock(this, 'isManufacturerSpecificCommand'); return !!this.mfgCode; } @@ -470,31 +363,9 @@ function asPythonCType(zclType) function hasSpecificResponse(commandName) { - // Retrieve the clusterName and the clusterSide. If any if not available, an error will be thrown. - const clusterName = this.parent.name; - const clusterSide = this.parent.side; - if (clusterName == undefined || clusterSide == undefined) { - const error = 'chip_server_cluster_commands: Could not find relevant parent cluster.'; - console.log(error); - throw error; - } - - function filterCommand(cmd) - { - return cmd.clusterName == clusterName && cmd.name == (commandName + "Response"); - } - - function fn(pkgId) - { - const db = this.global.db; - return queryImpexp.exportendPointTypeIds(db, this.global.sessionId) - .then(endpointTypes => zclQuery.exportClustersAndEndpointDetailsFromEndpointTypes(db, endpointTypes)) - .then(endpointsAndClusters => zclQuery.exportCommandDetailsFromAllEndpointTypesAndClusters(db, endpointsAndClusters)) - .then(endpointCommands => endpointCommands.filter(filterCommand).length) - } - - const promise = templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err)); - return templateUtil.templatePromise(this.global, promise); + const { clusterName, clusterSide } = checkIsInsideClusterBlock(this.parent, 'has_specific_response'); + const filter = response => response.name == (commandName + 'Response'); + return asPromise.call(this, Clusters.getServerResponses(clusterName).then(responses => responses.find(filter))); } function asCallbackAttributeType(attributeType) @@ -520,7 +391,6 @@ function asCallbackAttributeType(attributeType) case 0x38: // semi / Semi-precision case 0x39: // single / Single precision case 0x3A: // double / Double precision - case 0x48: // array / Array case 0x49: // struct / Structure case 0x50: // set / Set case 0x51: // bag / Bag @@ -534,6 +404,8 @@ function asCallbackAttributeType(attributeType) case 0x43: // octstr16 / Long octet string case 0x44: // string16 / Long character string return 'String'; + case 0x48: // array / Array + return 'List'; case 0x08: // data8 / 8-bit data case 0x18: // map8 / 8-bit bitmap case 0x20: // uint8 / Unsigned 8-bit integer @@ -618,9 +490,10 @@ function asObjectiveCNumberType(label, type) return templateUtil.templatePromise(this.global, promise) } -function isStrEndsWith(str, substr) +function chip_attribute_list_entryTypes(options) { - return str.endsWith(substr); + checkIsInsideAttributeBlock(this, 'chip_attribute_list_entry_types'); + return templateUtil.collectBlocks(this.items, options, this); } // @@ -634,12 +507,16 @@ exports.chip_server_clusters = chip_server_clusters; exports.chip_has_server_clusters = chip_has_server_clusters; exports.chip_server_cluster_commands = chip_server_cluster_commands; exports.chip_server_cluster_command_arguments = chip_server_cluster_command_arguments +exports.chip_attribute_list_entryTypes = chip_attribute_list_entryTypes; exports.asBasicType = ChipTypesHelper.asBasicType; exports.asObjectiveCBasicType = asObjectiveCBasicType; exports.asObjectiveCNumberType = asObjectiveCNumberType; exports.isSignedType = isSignedType; exports.isDiscreteType = isDiscreteType; exports.chip_server_cluster_attributes = chip_server_cluster_attributes; +exports.chip_has_list_attributes = chip_has_list_attributes; +exports.chip_server_has_list_attributes = chip_server_has_list_attributes; +exports.chip_client_has_list_attributes = chip_client_has_list_attributes; exports.isWritableAttribute = isWritableAttribute; exports.isReportableAttribute = isReportableAttribute; exports.isManufacturerSpecificCommand = isManufacturerSpecificCommand; @@ -647,4 +524,3 @@ exports.asPythonType = asPythonType; exports.asPythonCType = asPythonCType; exports.asCallbackAttributeType = asCallbackAttributeType; exports.hasSpecificResponse = hasSpecificResponse; -exports.isStrEndsWith = isStrEndsWith; diff --git a/src/app/zap-templates/zcl/custom-types.xml b/src/app/zap-templates/zcl/custom-types.xml index 2d21d87931ff79..c75eb081280fac 100644 --- a/src/app/zap-templates/zcl/custom-types.xml +++ b/src/app/zap-templates/zcl/custom-types.xml @@ -31,10 +31,10 @@ limitations under the License. - + - + diff --git a/src/controller/CHIPClusters.cpp b/src/controller/CHIPClusters.cpp index ff2cdfd42ec600..5823480becce4c 100644 --- a/src/controller/CHIPClusters.cpp +++ b/src/controller/CHIPClusters.cpp @@ -1654,6 +1654,54 @@ CHIP_ERROR ColorControlCluster::ReadAttributeClusterRevision(Callback::Cancelabl return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); } +// Descriptor Cluster Commands +// Descriptor Cluster Attributes +CHIP_ERROR DescriptorCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterDiscoverAttributes(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} +CHIP_ERROR DescriptorCluster::ReadAttributeDeviceList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadDeviceListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeServerList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadServerListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeClientList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadClientListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributePartsList(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadPartsListAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DescriptorCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + uint8_t seqNum = mDevice->GetNextSequenceNumber(); + System::PacketBufferHandle encodedCommand = encodeDescriptorClusterReadClusterRevisionAttribute(seqNum, mEndpoint); + return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback); +} + // DoorLock Cluster Commands CHIP_ERROR DoorLockCluster::ClearAllPins(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -4344,7 +4392,7 @@ CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback: CHIP_ERROR WindowCoveringCluster::WindowCoveringDownClose(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4376,7 +4424,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToLiftPercentage(Callback::Can Callback::Cancelable * onFailureCallback, uint8_t percentageLiftValue) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4410,7 +4458,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToLiftPercentage(Callback::Can CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToLiftValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t liftValue) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4445,7 +4493,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltPercentage(Callback::Can Callback::Cancelable * onFailureCallback, uint8_t percentageTiltValue) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4479,7 +4527,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltPercentage(Callback::Can CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t tiltValue) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4513,7 +4561,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringGoToTiltValue(Callback::Cancelab CHIP_ERROR WindowCoveringCluster::WindowCoveringStop(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; @@ -4544,7 +4592,7 @@ CHIP_ERROR WindowCoveringCluster::WindowCoveringStop(Callback::Cancelable * onSu CHIP_ERROR WindowCoveringCluster::WindowCoveringUpOpen(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { -#ifdef CHIP_APP_USE_INTERACTION_MODEL +#if CHIP_ENABLE_INTERACTION_MODEL VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); (void) onSuccessCallback; (void) onFailureCallback; diff --git a/src/controller/CHIPClusters.h b/src/controller/CHIPClusters.h index 256dc94f3b4a12..995aee8a1ea737 100644 --- a/src/controller/CHIPClusters.h +++ b/src/controller/CHIPClusters.h @@ -32,6 +32,7 @@ constexpr ClusterId kBarrierControlClusterId = 0x0103; constexpr ClusterId kBasicClusterId = 0x0028; constexpr ClusterId kBindingClusterId = 0xF000; constexpr ClusterId kColorControlClusterId = 0x0300; +constexpr ClusterId kDescriptorClusterId = 0x001D; constexpr ClusterId kDoorLockClusterId = 0x0101; constexpr ClusterId kGeneralCommissioningClusterId = 0x0030; constexpr ClusterId kGroupKeyManagementClusterId = 0xF004; @@ -305,6 +306,21 @@ class DLL_EXPORT ColorControlCluster : public ClusterBase static constexpr CommandId kStopMoveStepCommandId = 0x47; }; +class DLL_EXPORT DescriptorCluster : public ClusterBase +{ +public: + DescriptorCluster() : ClusterBase(kDescriptorClusterId) {} + ~DescriptorCluster() {} + + // Cluster Attributes + CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeDeviceList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeServerList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClientList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributePartsList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); +}; + class DLL_EXPORT DoorLockCluster : public ClusterBase { public: diff --git a/src/controller/controller-clusters.zap b/src/controller/controller-clusters.zap index 475298219d8e7d..c61f7a7d7a7c11 100644 --- a/src/controller/controller-clusters.zap +++ b/src/controller/controller-clusters.zap @@ -18,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../../../../../git/open/connectedhomeip/src/app/zap-templates/zcl/zcl.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../../../../../../git/open/connectedhomeip/src/app/zap-templates/app-templates.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -735,6 +735,118 @@ } ] }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_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": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "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": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Basic", "code": 40, diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 68b51ea408759e..f8f6c080ccd337 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -945,6 +945,55 @@ CHIP_ERROR chip_ime_ReadAttribute_ColorControl_ClusterRevision(chip::Controller: } // End of Cluster ColorControl +// Cluster Descriptor + +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_DeviceList(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId ZCLgroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + (void) ZCLgroupId; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeDeviceList(nullptr, nullptr); +} +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_ServerList(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId ZCLgroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + (void) ZCLgroupId; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeServerList(nullptr, nullptr); +} +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_ClientList(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId ZCLgroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + (void) ZCLgroupId; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClientList(nullptr, nullptr); +} +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_PartsList(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId ZCLgroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + (void) ZCLgroupId; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributePartsList(nullptr, nullptr); +} +CHIP_ERROR chip_ime_ReadAttribute_Descriptor_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId ZCLgroupId) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::DescriptorCluster cluster; + (void) ZCLgroupId; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeClusterRevision(nullptr, nullptr); +} + +// End of Cluster Descriptor // Cluster DoorLock CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearAllPins(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index cecca2adaa5ec6..55091b120f0549 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -157,6 +157,8 @@ def ListClusterCommands(self): "optionsOverride": "int", }, }, + "Descriptor": { + }, "DoorLock": { "ClearAllPins": { }, @@ -544,6 +546,13 @@ def ListClusterAttributes(self): "StartUpColorTemperatureMireds", "ClusterRevision", ], + "Descriptor": [ + "DeviceList", + "ServerList", + "ClientList", + "PartsList", + "ClusterRevision", + ], "DoorLock": [ "LockState", "LockType", @@ -1479,6 +1488,26 @@ def ClusterColorControl_ReadAttributeClusterRevision(self, device: ctypes.c_void self._ChipStack.Call( lambda: self._chipLib.chip_ime_ReadAttribute_ColorControl_ClusterRevision(device, ZCLendpoint, ZCLgroupid) ) + def ClusterDescriptor_ReadAttributeDeviceList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + self._ChipStack.Call( + lambda: self._chipLib.chip_ime_ReadAttribute_Descriptor_DeviceList(device, ZCLendpoint, ZCLgroupid) + ) + def ClusterDescriptor_ReadAttributeServerList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + self._ChipStack.Call( + lambda: self._chipLib.chip_ime_ReadAttribute_Descriptor_ServerList(device, ZCLendpoint, ZCLgroupid) + ) + def ClusterDescriptor_ReadAttributeClientList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + self._ChipStack.Call( + lambda: self._chipLib.chip_ime_ReadAttribute_Descriptor_ClientList(device, ZCLendpoint, ZCLgroupid) + ) + def ClusterDescriptor_ReadAttributePartsList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + self._ChipStack.Call( + lambda: self._chipLib.chip_ime_ReadAttribute_Descriptor_PartsList(device, ZCLendpoint, ZCLgroupid) + ) + def ClusterDescriptor_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + self._ChipStack.Call( + lambda: self._chipLib.chip_ime_ReadAttribute_Descriptor_ClusterRevision(device, ZCLendpoint, ZCLgroupid) + ) def ClusterDoorLock_ReadAttributeLockState(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): self._ChipStack.Call( lambda: self._chipLib.chip_ime_ReadAttribute_DoorLock_LockState(device, ZCLendpoint, ZCLgroupid) @@ -1961,6 +1990,22 @@ def InitLib(self, chipLib): # Cluster ColorControl ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_ColorControl_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_ColorControl_ClusterRevision.restype = ctypes.c_uint32 + # Cluster Descriptor + # Cluster Descriptor ReadAttribute DeviceList + self._chipLib.chip_ime_ReadAttribute_Descriptor_DeviceList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Descriptor_DeviceList.restype = ctypes.c_uint32 + # Cluster Descriptor ReadAttribute ServerList + self._chipLib.chip_ime_ReadAttribute_Descriptor_ServerList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Descriptor_ServerList.restype = ctypes.c_uint32 + # Cluster Descriptor ReadAttribute ClientList + self._chipLib.chip_ime_ReadAttribute_Descriptor_ClientList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Descriptor_ClientList.restype = ctypes.c_uint32 + # Cluster Descriptor ReadAttribute PartsList + self._chipLib.chip_ime_ReadAttribute_Descriptor_PartsList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Descriptor_PartsList.restype = ctypes.c_uint32 + # Cluster Descriptor ReadAttribute ClusterRevision + self._chipLib.chip_ime_ReadAttribute_Descriptor_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_Descriptor_ClusterRevision.restype = ctypes.c_uint32 # Cluster DoorLock # Cluster DoorLock Command ClearAllPins self._chipLib.chip_ime_AppendCommand_DoorLock_ClearAllPins.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] diff --git a/src/darwin/Framework/CHIP/chip-tool.zap b/src/darwin/Framework/CHIP/chip-tool.zap index 55a9cdbb4cf495..8fb3c35ab90952 100644 --- a/src/darwin/Framework/CHIP/chip-tool.zap +++ b/src/darwin/Framework/CHIP/chip-tool.zap @@ -1,6 +1,5 @@ { - "writeTime": "Thu Mar 11 2021 18:15:06 GMT+0100 (Central European Standard Time)", - "featureLevel": 11, + "featureLevel": 19, "creator": "zap", "keyValuePairs": [ { @@ -19,13 +18,13 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/zcl/zcl.json", "version": "ZCL Test Data", "type": "zcl-properties" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", + "path": "../../../connectedhomeip-1/src/app/zap-templates/app-templates.json", "version": "chip-v1", "type": "gen-templates-json" } @@ -736,6 +735,118 @@ } ] }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_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": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [], + "attributes": [ + { + "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": "device list", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "server list", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "client list", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "parts list", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Basic", "code": 40, @@ -1119,6 +1230,196 @@ } ] }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddWiFiNetwork", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UpdateWiFiNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "AddThreadNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "UpdateThreadNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "RemoveNetwork", + "code": 10, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "EnableNetwork", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "DisableNetwork", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetLastNetworkCommissioningResult", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + } + ], + "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": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "AddWiFiNetworkResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "UpdateWiFiNetworkResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "AddThreadNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "UpdateThreadNetworkResponse", + "code": 9, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "RemoveNetworkResponse", + "code": 11, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "EnableNetworkResponse", + "code": 13, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "DisableNetworkResponse", + "code": 15, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 1 + } + ], + "attributes": [ + { + "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": "Door Lock", "code": 257, @@ -1984,23 +2285,6 @@ "define": "BARRIER_CONTROL_CLUSTER", "side": "client", "enabled": 1, - "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 - } - ], "commands": [ { "name": "BarrierControlGoToPercent", @@ -2018,6 +2302,23 @@ "incoming": 1, "outgoing": 1 } + ], + "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 + } ] }, { @@ -3574,94 +3875,13 @@ ] }, { - "name": "Media Playback", - "code": 61441, + "name": "Group Key Management", + "code": 61444, "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "client", "enabled": 1, - "commands": [ - { - "name": "PlayRequest", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "PauseRequest", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StopRequest", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "StartOverRequest", - "code": 3, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "PreviousRequest", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "NextRequest", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "RewindRequest", - "code": 6, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "FastForwardRequest", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipForwardRequest", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "SkipBackwardRequest", - "code": 9, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3681,22 +3901,13 @@ ] }, { - "name": "Media Playback", - "code": 61441, + "name": "Group Key Management", + "code": 61444, "mfgCode": null, - "define": "MEDIA_PLAYBACK_CLUSTER", + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "server", "enabled": 0, - "commands": [ - { - "name": "Playback", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], + "commands": [], "attributes": [ { "name": "cluster revision", @@ -3714,7 +3925,7 @@ "reportableChange": 0 }, { - "name": "current state", + "name": "groups", "code": 0, "mfgCode": null, "side": "server", @@ -3727,88 +3938,17 @@ "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - } - ] - }, - { - "name": "Content Launch", - "code": 61442, - "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "LaunchContent", - "code": 0, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - }, - { - "name": "LaunchURL", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 1 - } - ], - "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": "Content Launch", - "code": 61442, - "mfgCode": null, - "define": "CONTENT_LAUNCH_CLUSTER", - "side": "server", - "enabled": 0, - "commands": [ - { - "name": "LaunchContentResponse", - "code": 0, - "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 }, { - "name": "LaunchURLResponse", + "name": "group keys", "code": 1, "mfgCode": null, - "source": "server", - "incoming": 1, - "outgoing": 1 - } - ], - "attributes": [ - { - "name": "cluster revision", - "code": 65533, - "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x0001", + "defaultValue": "", "reportable": 0, "minInterval": 0, "maxInterval": 65344, @@ -3827,5 +3967,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 2f78e0b4c1b817..ed9e0758a0a463 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp @@ -272,7 +272,6 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag case 0x38: // semi / Semi-precision case 0x39: // single / Single precision case 0x3A: // double / Double precision - case 0x48: // array / Array case 0x49: // struct / Structure case 0x50: // set / Set case 0x51: // bag / Bag @@ -326,6 +325,138 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag cb->mCall(cb->mContext, chip::ByteSpan(message, length)); break; } + case 0x48: // array / Array + { + CHECK_MESSAGE_LENGTH(2); + uint16_t count = chip::Encoding::LittleEndian::Read16(message); + ChipLogProgress(Zcl, " count: %lu", count); + + switch (clusterId) + { + case 0x001D: + switch (attributeId) + { + case 0x0000: // DeviceType + { + _DeviceType data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].type = emberAfGetInt32u(message, 0, messageLen); + message += 4; + CHECK_MESSAGE_LENGTH(4); + data[i].revision = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0002: // CLUSTER_ID + { + chip::ClusterId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0003: // ENDPOINT_ID + { + chip::EndpointId data[count]; + for (size_t i = 0; i < count; i++) + { + data[i] = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + case 0xF004: + switch (attributeId) + { + case 0x0000: // GroupState + { + _GroupState data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].VendorGroupId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeySetIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + case 0x0001: // GroupKey + { + _GroupKey data[count]; + for (size_t i = 0; i < count; i++) + { + data[i].VendorId = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyIndex = emberAfGetInt16u(message, 0, messageLen); + message += 2; + CHECK_MESSAGE_LENGTH(2); + data[i].GroupKeyRoot = emberAfGetString(message, 0, messageLen); + message += 16; + CHECK_MESSAGE_LENGTH(16); + data[i].GroupKeyEpochStartTime = emberAfGetInt64u(message, 0, messageLen); + message += 8; + CHECK_MESSAGE_LENGTH(8); + data[i].GroupKeySecurityPolicy = emberAfGetInt8u(message, 0, messageLen); + message += 1; + CHECK_MESSAGE_LENGTH(1); + } + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, count, data); + break; + } + } + break; + } + break; + } case 0x08: // data8 / 8-bit data case 0x18: // map8 / 8-bit bitmap @@ -1308,6 +1439,122 @@ bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout) return true; } +bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "AddThreadNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "AddWiFiNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "DisableNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "EnableNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "RemoveNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( + uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults) +{ + ChipLogProgress(Zcl, "ScanNetworksResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults); + ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterScanNetworksResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText, wifiScanResults, threadScanResults); + return true; +} + +bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + +bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText) +{ + ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:"); + ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode); + ChipLogProgress(Zcl, " debugText: %s", debugText); + + GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, errorCode, debugText); + return true; +} + bool emberAfScenesClusterAddSceneResponseCallback(uint8_t status, uint16_t groupId, uint8_t sceneId) { ChipLogProgress(Zcl, "AddSceneResponse:"); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h index a6adcbc4a710b6..7e2107a76628c6 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -80,6 +81,18 @@ typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context, typedef void (*GroupsClusterRemoveGroupResponseCallback)(void * context, uint16_t groupId); typedef void (*GroupsClusterViewGroupResponseCallback)(void * context, uint16_t groupId, uint8_t * groupName); typedef void (*IdentifyClusterIdentifyQueryResponseCallback)(void * context, uint16_t timeout); +typedef void (*NetworkCommissioningClusterAddThreadNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterAddWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterDisableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterEnableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterRemoveNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText); +typedef void (*NetworkCommissioningClusterScanNetworksResponseCallback)( + void * context, uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults); +typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); +typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, + uint8_t * debugText); typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId); typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId, uint8_t sceneCount, @@ -90,3 +103,11 @@ typedef void (*ScenesClusterStoreSceneResponseCallback)(void * context, uint16_t typedef void (*ScenesClusterViewSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, uint8_t * sceneName, /* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets); + +// List specific responses +typedef void (*DescriptorDeviceListListAttributeCallback)(void * context, uint16_t count, _DeviceType * entries); +typedef void (*DescriptorServerListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorClientListListAttributeCallback)(void * context, uint16_t count, chip::ClusterId * entries); +typedef void (*DescriptorPartsListListAttributeCallback)(void * context, uint16_t count, chip::EndpointId * entries); +typedef void (*GroupKeyManagementGroupsListAttributeCallback)(void * context, uint16_t count, _GroupState * entries); +typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)(void * context, uint16_t count, _GroupKey * entries); diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index 93e5db92ed0c08..bb9a207ae6a9ea 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -300,6 +300,16 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Descriptor + * + */ +@interface CHIPDescriptor : CHIPCluster + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Door Lock * @@ -388,6 +398,16 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Group Key Management + * + */ +@interface CHIPGroupKeyManagement : CHIPCluster + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster Groups * @@ -478,6 +498,52 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Network Commissioning + * + */ +@interface CHIPNetworkCommissioning : CHIPCluster + +- (void)addThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)addWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)disableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)enableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler; +- (void)removeNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)scanNetworks:(NSData *)ssid + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)updateThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; +- (void)updateWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler; + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler; + +@end + /** * Cluster On/off * diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 3a8c26eb57f995..0daa43b0c1c7f5 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -1337,6 +1337,276 @@ static void CallbackFn(void * context, uint16_t timeout) dispatch_queue_t mQueue; }; +class CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText, + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults) + { + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + // wifiScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Objc is not properly implemented yet + // threadScanResults: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Objc is not properly implemented yet + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + +class CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge + : public Callback::Callback { +public: + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) + : Callback::Callback(CallbackFn, this) + , mHandler(handler) + , mQueue(queue) + { + } + + ~CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge() {}; + + static void CallbackFn(void * context, uint8_t errorCode, uint8_t * debugText) + { + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * callback + = reinterpret_cast(context); + if (callback && callback->mQueue) { + dispatch_async(callback->mQueue, ^{ + callback->mHandler(nil, @ { + @"errorCode" : [NSNumber numberWithUnsignedChar:errorCode], + @"debugText" : [NSString stringWithFormat:@"%s", debugText], + }); + callback->Cancel(); + delete callback; + }); + } + }; + +private: + ResponseHandler mHandler; + dispatch_queue_t mQueue; +}; + class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback { public: CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -4482,6 +4752,42 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPDescriptor () +@property (readonly) Controller::DescriptorCluster cppCluster; +@end + +@implementation CHIPDescriptor + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPDoorLock () @property (readonly) Controller::DoorLockCluster cppCluster; @end @@ -5381,6 +5687,42 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPGroupKeyManagement () +@property (readonly) Controller::GroupKeyManagementCluster cppCluster; +@end + +@implementation CHIPGroupKeyManagement + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPGroups () @property (readonly) Controller::GroupsCluster cppCluster; @end @@ -6066,6 +6408,285 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPNetworkCommissioning () +@property (readonly) Controller::NetworkCommissioningCluster cppCluster; +@end + +@implementation CHIPNetworkCommissioning + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (void)addThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterAddThreadNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.AddThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)addWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterAddWiFiNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.AddWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), + chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)disableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterDisableNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.DisableNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)enableNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterEnableNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.EnableNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler +{ + CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.GetLastNetworkCommissioningResult(onSuccess->Cancel(), onFailure->Cancel(), timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)removeNetwork:(NSData *)networkID + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterRemoveNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.RemoveNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) networkID.bytes, networkID.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)scanNetworks:(NSData *)ssid + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterScanNetworksResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ScanNetworks( + onSuccess->Cancel(), onFailure->Cancel(), chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)updateThreadNetwork:(NSData *)operationalDataset + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterUpdateThreadNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.UpdateThreadNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) operationalDataset.bytes, operationalDataset.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} +- (void)updateWiFiNetwork:(NSData *)ssid + credentials:(NSData *)credentials + breadcrumb:(uint64_t)breadcrumb + timeoutMs:(uint32_t)timeoutMs + completionHandler:(ResponseHandler)completionHandler +{ + CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge * onSuccess + = new CHIPNetworkCommissioningClusterUpdateWiFiNetworkResponseCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.UpdateWiFiNetwork(onSuccess->Cancel(), onFailure->Cancel(), + chip::ByteSpan((const uint8_t *) ssid.bytes, ssid.length), + chip::ByteSpan((const uint8_t *) credentials.bytes, credentials.length), breadcrumb, timeoutMs); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler +{ + CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]); + if (!onSuccess) { + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel()); + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + completionHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +@end + @interface CHIPOnOff () @property (readonly) Controller::OnOffCluster cppCluster; @end diff --git a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp index 8398b130687fdc..0bda6495f98aa9 100644 --- a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp +++ b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp @@ -2703,6 +2703,708 @@ void DispatchClientCommand(app::Command * command, CommandId commandId, Endpoint } // namespace Identify +namespace NetworkCommissioning { + +void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv) +{ + { + switch (commandId) + { + case ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults; + bool wifiScanResultsExists = false; + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults; + bool threadScanResultsExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + case 2: + if (wifiScanResultsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = dataTlv.GetDataPtr(const_cast(wifiScanResults)); + if (CHIP_NO_ERROR == TLVUnpackError) + { + wifiScanResultsExists = true; + validArgumentCount++; + } + break; + case 3: + if (threadScanResultsExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = dataTlv.GetDataPtr(const_cast(threadScanResults)); + if (CHIP_NO_ERROR == TLVUnpackError) + { + threadScanResultsExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterScanNetworksResponseCallback(errorCode, const_cast(debugText), + wifiScanResults, threadScanResults); + } + else if (4 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 4, + validArgumentCount); + } + break; + } + case ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + case ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + // We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV + // When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error. + // Any error value TLVUnpackError means we have received an illegal value. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint8_t errorCode; + bool errorCodeExists = false; + const uint8_t * debugText; + bool debugTextExists = false; + uint32_t validArgumentCount = 0; + + while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR) + { + switch (TLV::TagNumFromTag(dataTlv.GetTag())) + { + case 0: + if (errorCodeExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + TLVUnpackError = dataTlv.Get(errorCode); + if (CHIP_NO_ERROR == TLVUnpackError) + { + errorCodeExists = true; + validArgumentCount++; + } + break; + case 1: + if (debugTextExists) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(dataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + // TODO(#5542): The cluster handlers should accept a ByteSpan for all string types. + TLVUnpackError = dataTlv.GetDataPtr(debugText); + if (CHIP_NO_ERROR == TLVUnpackError) + { + debugTextExists = true; + validArgumentCount++; + } + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (TLVUnpackError != CHIP_NO_ERROR) + { + ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, + TLV::TagNumFromTag(dataTlv.GetTag()), TLVUnpackError); + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + else + { + ChipLogProgress(Zcl, "Failed to decode TLV data: %" PRId32, TLVError); + } + + // TODO(#5590) We should encode a response of status code for invalid TLV. + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount) + { + // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks. + emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(errorCode, const_cast(debugText)); + } + else if (2 != validArgumentCount) + { + ChipLogProgress(Zcl, "Missing command arguments in TLV data, command requires %d, given %" PRIu32, 2, + validArgumentCount); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + // TODO: Encode response for command not found + ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID); + break; + } + } + } +} + +} // namespace NetworkCommissioning + namespace Scenes { void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv) diff --git a/src/darwin/Framework/CHIP/gen/af-structs.h b/src/darwin/Framework/CHIP/gen/af-structs.h index 798bcd903e1e8e..7c32c68eec1465 100644 --- a/src/darwin/Framework/CHIP/gen/af-structs.h +++ b/src/darwin/Framework/CHIP/gen/af-structs.h @@ -212,15 +212,15 @@ typedef struct _GroupInformationRecord uint8_t groupType; } EmberAfGroupInformationRecord; -// Struct for GroupKeys -typedef struct _GroupKeys +// Struct for GroupKey +typedef struct _GroupKey { uint16_t VendorId; uint16_t GroupKeyIndex; - /* TYPE WARNING: array array defaults to */ uint8_t * GroupKeyRoot; + uint8_t * GroupKeyRoot; uint64_t GroupKeyEpochStartTime; uint8_t GroupKeySecurityPolicy; -} EmberAfGroupKeys; +} EmberAfGroupKey; // Struct for GroupState typedef struct _GroupState diff --git a/src/darwin/Framework/CHIP/gen/attribute-size.cpp b/src/darwin/Framework/CHIP/gen/attribute-size.cpp new file mode 100644 index 00000000000000..287250ea57984e --- /dev/null +++ b/src/darwin/Framework/CHIP/gen/attribute-size.cpp @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include +#include + +#include "gen/af-structs.h" + +using namespace chip; + +// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid +// and data is undefined. +constexpr uint16_t kSizeLengthInBytes = 2u; + +void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length) +{ + if (write) + { + memmove(dest + *offset, src, length); + } + else + { + memmove(dest, src + *offset, length); + } + + *offset = static_cast(*offset + length); +} + +uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src, + int32_t index) +{ + if (index == -1) + { + memmove(dest, src, am->size); + return am->size; + } + + if (index == 0) + { + if (write) + { + // src is a pointer to native-endian uint16_t, dst is pointer to buffer that should hold little-endian value + emberAfCopyInt16u(dest, 0, *reinterpret_cast(src)); + } + else + { + // src is pointer to buffer holding little-endian value, dst is a pointer to native-endian uint16_t + *reinterpret_cast(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + } + return kSizeLengthInBytes; + } + + if (!chip::CanCastTo(index)) + { + ChipLogError(Zcl, "Index %l is invalid. Should be between 1 and 65534", index); + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + return entryLength; +} + +// A list is a collection of entries of the same data type. The data type may be any defined data type. +uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer) +{ + // The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid + // and data is undefined. + uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes); + if (entryCount == 0xFFFF) + { + return 0; + } + + uint16_t entryLength = 0; + switch (clusterId) + { + } + + uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength); + if (!chip::CanCastTo(totalSize)) + { + ChipLogError(Zcl, "Cluster 0x%04x: Size of attribute 0x%02x is too large.", clusterId, attributeId); + return 0; + } + + return static_cast(totalSize); +} diff --git a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp index 66538a88f18d42..377448a7a84919 100644 --- a/src/darwin/Framework/CHIP/gen/call-command-handler.cpp +++ b/src/darwin/Framework/CHIP/gen/call-command-handler.cpp @@ -33,12 +33,15 @@ EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterComma EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfDescriptorClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfGroupKeyManagementClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLevelControlClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * cmd); +EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd); EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd); @@ -92,12 +95,20 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Color Control result = status(false, true, cmd->mfgSpecific); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + // No commands are enabled for cluster Descriptor + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: result = emberAfDoorLockClusterClientCommandParse(cmd); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: result = emberAfGeneralCommissioningClusterClientCommandParse(cmd); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + // No commands are enabled for cluster Group Key Management + result = status(false, true, cmd->mfgSpecific); + break; case ZCL_GROUPS_CLUSTER_ID: result = emberAfGroupsClusterClientCommandParse(cmd); break; @@ -112,6 +123,9 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd) // No commands are enabled for cluster Low Power result = status(false, true, cmd->mfgSpecific); break; + case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: + result = emberAfNetworkCommissioningClusterClientCommandParse(cmd); + break; case ZCL_ON_OFF_CLUSTER_ID: // No commands are enabled for cluster On/off result = status(false, true, cmd->mfgSpecific); @@ -869,6 +883,188 @@ EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * c } return status(wasHandled, true, cmd->mfgSpecific); } +EmberAfStatus emberAfNetworkCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd) +{ + bool wasHandled = false; + + if (!cmd->mfgSpecific) + { + switch (cmd->commandId) + { + case ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults; + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + emberAfStringLength(debugText) + 1u); + wifiScanResults = cmd->buffer + payloadOffset; + threadScanResults = cmd->buffer + payloadOffset; + + wasHandled = emberAfNetworkCommissioningClusterScanNetworksResponseCallback(errorCode, debugText, wifiScanResults, + threadScanResults); + break; + } + case ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(errorCode, debugText); + break; + } + case ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID: { + uint16_t payloadOffset = cmd->payloadStartIndex; + uint8_t errorCode; + uint8_t * debugText; + + if (cmd->bufLen < payloadOffset + 1) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + errorCode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen); + payloadOffset = static_cast(payloadOffset + 1); + if (cmd->bufLen < payloadOffset + 1u) + { + return EMBER_ZCL_STATUS_MALFORMED_COMMAND; + } + debugText = emberAfGetString(cmd->buffer, payloadOffset, cmd->bufLen); + + wasHandled = emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(errorCode, debugText); + break; + } + default: { + // Unrecognized command ID, error status will apply. + break; + } + } + } + return status(wasHandled, true, cmd->mfgSpecific); +} EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd) { bool wasHandled = false; diff --git a/src/darwin/Framework/CHIP/gen/callback-stub.cpp b/src/darwin/Framework/CHIP/gen/callback-stub.cpp index 2e044efde235ed..0ff0367697811e 100644 --- a/src/darwin/Framework/CHIP/gen/callback-stub.cpp +++ b/src/darwin/Framework/CHIP/gen/callback-stub.cpp @@ -44,12 +44,18 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_COLOR_CONTROL_CLUSTER_ID: emberAfColorControlClusterInitCallback(endpoint); break; + case ZCL_DESCRIPTOR_CLUSTER_ID: + emberAfDescriptorClusterInitCallback(endpoint); + break; case ZCL_DOOR_LOCK_CLUSTER_ID: emberAfDoorLockClusterInitCallback(endpoint); break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: emberAfGeneralCommissioningClusterInitCallback(endpoint); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + emberAfGroupKeyManagementClusterInitCallback(endpoint); + break; case ZCL_GROUPS_CLUSTER_ID: emberAfGroupsClusterInitCallback(endpoint); break; @@ -62,6 +68,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_LOW_POWER_CLUSTER_ID: emberAfLowPowerClusterInitCallback(endpoint); break; + case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: + emberAfNetworkCommissioningClusterInitCallback(endpoint); + break; case ZCL_ON_OFF_CLUSTER_ID: emberAfOnOffClusterInitCallback(endpoint); break; @@ -102,6 +111,11 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfDescriptorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -112,6 +126,11 @@ void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(Endpoi // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfGroupKeyManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -132,6 +151,11 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/src/darwin/Framework/CHIP/gen/callback.h b/src/darwin/Framework/CHIP/gen/callback.h index 0de9f0dd4cae33..4623cdec559034 100644 --- a/src/darwin/Framework/CHIP/gen/callback.h +++ b/src/darwin/Framework/CHIP/gen/callback.h @@ -79,6 +79,14 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint); */ void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Descriptor Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterInitCallback(chip::EndpointId endpoint); + /** @brief Door Lock Cluster Init * * Cluster Init @@ -95,6 +103,14 @@ void emberAfDoorLockClusterInitCallback(chip::EndpointId endpoint); */ void emberAfGeneralCommissioningClusterInitCallback(chip::EndpointId endpoint); +/** @brief Group Key Management Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Groups Cluster Init * * Cluster Init @@ -127,6 +143,14 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint); */ void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint); +/** @brief Network Commissioning Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint); + /** @brief On/off Cluster Init * * Cluster Init @@ -503,6 +527,76 @@ EmberAfStatus emberAfColorControlClusterClientPreAttributeChangedCallback(chip:: */ void emberAfColorControlClusterClientTickCallback(chip::EndpointId endpoint); +// +// Descriptor Cluster client +// + +/** @brief Descriptor Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfDescriptorClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Descriptor Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfDescriptorClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Descriptor Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfDescriptorClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Descriptor Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfDescriptorClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Descriptor Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfDescriptorClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Descriptor Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfDescriptorClusterClientTickCallback(chip::EndpointId endpoint); + // // Door Lock Cluster client // @@ -644,6 +738,77 @@ EmberAfStatus emberAfGeneralCommissioningClusterClientPreAttributeChangedCallbac */ void emberAfGeneralCommissioningClusterClientTickCallback(chip::EndpointId endpoint); +// +// Group Key Management Cluster client +// + +/** @brief Group Key Management Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfGroupKeyManagementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Group Key Management Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfGroupKeyManagementClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Group Key Management Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfGroupKeyManagementClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Group Key Management Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfGroupKeyManagementClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Group Key Management Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfGroupKeyManagementClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Group Key Management Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfGroupKeyManagementClusterClientTickCallback(chip::EndpointId endpoint); + // // Groups Cluster client // @@ -924,6 +1089,77 @@ EmberAfStatus emberAfLowPowerClusterClientPreAttributeChangedCallback(chip::Endp */ void emberAfLowPowerClusterClientTickCallback(chip::EndpointId endpoint); +// +// Network Commissioning Cluster client +// + +/** @brief Network Commissioning Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfNetworkCommissioningClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Network Commissioning Cluster Client Attribute Changed + * + * Client Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + */ +void emberAfNetworkCommissioningClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId); + +/** @brief Network Commissioning Cluster Client Manufacturer Specific Attribute Changed + * + * Client Manufacturer Specific Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute that changed + * @param manufacturerCode Manufacturer Code of the attribute that changed + */ +void emberAfNetworkCommissioningClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + uint16_t manufacturerCode); + +/** @brief Network Commissioning Cluster Client Message Sent + * + * Client Message Sent + * + * @param type The type of message sent + * @param indexOrDestination The destination or address to which the message was sent + * @param apsFrame The APS frame for the message + * @param msgLen The length of the message + * @param message The message that was sent + * @param status The status of the sent message + */ +void emberAfNetworkCommissioningClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, + EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, + EmberStatus status); + +/** @brief Network Commissioning Cluster Client Pre Attribute Changed + * + * client Pre Attribute Changed + * + * @param endpoint Endpoint that is being initialized + * @param attributeId Attribute to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +EmberAfStatus emberAfNetworkCommissioningClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, + chip::AttributeId attributeId, + EmberAfAttributeType attributeType, uint8_t size, + uint8_t * value); + +/** @brief Network Commissioning Cluster Client Tick + * + * client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfNetworkCommissioningClusterClientTickCallback(chip::EndpointId endpoint); + // // On/off Cluster client // @@ -1395,6 +1631,74 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout); +/** + * @brief Network Commissioning Cluster AddThreadNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster AddWiFiNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster DisableNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster EnableNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster RemoveNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster ScanNetworksResponse Command callback + * @param errorCode + * @param debugText + * @param wifiScanResults + * @param threadScanResults + */ + +bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback( + uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults, + /* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults); + +/** + * @brief Network Commissioning Cluster UpdateThreadNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + +/** + * @brief Network Commissioning Cluster UpdateWiFiNetworkResponse Command callback + * @param errorCode + * @param debugText + */ + +bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(uint8_t errorCode, uint8_t * debugText); + /** * @brief Scenes Cluster AddSceneResponse Command callback * @param status diff --git a/src/darwin/Framework/CHIP/gen/endpoint_config.h b/src/darwin/Framework/CHIP/gen/endpoint_config.h index 7f78df5818c6b8..c0681f294176bf 100644 --- a/src/darwin/Framework/CHIP/gen/endpoint_config.h +++ b/src/darwin/Framework/CHIP/gen/endpoint_config.h @@ -63,7 +63,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 14 +#define GENERATED_ATTRIBUTE_COUNT 17 #define GENERATED_ATTRIBUTES \ { \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ @@ -76,10 +76,14 @@ ZAP_SIMPLE_DEFAULT(2) }, /* On/off (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(3) }, /* Level Control (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Descriptor (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_SIMPLE_DEFAULT(3) }, /* Basic (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(0x0001) }, /* General Commissioning (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Network Commissioning (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(3) }, /* Door Lock (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ @@ -94,6 +98,8 @@ ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (client): cluster revision */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (client): cluster revision */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), \ + ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (client): cluster revision */ \ } // This is an array of EmberAfCluster structures. @@ -103,7 +109,7 @@ #define GENERATED_FUNCTION_ARRAYS #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 14 +#define GENERATED_CLUSTER_COUNT 17 #define GENERATED_CLUSTERS \ { \ { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */ \ @@ -113,31 +119,40 @@ { \ 0x0008, ZAP_ATTRIBUTE_INDEX(4), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Level Control (client) */ \ - { 0x0028, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(5), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Descriptor (client) */ \ + { 0x0028, ZAP_ATTRIBUTE_INDEX(6), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Basic (client) */ \ + { \ + 0x0030, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: General Commissioning (client) */ \ { \ - 0x0101, ZAP_ATTRIBUTE_INDEX(7), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Network Commissioning (client) */ \ + { \ + 0x0101, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Door Lock (client) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (client) */ \ { \ - 0x0300, ZAP_ATTRIBUTE_INDEX(9), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0300, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Color Control (client) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (client) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(11), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Low Power (client) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (client) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 1, Cluster: Binding (client) */ \ + { \ + 0xF004, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 1, Cluster: Group Key Management (client) */ \ } #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index])) @@ -145,7 +160,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 14, 28 }, \ + { ZAP_CLUSTER_INDEX(0), 17, 34 }, \ } // Largest attribute size is needed for various buffers @@ -155,7 +170,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (2) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (28) +#define ATTRIBUTE_MAX_SIZE (34) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) @@ -199,7 +214,7 @@ // Array of EmberAfCommandMetadata structs. #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask -#define EMBER_AF_GENERATED_COMMAND_COUNT (114) +#define EMBER_AF_GENERATED_COMMAND_COUNT (131) #define GENERATED_COMMANDS \ { \ { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */ \ @@ -250,6 +265,24 @@ { 0x0030, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* General Commissioning (client): CommissioningComplete */ \ { 0x0030, 0x07, \ ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* General Commissioning (client): CommissioningCompleteResponse */ \ + { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): ScanNetworks */ \ + { 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): ScanNetworksResponse */ \ + { 0x0031, 0x02, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): AddWiFiNetwork */ \ + { 0x0031, 0x03, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): AddWiFiNetworkResponse */ \ + { 0x0031, 0x04, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): UpdateWiFiNetwork */ \ + { 0x0031, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): UpdateWiFiNetworkResponse */ \ + { 0x0031, 0x06, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): AddThreadNetwork */ \ + { 0x0031, 0x07, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): AddThreadNetworkResponse */ \ + { 0x0031, 0x08, ZAP_COMMAND_MASK(OUTGOING_CLIENT) }, /* Network Commissioning (client): UpdateThreadNetwork */ \ + { 0x0031, 0x09, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): UpdateThreadNetworkResponse */ \ + { 0x0031, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): RemoveNetwork */ \ + { 0x0031, 0x0B, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): RemoveNetworkResponse */ \ + { 0x0031, 0x0C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): EnableNetwork */ \ + { 0x0031, 0x0D, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): EnableNetworkResponse */ \ + { 0x0031, 0x0E, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): DisableNetwork */ \ + { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (client): DisableNetworkResponse */ \ + { 0x0031, 0x10, \ + ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (client): GetLastNetworkCommissioningResult */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): LockDoor */ \ { 0x0101, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Door Lock (client): LockDoorResponse */ \ { 0x0101, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Door Lock (client): UnlockDoor */ \ diff --git a/src/darwin/Framework/CHIP/gen/gen_config.h b/src/darwin/Framework/CHIP/gen/gen_config.h index a61e278bdebe97..600167c3ae9b7b 100644 --- a/src/darwin/Framework/CHIP/gen/gen_config.h +++ b/src/darwin/Framework/CHIP/gen/gen_config.h @@ -34,12 +34,15 @@ #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_DESCRIPTOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_GROUPS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_LOW_POWER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -66,6 +69,10 @@ #define ZCL_USING_COLOR_CONTROL_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_COLOR_CONTROL_CLIENT +// Use this macro to check if the client side of the Descriptor cluster is included +#define ZCL_USING_DESCRIPTOR_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_DESCRIPTOR_CLIENT + // Use this macro to check if the client side of the Door Lock cluster is included #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT @@ -74,6 +81,10 @@ #define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_CLIENT +// Use this macro to check if the client side of the Group Key Management cluster is included +#define ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT_CLIENT + // Use this macro to check if the client side of the Groups cluster is included #define ZCL_USING_GROUPS_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_GROUPS_CLIENT @@ -90,6 +101,10 @@ #define ZCL_USING_LOW_POWER_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_LOW_POWER_CLIENT +// Use this macro to check if the client side of the Network Commissioning cluster is included +#define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_CLIENT + // Use this macro to check if the client side of the On/off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_ON_OFF_CLIENT diff --git a/third_party/zap/repo b/third_party/zap/repo index 0015a720b7b6f4..598a2c74ac1f81 160000 --- a/third_party/zap/repo +++ b/third_party/zap/repo @@ -1 +1 @@ -Subproject commit 0015a720b7b6f4909914c468ac1395d368b8d3da +Subproject commit 598a2c74ac1f811a95eda7b19525804426cf8332