From 8e9ab5cb664394a487f4d22e55efdc89c435e5db Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 7 Apr 2021 11:48:55 +0200 Subject: [PATCH] Update gen/ folder --- .../gen/CHIPClientCallbacks.h | 2 + .../all-clusters-common/gen/af-structs.h | 8 +- .../gen/attribute-size.cpp | 218 +++++ .../gen/call-command-handler.cpp | 5 + .../all-clusters-common/gen/callback-stub.cpp | 8 + .../all-clusters-common/gen/callback.h | 78 ++ .../all-clusters-common/gen/endpoint_config.h | 366 +++++--- .../all-clusters-common/gen/gen_config.h | 6 + .../bridge-common/gen/CHIPClientCallbacks.h | 2 + .../bridge-app/bridge-common/gen/af-structs.h | 8 +- .../bridge-common/gen/attribute-size.cpp | 101 +++ .../chip-tool/commands/clusters/Commands.h | 840 +++++++++++++++++- .../chip-tool/gen/CHIPClientCallbacks.cpp | 193 +++- examples/chip-tool/gen/CHIPClientCallbacks.h | 15 + examples/chip-tool/gen/CHIPClustersObjc.h | 48 + examples/chip-tool/gen/CHIPClustersObjc.mm | 377 ++++++++ .../chip-tool/gen/IMClusterCommandHandler.cpp | 378 ++++++++ examples/chip-tool/gen/af-structs.h | 8 +- examples/chip-tool/gen/attribute-size.cpp | 101 +++ .../chip-tool/gen/call-command-handler.cpp | 116 +++ examples/chip-tool/gen/callback-stub.cpp | 24 + examples/chip-tool/gen/callback.h | 272 ++++++ examples/chip-tool/gen/endpoint_config.h | 53 +- examples/chip-tool/gen/gen_config.h | 15 + .../lighting-common/gen/CHIPClientCallbacks.h | 2 + .../lighting-common/gen/af-structs.h | 8 +- .../lighting-common/gen/attribute-size.cpp | 101 +++ .../lock-common/gen/CHIPClientCallbacks.h | 2 + .../lock-app/lock-common/gen/af-structs.h | 8 +- .../lock-common/gen/attribute-size.cpp | 101 +++ .../esp32/main/gen/CHIPClientCallbacks.h | 2 + .../esp32/main/gen/af-structs.h | 8 +- .../esp32/main/gen/attribute-size.cpp | 101 +++ .../tv-common/gen/CHIPClientCallbacks.cpp | 12 +- .../tv-common/gen/CHIPClientCallbacks.h | 3 + examples/tv-app/tv-common/gen/af-structs.h | 8 +- .../tv-app/tv-common/gen/attribute-size.cpp | 101 +++ .../tv-app/tv-common/gen/endpoint_config.h | 12 +- src/app/chip-zcl-zpro-codec-api.h | 55 ++ src/app/encoder.cpp | 73 ++ src/controller/CHIPClusters.cpp | 48 + src/controller/CHIPClusters.h | 16 + .../python/chip/clusters/CHIPClusters.cpp | 49 + .../python/chip/clusters/CHIPClusters.py | 45 + .../CHIP/gen/CHIPClientCallbacks.cpp | 193 +++- .../Framework/CHIP/gen/CHIPClientCallbacks.h | 15 + .../Framework/CHIP/gen/CHIPClustersObjc.h | 48 + .../Framework/CHIP/gen/CHIPClustersObjc.mm | 377 ++++++++ .../CHIP/gen/IMClusterCommandHandler.cpp | 378 ++++++++ src/darwin/Framework/CHIP/gen/af-structs.h | 8 +- .../Framework/CHIP/gen/attribute-size.cpp | 101 +++ .../CHIP/gen/call-command-handler.cpp | 116 +++ .../Framework/CHIP/gen/callback-stub.cpp | 24 + src/darwin/Framework/CHIP/gen/callback.h | 272 ++++++ .../Framework/CHIP/gen/endpoint_config.h | 53 +- src/darwin/Framework/CHIP/gen/gen_config.h | 15 + 56 files changed, 5397 insertions(+), 200 deletions(-) create mode 100644 examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp create mode 100644 examples/bridge-app/bridge-common/gen/attribute-size.cpp create mode 100644 examples/chip-tool/gen/attribute-size.cpp create mode 100644 examples/lighting-app/lighting-common/gen/attribute-size.cpp create mode 100644 examples/lock-app/lock-common/gen/attribute-size.cpp create mode 100644 examples/temperature-measurement-app/esp32/main/gen/attribute-size.cpp create mode 100644 examples/tv-app/tv-common/gen/attribute-size.cpp create mode 100644 src/darwin/Framework/CHIP/gen/attribute-size.cpp 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..be6a14d94303f2 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/gen/attribute-size.cpp @@ -0,0 +1,218 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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; + 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; + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // + break; + } + case 0x0002: // client list + { + entryLength = 2; + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // + break; + } + case 0x0003: // parts list + { + entryLength = 1; + entryOffset = static_cast(entryOffset + ((index - 1) * entryLength)); + copyListMember(dest, src, write, &entryOffset, entryLength); // + break; + } + } + break; + } + case 0xF004: // Group Key Management Cluster + { + uint16_t entryOffset = kSizeLengthInBytes; + switch (am->attributeId) + { + case 0x0000: // groups + { + entryLength = 6; + 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; + 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 + // + entryLength = 2; + break; + case 0x0002: // client list + // + entryLength = 2; + break; + case 0x0003: // parts list + // + 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/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..bb89123394bd33 --- /dev/null +++ b/examples/bridge-app/bridge-common/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 496166d4251e14..16af8900cff9ed 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -356,6 +356,41 @@ static void OnIdentifyClusterIdentifyQueryResponse(void * context, uint16_t time 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 OnScenesClusterAddSceneResponse(void * context, uint16_t groupId, uint8_t sceneId) { ChipLogProgress(chipTool, "ScenesClusterAddSceneResponse"); @@ -407,6 +442,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 +538,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 +557,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; @@ -4847,6 +4976,219 @@ class ReadColorControlClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster Descriptor | 0x001D | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * DeviceList | 0x0000 | +| * ServerList | 0x0001 | +| * ClientList | 0x0002 | +| * PartsList | 0x0003 | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Discover Attributes + */ +class DiscoverDescriptorAttributes : public ModelCommand +{ +public: + DiscoverDescriptorAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverDescriptorAttributes() + { + 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::DescriptorCluster 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 DeviceList + */ +class ReadDescriptorDeviceList : public ModelCommand +{ +public: + ReadDescriptorDeviceList() : ModelCommand("read") + { + AddArgument("attr-name", "device-list"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorDeviceList() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeDeviceList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorDeviceListListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ServerList + */ +class ReadDescriptorServerList : public ModelCommand +{ +public: + ReadDescriptorServerList() : ModelCommand("read") + { + AddArgument("attr-name", "server-list"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorServerList() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeServerList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorServerListListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ClientList + */ +class ReadDescriptorClientList : public ModelCommand +{ +public: + ReadDescriptorClientList() : ModelCommand("read") + { + AddArgument("attr-name", "client-list"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorClientList() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeClientList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorClientListListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute PartsList + */ +class ReadDescriptorPartsList : public ModelCommand +{ +public: + ReadDescriptorPartsList() : ModelCommand("read") + { + AddArgument("attr-name", "parts-list"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorPartsList() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributePartsList(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDescriptorPartsListListAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ClusterRevision + */ +class ReadDescriptorClusterRevision : public ModelCommand +{ +public: + ReadDescriptorClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadDescriptorClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::DescriptorCluster 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 DoorLock | 0x0101 | |------------------------------------------------------------------------------| @@ -6226,34 +6568,179 @@ 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; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::GroupKeyManagementCluster 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 Groups + */ +class ReadGroupKeyManagementGroups : public ModelCommand +{ +public: + ReadGroupKeyManagementGroups() : ModelCommand("read") + { + AddArgument("attr-name", "groups"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementGroups() + { + 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.ReadAttributeGroups(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnGroupKeyManagementGroupsListAttributeResponse, + this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute GroupKeys + */ +class ReadGroupKeyManagementGroupKeys : public ModelCommand +{ +public: + ReadGroupKeyManagementGroupKeys() : ModelCommand("read") + { + AddArgument("attr-name", "group-keys"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementGroupKeys() + { + 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.ReadAttributeGroupKeys(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + 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; @@ -7321,6 +7808,281 @@ class ReadLowPowerClusterRevision : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/*----------------------------------------------------------------------------*\ +| Cluster NetworkCommissioning | 0x0031 | +|------------------------------------------------------------------------------| +| Commands: | | +| * DisableNetwork | 0x0E | +| * EnableNetwork | 0x0C | +| * GetLastNetworkCommissioningResult | 0x10 | +| * RemoveNetwork | 0x0A | +| * ScanNetworks | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * ClusterRevision | 0xFFFD | +\*----------------------------------------------------------------------------*/ + +/* + * Command DisableNetwork + */ +class NetworkCommissioningDisableNetwork : public ModelCommand +{ +public: + NetworkCommissioningDisableNetwork() : ModelCommand("disable-network") + { + AddArgument("networkID", &mNetworkID); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningDisableNetwork() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0E) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, endpointId); + 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( + OnNetworkCommissioningClusterDisableNetworkResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; +}; + +/* + * Command EnableNetwork + */ +class NetworkCommissioningEnableNetwork : public ModelCommand +{ +public: + 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; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0C) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, endpointId); + 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( + OnNetworkCommissioningClusterEnableNetworkResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; +}; + +/* + * Command GetLastNetworkCommissioningResult + */ +class NetworkCommissioningGetLastNetworkCommissioningResult : public ModelCommand +{ +public: + NetworkCommissioningGetLastNetworkCommissioningResult() : ModelCommand("get-last-network-commissioning-result") + { + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningGetLastNetworkCommissioningResult() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x10) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, endpointId); + return cluster.GetLastNetworkCommissioningResult(onSuccessCallback->Cancel(), onFailureCallback->Cancel(), mTimeoutMs); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + uint32_t mTimeoutMs; +}; + +/* + * Command RemoveNetwork + */ +class NetworkCommissioningRemoveNetwork : public ModelCommand +{ +public: + NetworkCommissioningRemoveNetwork() : ModelCommand("remove-network") + { + AddArgument("networkID", &mNetworkID); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningRemoveNetwork() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x0A) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, endpointId); + 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( + OnNetworkCommissioningClusterRemoveNetworkResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mNetworkID; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; +}; + +/* + * Command ScanNetworks + */ +class NetworkCommissioningScanNetworks : public ModelCommand +{ +public: + NetworkCommissioningScanNetworks() : ModelCommand("scan-networks") + { + AddArgument("ssid", &mSsid); + AddArgument("breadcrumb", 0, UINT64_MAX, &mBreadcrumb); + AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs); + ModelCommand::AddArguments(); + } + ~NetworkCommissioningScanNetworks() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster cluster; + cluster.Associate(device, endpointId); + 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( + OnNetworkCommissioningClusterScanNetworksResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + char * mSsid; + uint64_t mBreadcrumb; + uint32_t mTimeoutMs; +}; + +/* + * Discover Attributes + */ +class DiscoverNetworkCommissioningAttributes : public ModelCommand +{ +public: + DiscoverNetworkCommissioningAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); } + + ~DiscoverNetworkCommissioningAttributes() + { + 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::NetworkCommissioningCluster 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 ClusterRevision + */ +class ReadNetworkCommissioningClusterRevision : public ModelCommand +{ +public: + ReadNetworkCommissioningClusterRevision() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-revision"); + ModelCommand::AddArguments(); + } + + ~ReadNetworkCommissioningClusterRevision() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0031) command (0x00) on endpoint %" PRIu16, endpointId); + + chip::Controller::NetworkCommissioningCluster 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 OnOff | 0x0006 | |------------------------------------------------------------------------------| @@ -8470,6 +9232,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 +9295,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 +9371,22 @@ 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(), + }; + + commands.Register(clusterName, clusterCommands); +} void registerClusterOnOff(Commands & commands) { const char * clusterName = "OnOff"; @@ -8634,12 +9437,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..9a75db900f89cc 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,66 @@ bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout) 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 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..2bd130751cdd94 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,12 @@ 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 (*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 (*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 +97,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..ebb9c9dba734d4 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,34 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Network Commissioning + * + */ +@interface CHIPNetworkCommissioning : CHIPCluster + +- (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)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..5d986211d1c2ac 100644 --- a/examples/chip-tool/gen/CHIPClustersObjc.mm +++ b/examples/chip-tool/gen/CHIPClustersObjc.mm @@ -1337,6 +1337,144 @@ static void CallbackFn(void * context, uint16_t timeout) 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 CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback { public: CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -4482,6 +4620,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 +5555,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 +6276,173 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPNetworkCommissioning () +@property (readonly) Controller::NetworkCommissioningCluster cppCluster; +@end + +@implementation CHIPNetworkCommissioning + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (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)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..665d093998bfc7 100644 --- a/examples/chip-tool/gen/IMClusterCommandHandler.cpp +++ b/examples/chip-tool/gen/IMClusterCommandHandler.cpp @@ -2703,6 +2703,384 @@ 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_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; + } + 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..bb89123394bd33 --- /dev/null +++ b/examples/chip-tool/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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..0ed2d0e9412945 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,108 @@ 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_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; + } + 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..e5d8f07a05cc15 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,42 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout); +/** + * @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 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..44e89cd8eb1577 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 (123) #define GENERATED_COMMANDS \ { \ { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */ \ @@ -250,6 +265,16 @@ { 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, 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/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..bb89123394bd33 --- /dev/null +++ b/examples/lighting-app/lighting-common/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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/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..bb89123394bd33 --- /dev/null +++ b/examples/lock-app/lock-common/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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/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..bb89123394bd33 --- /dev/null +++ b/examples/temperature-measurement-app/esp32/main/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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..bb89123394bd33 --- /dev/null +++ b/examples/tv-app/tv-common/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index 1f252a6411ac83..f3203546eff5f2 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 | @@ -1062,6 +1063,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/encoder.cpp b/src/app/encoder.cpp index bba2fefef53511..e92dd889c26bf3 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 | @@ -173,6 +174,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) @@ -1855,6 +1858,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/controller/CHIPClusters.cpp b/src/controller/CHIPClusters.cpp index adb6a8dba4c3ef..64990a2774ec01 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) { diff --git a/src/controller/CHIPClusters.h b/src/controller/CHIPClusters.h index 4d8841a8c05f8d..dc15c0d34cc819 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; @@ -304,6 +305,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/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 95e52b4565c7e9..983a025feffd70 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 2b030f6f3263d2..561ba2621535aa 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": { }, @@ -524,6 +526,13 @@ def ListClusterAttributes(self): "StartUpColorTemperatureMireds", "ClusterRevision", ], + "Descriptor": [ + "DeviceList", + "ServerList", + "ClientList", + "PartsList", + "ClusterRevision", + ], "DoorLock": [ "LockState", "LockType", @@ -1405,6 +1414,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) @@ -1847,6 +1876,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/gen/CHIPClientCallbacks.cpp b/src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp index 2f78e0b4c1b817..9a75db900f89cc 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,66 @@ bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout) 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 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..2bd130751cdd94 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,12 @@ 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 (*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 (*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 +97,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..ebb9c9dba734d4 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,34 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Cluster Network Commissioning + * + */ +@interface CHIPNetworkCommissioning : CHIPCluster + +- (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)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..5d986211d1c2ac 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -1337,6 +1337,144 @@ static void CallbackFn(void * context, uint16_t timeout) 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 CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback { public: CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue) @@ -4482,6 +4620,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 +5555,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 +6276,173 @@ - (void)readAttributeClusterRevision:(ResponseHandler)completionHandler @end +@interface CHIPNetworkCommissioning () +@property (readonly) Controller::NetworkCommissioningCluster cppCluster; +@end + +@implementation CHIPNetworkCommissioning + +- (Controller::ClusterBase *)getCluster +{ + return &_cppCluster; +} + +- (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)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..665d093998bfc7 100644 --- a/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp +++ b/src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp @@ -2703,6 +2703,384 @@ 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_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; + } + 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..bb89123394bd33 --- /dev/null +++ b/src/darwin/Framework/CHIP/gen/attribute-size.cpp @@ -0,0 +1,101 @@ +/* + * + * 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) + { + uint16_t entryCount = emberAfGetInt16u(src, 0, kSizeLengthInBytes); + emberAfCopyInt16u(dest, 0, entryCount); + 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..0ed2d0e9412945 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,108 @@ 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_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; + } + 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..e5d8f07a05cc15 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,42 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout); +/** + * @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 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..44e89cd8eb1577 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 (123) #define GENERATED_COMMANDS \ { \ { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Identify (client): Identify */ \ @@ -250,6 +265,16 @@ { 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, 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