From e64a45cefb4b2c62384720b4006b106dfaccb400 Mon Sep 17 00:00:00 2001 From: Ricardo Casallas Date: Fri, 10 Dec 2021 10:49:16 -0500 Subject: [PATCH] Group Key Management cluster server implemented. --- .../all-clusters-common/all-clusters-app.zap | 92 ++- .../esp32/main/CMakeLists.txt | 1 + examples/all-clusters-app/mbed/CMakeLists.txt | 1 + examples/bridge-app/esp32/main/CMakeLists.txt | 1 + examples/lighting-app/mbed/CMakeLists.txt | 1 + examples/lighting-app/telink/CMakeLists.txt | 1 + examples/lock-app/esp32/main/CMakeLists.txt | 5 +- examples/lock-app/mbed/CMakeLists.txt | 1 + .../esp32/main/CMakeLists.txt | 1 + .../esp32/main/CMakeLists.txt | 1 + .../esp32/main/CMakeLists.txt | 1 + .../group-key-mgmt-server.cpp | 525 ++++++++++++++++++ .../clusters/groups-server/groups-server.cpp | 1 - src/app/util/util.cpp | 1 - .../chip/group-key-mgmt-cluster.xml | 82 ++- src/app/zap_cluster_list.py | 2 +- .../data_model/controller-clusters.zap | 88 ++- .../java/zap-generated/CHIPCallbackTypes.h | 16 +- .../java/zap-generated/CHIPClusters-JNI.cpp | 163 ++++++ .../zap-generated/CHIPClustersRead-JNI.cpp | 100 +++- .../zap-generated/CHIPInvokeCallbacks.cpp | 120 ++++ .../java/zap-generated/CHIPInvokeCallbacks.h | 31 ++ .../java/zap-generated/CHIPReadCallbacks.cpp | 209 +++---- .../java/zap-generated/CHIPReadCallbacks.h | 28 +- .../chip/devicecontroller/ChipClusters.java | 183 ++++-- .../devicecontroller/ClusterInfoMapping.java | 193 ++++++- .../devicecontroller/ClusterReadMapping.java | 59 +- .../python/chip/clusters/CHIPClusters.py | 50 +- .../python/chip/clusters/Objects.py | 202 ++++++- src/credentials/GroupDataProvider.h | 4 +- src/credentials/GroupDataProviderImpl.cpp | 27 +- src/credentials/GroupDataProviderImpl.h | 3 +- .../tests/TestGroupDataProvider.cpp | 25 +- .../CHIPAttributeTLVValueDecoder.mm | 71 ++- .../CHIP/zap-generated/CHIPCallbackBridge.mm | 103 +++- .../CHIPCallbackBridge_internal.h | 79 ++- .../CHIP/zap-generated/CHIPClustersObjc.h | 41 +- .../CHIP/zap-generated/CHIPClustersObjc.mm | 215 ++++++- .../zap-generated/CHIPCommandPayloadsObjc.h | 30 + .../zap-generated/CHIPCommandPayloadsObjc.mm | 66 +++ .../CHIP/zap-generated/CHIPStructsObjc.h | 29 +- .../CHIP/zap-generated/CHIPStructsObjc.mm | 43 +- .../CHIP/zap-generated/CHIPTestClustersObjc.h | 6 +- .../zap-generated/CHIPTestClustersObjc.mm | 88 +-- .../Framework/CHIPTests/CHIPClustersTests.m | 91 ++- .../zap-generated/IMClusterCommandHandler.cpp | 71 +++ .../zap-generated/endpoint_config.h | 128 ++--- .../app-common/zap-generated/af-structs.h | 34 +- .../app-common/zap-generated/attribute-id.h | 6 +- .../zap-generated/attributes/Accessors.cpp | 58 ++ .../zap-generated/attributes/Accessors.h | 10 + .../app-common/zap-generated/callback.h | 36 ++ .../zap-generated/cluster-objects.cpp | 335 +++++++++-- .../zap-generated/cluster-objects.h | 357 ++++++++++-- .../app-common/zap-generated/command-id.h | 8 + .../app-common/zap-generated/ids/Attributes.h | 16 +- .../app-common/zap-generated/ids/Commands.h | 30 + .../zap-generated/cluster/Commands.h | 378 +++++++++++-- .../zap-generated/CHIPClientCallbacks.cpp | 49 +- .../zap-generated/CHIPClientCallbacks.h | 22 +- .../zap-generated/CHIPClusters.cpp | 182 ++++++ .../zap-generated/CHIPClusters.h | 14 + .../zap-generated/IMClusterCommandHandler.cpp | 161 ++++++ .../zap-generated/endpoint_config.h | 14 +- .../tv-app/zap-generated/endpoint_config.h | 14 +- .../zap-generated/endpoint_config.h | 14 +- 66 files changed, 4316 insertions(+), 701 deletions(-) create mode 100644 src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 8c4384de9db207..2609ee311458ad 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -4304,7 +4304,40 @@ "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "client", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { "name": "ClusterRevision", @@ -4330,10 +4363,27 @@ "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "server", "enabled": 1, - "commands": [], + "commands": [ + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], "attributes": [ { - "name": "groups", + "name": "groupKeyMap", "code": 0, "mfgCode": null, "side": "server", @@ -4348,7 +4398,7 @@ "reportableChange": 0 }, { - "name": "group keys", + "name": "groupTable", "code": 1, "mfgCode": null, "side": "server", @@ -4362,6 +4412,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "maxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "maxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -9436,7 +9516,7 @@ "commands": [], "attributes": [ { - "name": "groups", + "name": "groupKeyMap", "code": 0, "mfgCode": null, "side": "server", @@ -9451,7 +9531,7 @@ "reportableChange": 0 }, { - "name": "group keys", + "name": "groupTable", "code": 1, "mfgCode": null, "side": "server", diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 6e5deacb0edf4e..0e5e3010ac1213 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -67,6 +67,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index cb3fec04753396..4bf6eda9f3113b 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -135,6 +135,7 @@ target_sources(${APP_TARGET} PRIVATE ${APP_CLUSTERS}/identify-server/identify-server.cpp ${APP_CLUSTERS}/window-covering-server/window-covering-server.cpp ${APP_CLUSTERS}/general-diagnostics-server/general-diagnostics-server.cpp + ${APP_CLUSTERS}/group-key-mgmt-server/group-key-mgmt-server.cpp ${APP_CLUSTERS}/power-source-configuration-server/power-source-configuration-server.cpp ) diff --git a/examples/bridge-app/esp32/main/CMakeLists.txt b/examples/bridge-app/esp32/main/CMakeLists.txt index 4587054f593b5c..c37505aa357999 100644 --- a/examples/bridge-app/esp32/main/CMakeLists.txt +++ b/examples/bridge-app/esp32/main/CMakeLists.txt @@ -36,6 +36,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" diff --git a/examples/lighting-app/mbed/CMakeLists.txt b/examples/lighting-app/mbed/CMakeLists.txt index bc11cc1b1e0e07..cbbe316adb8ba0 100644 --- a/examples/lighting-app/mbed/CMakeLists.txt +++ b/examples/lighting-app/mbed/CMakeLists.txt @@ -86,6 +86,7 @@ target_sources(${APP_TARGET} PRIVATE ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp + ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp ${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp ${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index e1a2865c22ebe0..925f30ad5e2f30 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -86,6 +86,7 @@ target_sources(app PRIVATE ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp + ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp ${CHIP_ROOT}/src/app/clusters/on-off-server/on-off-server.cpp ${CHIP_ROOT}/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp diff --git a/examples/lock-app/esp32/main/CMakeLists.txt b/examples/lock-app/esp32/main/CMakeLists.txt index fbca6b270d9315..fe4e57b6d78c1f 100644 --- a/examples/lock-app/esp32/main/CMakeLists.txt +++ b/examples/lock-app/esp32/main/CMakeLists.txt @@ -54,8 +54,8 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" PRIV_REQUIRES bt chip QRCode) get_filename_component(CHIP_ROOT ../third_party/connectedhomeip REALPATH) @@ -142,6 +142,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" diff --git a/examples/lock-app/mbed/CMakeLists.txt b/examples/lock-app/mbed/CMakeLists.txt index 30b0e3651e9e16..4884c8a7fa5fff 100644 --- a/examples/lock-app/mbed/CMakeLists.txt +++ b/examples/lock-app/mbed/CMakeLists.txt @@ -83,6 +83,7 @@ target_sources(${APP_TARGET} PRIVATE ${CHIP_ROOT}/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp ${CHIP_ROOT}/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp + ${CHIP_ROOT}/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp ${CHIP_ROOT}/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning-ember.cpp ${CHIP_ROOT}/src/app/clusters/network-commissioning/network-commissioning.cpp diff --git a/examples/ota-provider-app/esp32/main/CMakeLists.txt b/examples/ota-provider-app/esp32/main/CMakeLists.txt index a25dde36db364e..ec82816ae6c4cd 100644 --- a/examples/ota-provider-app/esp32/main/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/main/CMakeLists.txt @@ -40,6 +40,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" diff --git a/examples/ota-requestor-app/esp32/main/CMakeLists.txt b/examples/ota-requestor-app/esp32/main/CMakeLists.txt index 8fb4bddfe2c230..a2efa321b73eec 100644 --- a/examples/ota-requestor-app/esp32/main/CMakeLists.txt +++ b/examples/ota-requestor-app/esp32/main/CMakeLists.txt @@ -40,6 +40,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" diff --git a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt index 6d8637cd18caf2..916e8a780d6c2e 100644 --- a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt +++ b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt @@ -40,6 +40,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" diff --git a/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp new file mode 100644 index 00000000000000..120d80bf44eb14 --- /dev/null +++ b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp @@ -0,0 +1,525 @@ +/** + * + * Copyright (c) 2020 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::Credentials; +using namespace chip::app::Clusters; + +// +// Attributes +// + +namespace { + +struct GroupKeyCodec +{ + static const TLV::Tag kTagFabric = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kFabricIndex)); + static const TLV::Tag kTagGroup = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupId)); + static const TLV::Tag kTagKeyset = + TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupKey::Fields::kGroupKeySetID)); + + chip::FabricIndex mFabric = 0; + GroupDataProvider::GroupKey mMapping; + + GroupKeyCodec() = default; + GroupKeyCodec(chip::FabricIndex fabric_index, const GroupDataProvider::GroupKey & mapping) : + mFabric(fabric_index), mMapping(mapping) + {} + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const + { + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + + // FabricIndex + ReturnErrorOnFailure(DataModel::Encode(writer, kTagFabric, mFabric)); + // GroupId + ReturnErrorOnFailure(DataModel::Encode(writer, kTagGroup, mMapping.group_id)); + // GroupKeySetID + ReturnErrorOnFailure(DataModel::Encode(writer, kTagKeyset, mMapping.keyset_id)); + + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; + } + + CHIP_ERROR Decode(TLV::TLVReader & reader) + { + TLV::TLVType outer; + + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + + // FabricIndex + ReturnErrorOnFailure(reader.Next(kTagFabric)); + ReturnErrorOnFailure(reader.Get(mFabric)); + // GroupId + ReturnErrorOnFailure(reader.Next(kTagGroup)); + ReturnErrorOnFailure(reader.Get(mMapping.group_id)); + // GroupKeySetID + ReturnErrorOnFailure(reader.Next(kTagKeyset)); + ReturnErrorOnFailure(reader.Get(mMapping.keyset_id)); + + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; + } +}; + +struct GroupTableCodec +{ + static const TLV::Tag kTagFabric = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kFabricIndex)); + static const TLV::Tag kTagGroup = TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupId)); + static const TLV::Tag kTagEndpoints = + TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kEndpoints)); + static const TLV::Tag kTagGroupName = + TLV::ContextTag(to_underlying(GroupKeyManagement::Structs::GroupInfo::Fields::kGroupName)); + + GroupDataProvider * mProvider = nullptr; + chip::FabricIndex mFabric; + GroupDataProvider::GroupInfo mInfo; + + GroupTableCodec(GroupDataProvider * provider, chip::FabricIndex fabric_index, GroupDataProvider::GroupInfo & info) : + mProvider(provider), mFabric(fabric_index), mInfo(info) + {} + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const + { + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + + // FabricIndex + ReturnErrorOnFailure(DataModel::Encode(writer, kTagFabric, mFabric)); + // GroupId + ReturnErrorOnFailure(DataModel::Encode(writer, kTagGroup, mInfo.group_id)); + // Endpoints + TLV::TLVType inner; + ReturnErrorOnFailure(writer.StartContainer(kTagEndpoints, TLV::kTLVType_Array, inner)); + GroupDataProvider::GroupEndpoint mapping; + auto iter = mProvider->IterateEndpoints(mFabric); + if (nullptr != iter) + { + while (iter->Next(mapping)) + { + if (mapping.group_id == mInfo.group_id) + { + ReturnErrorOnFailure(writer.Put(TLV::AnonymousTag, static_cast(mapping.endpoint_id))); + } + } + iter->Release(); + } + ReturnErrorOnFailure(writer.EndContainer(inner)); + // GroupName + uint32_t name_size = static_cast(strnlen(mInfo.name, GroupDataProvider::GroupInfo::kGroupNameMax)); + ReturnErrorOnFailure(writer.PutString(kTagGroupName, mInfo.name, name_size)); + + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; + } +}; + +class GroupKeyManagementAttributeAccess : public AttributeAccessInterface +{ +public: + // Register for the Descriptor cluster on all endpoints. + GroupKeyManagementAttributeAccess() : AttributeAccessInterface(Optional::Missing(), Descriptor::Id) {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override + { + VerifyOrDie(aPath.mClusterId == Descriptor::Id); + + switch (aPath.mAttributeId) + { + case GroupKeyManagement::Attributes::ClusterRevision::Id: + return ReadClusterRevision(aPath.mEndpointId, aEncoder); + case GroupKeyManagement::Attributes::GroupKeyMap::Id: + return ReadGroupKeyMap(aPath.mEndpointId, aEncoder); + case GroupKeyManagement::Attributes::GroupTable::Id: + return ReadGroupTable(aPath.mEndpointId, aEncoder); + case GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id: + return ReadMaxGroupsPerFabric(aPath.mEndpointId, aEncoder); + case GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id: + return ReadMaxGroupKeysPerFabric(aPath.mEndpointId, aEncoder); + default: + break; + } + return CHIP_ERROR_READ_FAILED; + } + + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override + { + + if (GroupKeyManagement::Attributes::GroupKeyMap::Id == aPath.mAttributeId) + { + return WriteGroupKeyMap(aPath.mEndpointId, aDecoder); + } + return CHIP_ERROR_WRITE_FAILED; + } + +private: + static constexpr uint16_t kClusterRevision = 1; + + CHIP_ERROR ReadClusterRevision(EndpointId endpoint, AttributeValueEncoder & aEncoder) + { + return aEncoder.Encode(kClusterRevision); + } + CHIP_ERROR ReadGroupKeyMap(EndpointId endpoint, AttributeValueEncoder & aEncoder) + { + auto fabric_index = aEncoder.AccessingFabricIndex(); + auto provider = GetGroupDataProvider(); + VerifyOrReturnError(nullptr != provider, CHIP_ERROR_INTERNAL); + + CHIP_ERROR err = aEncoder.EncodeList([provider, fabric_index](const auto & encoder) -> CHIP_ERROR { + auto iter = provider->IterateGroupKeys(fabric_index); + VerifyOrReturnError(nullptr != iter, CHIP_ERROR_NO_MEMORY); + + GroupDataProvider::GroupKey mapping; + while (iter->Next(mapping)) + { + encoder.Encode(GroupKeyCodec(fabric_index, mapping)); + } + iter->Release(); + return CHIP_NO_ERROR; + }); + return err; + } + + CHIP_ERROR WriteGroupKeyMap(EndpointId endpoint, AttributeValueDecoder & aDecoder) + { + auto fabric_index = aDecoder.AccessingFabricIndex(); + auto provider = GetGroupDataProvider(); + DataModel::DecodableList list; + size_t new_count; + + VerifyOrReturnError(nullptr != provider, CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(aDecoder.Decode(list)); + ReturnErrorOnFailure(list.ComputeSize(&new_count)); + VerifyOrReturnError(new_count < GroupDataProvider::kMaxGroupKeysPerFabric, CHIP_ERROR_INVALID_LIST_LENGTH); + + // Remove existing keys + ReturnErrorOnFailure(provider->RemoveGroupKeys(fabric_index)); + + // Add the new keys + auto iter = list.begin(); + size_t i = 0; + while (iter.Next()) + { + const GroupKeyCodec & value = iter.GetValue(); + ReturnErrorOnFailure(provider->SetGroupKeyAt(value.mFabric, i++, value.mMapping)); + } + ReturnErrorOnFailure(iter.GetStatus()); + return CHIP_NO_ERROR; + } + + CHIP_ERROR ReadGroupTable(EndpointId endpoint, AttributeValueEncoder & aEncoder) + { + auto fabric_index = aEncoder.AccessingFabricIndex(); + auto provider = GetGroupDataProvider(); + VerifyOrReturnError(nullptr != provider, CHIP_ERROR_INTERNAL); + + CHIP_ERROR err = aEncoder.EncodeList([provider, fabric_index](const auto & encoder) -> CHIP_ERROR { + auto iter = provider->IterateGroupInfo(fabric_index); + VerifyOrReturnError(nullptr != iter, CHIP_ERROR_NO_MEMORY); + + GroupDataProvider::GroupInfo info; + while (iter->Next(info)) + { + encoder.Encode(GroupTableCodec(provider, fabric_index, info)); + } + iter->Release(); + return CHIP_NO_ERROR; + }); + return err; + } + CHIP_ERROR ReadMaxGroupsPerFabric(EndpointId endpoint, AttributeValueEncoder & aEncoder) + { + return aEncoder.Encode(GroupDataProvider::kMaxGroupsPerFabric); + } + CHIP_ERROR ReadMaxGroupKeysPerFabric(EndpointId endpoint, AttributeValueEncoder & aEncoder) + { + return aEncoder.Encode(GroupDataProvider::kMaxGroupKeysPerFabric); + } +}; + +constexpr uint16_t GroupKeyManagementAttributeAccess::kClusterRevision; + +GroupKeyManagementAttributeAccess gAttribute; + +} // anonymous namespace + +void MatterGroupKeyManagementPluginServerInitCallback() +{ + registerAttributeAccessOverride(&gAttribute); +} + +// +// Commands +// + +void emberAfGroupKeyManagementClusterServerInitCallback(chip::EndpointId endpoint) {} + +bool emberAfGroupKeyManagementClusterKeySetWriteCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::DecodableType & commandData) +{ + auto fabric = commandObj->GetAccessingFabricIndex(); + auto * provider = GetGroupDataProvider(); + + if (nullptr == provider) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return true; + } + + if (commandData.groupKeySet.epochKey0.empty() || (0 == commandData.groupKeySet.epochStartTime0)) + { + // If the EpochKey0 field is null or its associated EpochStartTime0 field is null, + // then this command SHALL fail with an INVALID_COMMAND + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return true; + } + + GroupDataProvider::KeySet keyset(commandData.groupKeySet.groupKeySetID, commandData.groupKeySet.groupKeySecurityPolicy, 0); + + // Epoch Key 0 + keyset.epoch_keys[0].start_time = commandData.groupKeySet.epochStartTime0; + memcpy(keyset.epoch_keys[0].key, commandData.groupKeySet.epochKey0.data(), GroupDataProvider::EpochKey::kLengthBytes); + keyset.num_keys_used++; + + // Epoch Key 1 + if (!commandData.groupKeySet.epochKey1.empty()) + { + if (commandData.groupKeySet.epochStartTime1 <= commandData.groupKeySet.epochStartTime0) + { + // If the EpochKey1 field is not null, its associated EpochStartTime1 field SHALL contain + // a later epoch start time than the epoch start time found in the EpochStartTime0 field. + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return true; + } + keyset.epoch_keys[1].start_time = commandData.groupKeySet.epochStartTime1; + memcpy(keyset.epoch_keys[1].key, commandData.groupKeySet.epochKey1.data(), GroupDataProvider::EpochKey::kLengthBytes); + keyset.num_keys_used++; + } + + // Epoch Key 2 + if (!commandData.groupKeySet.epochKey2.empty()) + { + keyset.num_keys_used++; + if (commandData.groupKeySet.epochStartTime2 <= commandData.groupKeySet.epochStartTime1) + { + // If the EpochKey1 field is not null, its associated EpochStartTime1 field SHALL contain + // a later epoch start time than the epoch start time found in the EpochStartTime0 field. + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return true; + } + keyset.epoch_keys[2].start_time = commandData.groupKeySet.epochStartTime2; + memcpy(keyset.epoch_keys[2].key, commandData.groupKeySet.epochKey2.data(), GroupDataProvider::EpochKey::kLengthBytes); + keyset.num_keys_used++; + } + + // Set KeySet + CHIP_ERROR err = provider->SetKeySet(fabric, keyset); + if (CHIP_NO_ERROR == err) + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetWrite OK"); + } + else + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetWrite: %s", err.AsString()); + } + + // Send response + EmberStatus status = + emberAfSendImmediateDefaultResponse(CHIP_NO_ERROR == err ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE); + if (EMBER_SUCCESS != status) + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetWrite failed: 0x%x", status); + } + return true; +} + +bool emberAfGroupKeyManagementClusterKeySetReadCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::DecodableType & commandData) +{ + auto fabric = commandObj->GetAccessingFabricIndex(); + auto * provider = GetGroupDataProvider(); + + if (nullptr == provider) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return true; + } + + GroupDataProvider::KeySet keyset; + if (CHIP_NO_ERROR != provider->GetKeySet(fabric, commandData.groupKeySetID, keyset)) + { + // KeySet ID not found + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND); + return true; + } + + GroupKeyManagement::Commands::KeySetReadResponse::Type response; + response.groupKeySet.groupKeySetID = keyset.keyset_id; + response.groupKeySet.groupKeySecurityPolicy = keyset.policy; + // Keyset 0 + if (keyset.num_keys_used > 0) + { + response.groupKeySet.epochStartTime0 = keyset.epoch_keys[0].start_time; + response.groupKeySet.epochKey0 = chip::ByteSpan(keyset.epoch_keys[0].key, GroupDataProvider::EpochKey::kLengthBytes); + } + else + { + response.groupKeySet.epochStartTime0 = 0; + response.groupKeySet.epochKey0 = chip::ByteSpan(nullptr, 0); + } + // Keyset 1 + if (keyset.num_keys_used > 1) + { + response.groupKeySet.epochStartTime1 = keyset.epoch_keys[1].start_time; + response.groupKeySet.epochKey1 = chip::ByteSpan(keyset.epoch_keys[1].key, GroupDataProvider::EpochKey::kLengthBytes); + } + else + { + response.groupKeySet.epochStartTime1 = 0; + response.groupKeySet.epochKey1 = chip::ByteSpan(nullptr, 0); + } + // Keyset 2 + if (keyset.num_keys_used > 2) + { + response.groupKeySet.epochStartTime2 = keyset.epoch_keys[2].start_time; + response.groupKeySet.epochKey2 = chip::ByteSpan(keyset.epoch_keys[2].key, GroupDataProvider::EpochKey::kLengthBytes); + } + else + { + response.groupKeySet.epochStartTime2 = 0; + response.groupKeySet.epochKey2 = chip::ByteSpan(nullptr, 0); + } + + CHIP_ERROR err = commandObj->AddResponseData(commandPath, response); + if (CHIP_NO_ERROR != err) + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetRead failed: %s", ErrorStr(err)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + } + return true; +} + +bool emberAfGroupKeyManagementClusterKeySetRemoveCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::DecodableType & commandData) + +{ + auto fabric = commandObj->GetAccessingFabricIndex(); + auto * provider = GetGroupDataProvider(); + EmberAfStatus status = EMBER_ZCL_STATUS_FAILURE; + + if (nullptr != provider) + { + // Remove keyset + CHIP_ERROR err = provider->RemoveKeySet(fabric, commandData.groupKeySetID); + if (CHIP_ERROR_KEY_NOT_FOUND == err) + { + status = EMBER_ZCL_STATUS_NOT_FOUND; + } + else if (CHIP_NO_ERROR == err) + { + status = EMBER_ZCL_STATUS_SUCCESS; + } + } + + // Send response + EmberStatus send_status = emberAfSendImmediateDefaultResponse(status); + if (EMBER_SUCCESS != send_status) + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetRemove failed: 0x%x", send_status); + } + return true; +} + +struct KeySetReadAllIndicesResponse +{ + static constexpr CommandId GetCommandId() { return GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Id; } + static constexpr ClusterId GetClusterId() { return GroupKeyManagement::Id; } + + GroupDataProvider::KeySetIterator * mIterator = nullptr; + + KeySetReadAllIndicesResponse(GroupDataProvider::KeySetIterator * iter) : mIterator(iter) {} + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const + { + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + + TLV::TLVType array; + ReturnErrorOnFailure(writer.StartContainer( + TLV::ContextTag(to_underlying(GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Fields::kGroupKeySetIDs)), + TLV::kTLVType_Array, array)); + + GroupDataProvider::KeySet keyset; + while (mIterator && mIterator->Next(keyset)) + { + ReturnErrorOnFailure(app::DataModel::Encode(writer, TLV::AnonymousTag, keyset.keyset_id)); + } + + ReturnErrorOnFailure(writer.EndContainer(array)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; + } +}; + +bool emberAfGroupKeyManagementClusterKeySetReadAllIndicesCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::DecodableType & commandData) +{ + auto fabric = commandObj->GetAccessingFabricIndex(); + auto * provider = GetGroupDataProvider(); + + if (nullptr == provider) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return true; + } + + auto keysIt = provider->IterateKeySets(fabric); + if (nullptr == keysIt) + { + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return true; + } + + CHIP_ERROR err = commandObj->AddResponseData(commandPath, KeySetReadAllIndicesResponse(keysIt)); + if (CHIP_NO_ERROR != err) + { + ChipLogDetail(Zcl, "GroupKeyManagementCluster: KeySetReadAllIndices failed: %s", ErrorStr(err)); + } + keysIt->Release(); + return true; +} diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index e1c954fa841b19..bd8ee0a20ec928 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -342,7 +342,6 @@ bool emberAfGroupsClusterRemoveAllGroupsCallback(app::CommandHandler * commandOb #ifdef EMBER_AF_PLUGIN_SCENES { GroupDataProvider::EndpointIterator * iter = provider->IterateEndpoints(fabricIndex); - ; GroupDataProvider::GroupEndpoint mapping; VerifyOrExit(nullptr != iter, status = EMBER_ZCL_STATUS_FAILURE); diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 4f44413a853b4d..e3b543cc057bb1 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -295,7 +295,6 @@ void MatterBooleanStatePluginServerInitCallback() {} void MatterBridgedDeviceBasicPluginServerInitCallback() {} void MatterElectricalMeasurementPluginServerInitCallback() {} void MatterOtaSoftwareUpdateRequestorPluginServerInitCallback() {} -void MatterGroupKeyManagementPluginServerInitCallback() {} void MatterRelativeHumidityMeasurementPluginServerInitCallback() {} void MatterSwitchPluginServerInitCallback() {} void MatterIlluminanceMeasurementPluginServerInitCallback() {} diff --git a/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml index 72be9b90fd368d..42b2942bfc70e3 100644 --- a/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml @@ -17,26 +17,37 @@ limitations under the License. - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + + @@ -45,7 +56,44 @@ limitations under the License. 0x003F GROUP_KEY_MANAGEMENT_CLUSTER The Group Key Management Cluster is the mechanism by which group keys are managed. - groups - group keys + groupKeyMap + groupTable + maxGroupsPerFabric + maxGroupKeysPerFabric + + + Revoke a Root Key from a Group + + + + + Revoke a Root Key from a Group + + + + + + Response to KeySetRead + + + + + + Revoke a Root Key from a Group + + + + + Revoke a Root Key from a Group + + + + + + Reseponse to KeySetReadAllIndices + + + + \ No newline at end of file diff --git a/src/app/zap_cluster_list.py b/src/app/zap_cluster_list.py index 990d882af6dae9..6df13140a2aba4 100755 --- a/src/app/zap_cluster_list.py +++ b/src/app/zap_cluster_list.py @@ -36,7 +36,7 @@ 'FLOW_MEASUREMENT_CLUSTER': [], 'GENERAL_COMMISSIONING_CLUSTER': ['general-commissioning-server'], 'GENERAL_DIAGNOSTICS_CLUSTER': ['general-diagnostics-server'], - 'GROUP_KEY_MANAGEMENT_CLUSTER': [], + 'GROUP_KEY_MANAGEMENT_CLUSTER': ['group-key-mgmt-server'], 'GROUPS_CLUSTER': ['groups-server'], 'IAS_ZONE_CLUSTER': ['ias-zone-server'], 'IDENTIFY_CLUSTER': ['identify-server'], diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index cd2ee0e48eb350..7b4471e372d01b 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -6112,7 +6112,40 @@ "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "client", "enabled": 1, - "commands": [], + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], "attributes": [ { "name": "ClusterRevision", @@ -6138,10 +6171,27 @@ "define": "GROUP_KEY_MANAGEMENT_CLUSTER", "side": "server", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { - "name": "groups", + "name": "groupKeyMap", "code": 0, "mfgCode": null, "side": "server", @@ -6156,7 +6206,7 @@ "reportableChange": 0 }, { - "name": "group keys", + "name": "groupTable", "code": 1, "mfgCode": null, "side": "server", @@ -6170,6 +6220,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "maxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "maxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index 30ed8dc34d05b5..2400ca2ffc955e 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -480,11 +480,19 @@ typedef void (*CHIPGeneralDiagnosticsClusterAttributeListAttributeCallbackType)( void *, const chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::TypeInfo::DecodableType &); typedef void (*CHIPGeneralDiagnosticsClusterClusterRevisionAttributeCallbackType)( void *, chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::TypeInfo::DecodableArgType); +typedef void (*CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterKeySetReadResponseCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType &); -typedef void (*CHIPGroupKeyManagementClusterGroupsAttributeCallbackType)( - void *, const chip::app::Clusters::GroupKeyManagement::Attributes::Groups::TypeInfo::DecodableType &); -typedef void (*CHIPGroupKeyManagementClusterGroupKeysAttributeCallbackType)( - void *, const chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeys::TypeInfo::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterGroupKeyMapAttributeCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterGroupTableAttributeCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::TypeInfo::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterMaxGroupsPerFabricAttributeCallbackType)( + void *, chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupsPerFabric::TypeInfo::DecodableArgType); +typedef void (*CHIPGroupKeyManagementClusterMaxGroupKeysPerFabricAttributeCallbackType)( + void *, chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::TypeInfo::DecodableArgType); typedef void (*CHIPGroupKeyManagementClusterAttributeListAttributeCallbackType)( void *, const chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::TypeInfo::DecodableType &); typedef void (*CHIPGroupKeyManagementClusterClusterRevisionAttributeCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 49665acc0a27f3..e29b744f126010 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -12107,6 +12107,169 @@ JNI_METHOD(jlong, GroupKeyManagementCluster, initWithDevice)(JNIEnv * env, jobje return reinterpret_cast(cppCluster); } +JNI_METHOD(void, GroupKeyManagementCluster, keySetRead) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySetID) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster; + + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type request; + + request.groupKeySetID = + static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); + + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupKeyManagementCluster, keySetReadAllIndices) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySetIDs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster; + + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type request; + + request.groupKeySetIDs = chip::app::DataModel::List(); + + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupKeyManagementCluster, keySetRemove) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySetID) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster; + + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type request; + + request.groupKeySetID = + static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(groupKeySetID)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, GroupKeyManagementCluster, keySetWrite) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject groupKeySetID, jobject groupKeySecurityPolicy, + jbyteArray epochKey0, jobject epochStartTime0, jbyteArray epochKey1, jobject epochStartTime1, jbyteArray epochKey2, + jobject epochStartTime2) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + GroupKeyManagementCluster * cppCluster; + + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type request; + + request.groupKeySet = chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::Type(); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, GroupKeyManagementCluster, subscribeClusterRevisionAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { diff --git a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp index 3827a67f7dccdf..a8310a1ffa5bf8 100644 --- a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp @@ -7201,13 +7201,52 @@ JNI_METHOD(void, GeneralDiagnosticsCluster, readClusterRevisionAttribute) onFailure.release(); } -JNI_METHOD(void, GroupKeyManagementCluster, readGroupsAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeyMapAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::GroupKeyManagementCluster * cppCluster = + reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, GroupKeyManagementCluster, readGroupTableAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; - using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::Groups::TypeInfo; - std::unique_ptr - onSuccess(chip::Platform::New(callback, false), - chip::Platform::Delete); + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::TypeInfo; + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -7226,7 +7265,43 @@ JNI_METHOD(void, GroupKeyManagementCluster, readGroupsAttribute)(JNIEnv * env, j env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, GroupKeyManagementCluster, readMaxGroupsPerFabricAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupsPerFabric::TypeInfo; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::GroupKeyManagementCluster * cppCluster = + reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); VerifyOrReturn( @@ -7237,13 +7312,13 @@ JNI_METHOD(void, GroupKeyManagementCluster, readGroupsAttribute)(JNIEnv * env, j onFailure.release(); } -JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeysAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +JNI_METHOD(void, GroupKeyManagementCluster, readMaxGroupKeysPerFabricAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; - using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeys::TypeInfo; - std::unique_ptr - onSuccess(chip::Platform::New(callback, false), - chip::Platform::Delete); + using TypeInfo = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::TypeInfo; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -7262,7 +7337,8 @@ JNI_METHOD(void, GroupKeyManagementCluster, readGroupKeysAttribute)(JNIEnv * env env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); auto successFn = - chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); VerifyOrReturn( diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index e652ffe7a7a645..2da4c4e6867c81 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -971,6 +971,126 @@ void CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::Callbac env->CallVoidMethod(javaCallbackRef, javaMethod, errorCode, debugText); } +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: + CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: + ~CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback() +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +}; + +void CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback::CallbackFn( + void * context, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType & dataResponse) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + jmethodID javaMethod; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv")); + + std::unique_ptr + cppCallback(reinterpret_cast(context), + chip::Platform::Delete); + VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback")); + + javaCallbackRef = cppCallback->javaCallbackRef; + // Java callback is allowed to be null, exit early if this is the case. + VerifyOrReturn(javaCallbackRef != nullptr); + + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); + + jobject groupKeySetIDs; + + groupKeySetIDs = nullptr; /* Array - Conversion from this type to Java is not properly implemented yet */ + + env->CallVoidMethod(javaCallbackRef, javaMethod, groupKeySetIDs); +} +CHIPGroupKeyManagementClusterKeySetReadResponseCallback::CHIPGroupKeyManagementClusterKeySetReadResponseCallback( + jobject javaCallback) : + Callback::Callback(CallbackFn, this) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPGroupKeyManagementClusterKeySetReadResponseCallback::~CHIPGroupKeyManagementClusterKeySetReadResponseCallback() +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +}; + +void CHIPGroupKeyManagementClusterKeySetReadResponseCallback::CallbackFn( + void * context, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType & dataResponse) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + jmethodID javaMethod; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv")); + + std::unique_ptr + cppCallback(reinterpret_cast(context), + chip::Platform::Delete); + VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback")); + + javaCallbackRef = cppCallback->javaCallbackRef; + // Java callback is allowed to be null, exit early if this is the case. + VerifyOrReturn(javaCallbackRef != nullptr); + + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "()V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); + + jobject groupKeySet; + + groupKeySet = nullptr; /* Struct - conversion from this type to Java is not properly implemented yet */ + + env->CallVoidMethod(javaCallbackRef, javaMethod, groupKeySet); +} CHIPGroupsClusterAddGroupResponseCallback::CHIPGroupsClusterAddGroupResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h index 7050765b040a4e..b4ff88551d1e35 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h @@ -219,6 +219,37 @@ class CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback jobject javaCallbackRef; }; +class CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback + : public Callback::Callback +{ +public: + CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback); + + ~CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(); + + static void + CallbackFn(void * context, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType & data); + +private: + jobject javaCallbackRef; +}; + +class CHIPGroupKeyManagementClusterKeySetReadResponseCallback + : public Callback::Callback +{ +public: + CHIPGroupKeyManagementClusterKeySetReadResponseCallback(jobject javaCallback); + + ~CHIPGroupKeyManagementClusterKeySetReadResponseCallback(); + + static void CallbackFn(void * context, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType & data); + +private: + jobject javaCallbackRef; +}; + class CHIPGroupsClusterAddGroupResponseCallback : public Callback::Callback { public: diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 13e1d628bb187d..33ed481d4b2935 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -4938,8 +4938,10 @@ void CHIPGeneralDiagnosticsAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } -CHIPGroupKeyManagementGroupsAttributeCallback::CHIPGroupKeyManagementGroupsAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CHIPGroupKeyManagementGroupKeyMapAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -4955,7 +4957,7 @@ CHIPGroupKeyManagementGroupsAttributeCallback::CHIPGroupKeyManagementGroupsAttri } } -CHIPGroupKeyManagementGroupsAttributeCallback::~CHIPGroupKeyManagementGroupsAttributeCallback() +CHIPGroupKeyManagementGroupKeyMapAttributeCallback::~CHIPGroupKeyManagementGroupKeyMapAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -4966,9 +4968,9 @@ CHIPGroupKeyManagementGroupsAttributeCallback::~CHIPGroupKeyManagementGroupsAttr env->DeleteGlobalRef(javaCallbackRef); } -void CHIPGroupKeyManagementGroupsAttributeCallback::CallbackFn( +void CHIPGroupKeyManagementGroupKeyMapAttributeCallback::CallbackFn( void * context, - const chip::app::DataModel::DecodableList & list) + const chip::app::DataModel::DecodableList & list) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -4977,8 +4979,8 @@ void CHIPGroupKeyManagementGroupsAttributeCallback::CallbackFn( VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. javaCallbackRef = cppCallback.get()->javaCallbackRef; @@ -5002,80 +5004,81 @@ void CHIPGroupKeyManagementGroupsAttributeCallback::CallbackFn( jclass attributeClass; err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupsAttribute", attributeClass); + env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeyMapAttribute", attributeClass); VerifyOrReturn( err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupsAttribute")); + ChipLogError(Zcl, + "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeyMapAttribute")); chip::JniClass attributeJniClass(attributeClass); jmethodID attributeCtor = env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupsAttribute constructor")); + VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupKeyMapAttribute constructor")); auto iter = list.begin(); while (iter.Next()) { auto & entry = iter.GetValue(); (void) entry; - bool vendorIdNull = false; - bool vendorIdHasValue = true; + bool fabricIndexNull = false; + bool fabricIndexHasValue = true; - uint16_t vendorIdValue = entry.vendorId; + uint16_t fabricIndexValue = entry.fabricIndex; - jobject vendorId = nullptr; - if (!vendorIdNull && vendorIdHasValue) + jobject fabricIndex = nullptr; + if (!fabricIndexNull && fabricIndexHasValue) { - jclass vendorIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", vendorIdEntryCls); - chip::JniClass vendorIdJniClass(vendorIdEntryCls); - jmethodID vendorIdEntryTypeCtor = env->GetMethodID(vendorIdEntryCls, "", "(I)V"); - vendorId = env->NewObject(vendorIdEntryCls, vendorIdEntryTypeCtor, vendorIdValue); + jclass fabricIndexEntryCls; + chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); + chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); + jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); + fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); } - bool vendorGroupIdNull = false; - bool vendorGroupIdHasValue = true; + bool groupIdNull = false; + bool groupIdHasValue = true; - uint16_t vendorGroupIdValue = entry.vendorGroupId; + uint16_t groupIdValue = entry.groupId; - jobject vendorGroupId = nullptr; - if (!vendorGroupIdNull && vendorGroupIdHasValue) + jobject groupId = nullptr; + if (!groupIdNull && groupIdHasValue) { - jclass vendorGroupIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", vendorGroupIdEntryCls); - chip::JniClass vendorGroupIdJniClass(vendorGroupIdEntryCls); - jmethodID vendorGroupIdEntryTypeCtor = env->GetMethodID(vendorGroupIdEntryCls, "", "(I)V"); - vendorGroupId = env->NewObject(vendorGroupIdEntryCls, vendorGroupIdEntryTypeCtor, vendorGroupIdValue); + jclass groupIdEntryCls; + chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupIdEntryCls); + chip::JniClass groupIdJniClass(groupIdEntryCls); + jmethodID groupIdEntryTypeCtor = env->GetMethodID(groupIdEntryCls, "", "(I)V"); + groupId = env->NewObject(groupIdEntryCls, groupIdEntryTypeCtor, groupIdValue); } - bool groupKeySetIndexNull = false; - bool groupKeySetIndexHasValue = true; + bool groupKeySetIDNull = false; + bool groupKeySetIDHasValue = true; - uint16_t groupKeySetIndexValue = entry.groupKeySetIndex; + uint16_t groupKeySetIDValue = entry.groupKeySetID; - jobject groupKeySetIndex = nullptr; - if (!groupKeySetIndexNull && groupKeySetIndexHasValue) + jobject groupKeySetID = nullptr; + if (!groupKeySetIDNull && groupKeySetIDHasValue) { - jclass groupKeySetIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupKeySetIndexEntryCls); - chip::JniClass groupKeySetIndexJniClass(groupKeySetIndexEntryCls); - jmethodID groupKeySetIndexEntryTypeCtor = env->GetMethodID(groupKeySetIndexEntryCls, "", "(I)V"); - groupKeySetIndex = env->NewObject(groupKeySetIndexEntryCls, groupKeySetIndexEntryTypeCtor, groupKeySetIndexValue); + jclass groupKeySetIDEntryCls; + chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupKeySetIDEntryCls); + chip::JniClass groupKeySetIDJniClass(groupKeySetIDEntryCls); + jmethodID groupKeySetIDEntryTypeCtor = env->GetMethodID(groupKeySetIDEntryCls, "", "(I)V"); + groupKeySetID = env->NewObject(groupKeySetIDEntryCls, groupKeySetIDEntryTypeCtor, groupKeySetIDValue); } - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, vendorId, vendorGroupId, groupKeySetIndex); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupsAttribute object")); + jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, groupId, groupKeySetID); + VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupKeyMapAttribute object")); env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); } VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding GroupsAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); + ChipLogError(Zcl, "Error decoding GroupKeyMapAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } -CHIPGroupKeyManagementGroupKeysAttributeCallback::CHIPGroupKeyManagementGroupKeysAttributeCallback(jobject javaCallback, - bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), +CHIPGroupKeyManagementGroupTableAttributeCallback::CHIPGroupKeyManagementGroupTableAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -5092,7 +5095,7 @@ CHIPGroupKeyManagementGroupKeysAttributeCallback::CHIPGroupKeyManagementGroupKey } } -CHIPGroupKeyManagementGroupKeysAttributeCallback::~CHIPGroupKeyManagementGroupKeysAttributeCallback() +CHIPGroupKeyManagementGroupTableAttributeCallback::~CHIPGroupKeyManagementGroupTableAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5103,9 +5106,9 @@ CHIPGroupKeyManagementGroupKeysAttributeCallback::~CHIPGroupKeyManagementGroupKe env->DeleteGlobalRef(javaCallbackRef); } -void CHIPGroupKeyManagementGroupKeysAttributeCallback::CallbackFn( +void CHIPGroupKeyManagementGroupTableAttributeCallback::CallbackFn( void * context, - const chip::app::DataModel::DecodableList & list) + const chip::app::DataModel::DecodableList & list) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -5114,8 +5117,8 @@ void CHIPGroupKeyManagementGroupKeysAttributeCallback::CallbackFn( VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. javaCallbackRef = cppCallback.get()->javaCallbackRef; @@ -5139,103 +5142,69 @@ void CHIPGroupKeyManagementGroupKeysAttributeCallback::CallbackFn( jclass attributeClass; err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeysAttribute", attributeClass); + env, "chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupTableAttribute", attributeClass); VerifyOrReturn( err == CHIP_NO_ERROR, - ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupKeysAttribute")); + ChipLogError(Zcl, "Could not find class chip/devicecontroller/ChipClusters$GroupKeyManagementCluster$GroupTableAttribute")); chip::JniClass attributeJniClass(attributeClass); - jmethodID attributeCtor = env->GetMethodID(attributeClass, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;[BLjava/lang/Long;Ljava/lang/Integer;)V"); - VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupKeysAttribute constructor")); + jmethodID attributeCtor = + env->GetMethodID(attributeClass, "", "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;)V"); + VerifyOrReturn(attributeCtor != nullptr, ChipLogError(Zcl, "Could not find GroupTableAttribute constructor")); auto iter = list.begin(); while (iter.Next()) { auto & entry = iter.GetValue(); (void) entry; - bool vendorIdNull = false; - bool vendorIdHasValue = true; - - uint16_t vendorIdValue = entry.vendorId; - - jobject vendorId = nullptr; - if (!vendorIdNull && vendorIdHasValue) - { - jclass vendorIdEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", vendorIdEntryCls); - chip::JniClass vendorIdJniClass(vendorIdEntryCls); - jmethodID vendorIdEntryTypeCtor = env->GetMethodID(vendorIdEntryCls, "", "(I)V"); - vendorId = env->NewObject(vendorIdEntryCls, vendorIdEntryTypeCtor, vendorIdValue); - } - - bool groupKeyIndexNull = false; - bool groupKeyIndexHasValue = true; - - uint16_t groupKeyIndexValue = entry.groupKeyIndex; - - jobject groupKeyIndex = nullptr; - if (!groupKeyIndexNull && groupKeyIndexHasValue) - { - jclass groupKeyIndexEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupKeyIndexEntryCls); - chip::JniClass groupKeyIndexJniClass(groupKeyIndexEntryCls); - jmethodID groupKeyIndexEntryTypeCtor = env->GetMethodID(groupKeyIndexEntryCls, "", "(I)V"); - groupKeyIndex = env->NewObject(groupKeyIndexEntryCls, groupKeyIndexEntryTypeCtor, groupKeyIndexValue); - } - - bool groupKeyRootNull = false; - bool groupKeyRootHasValue = true; + bool fabricIndexNull = false; + bool fabricIndexHasValue = true; - chip::ByteSpan groupKeyRootValue = entry.groupKeyRoot; + uint16_t fabricIndexValue = entry.fabricIndex; - jbyteArray groupKeyRoot = nullptr; - if (!groupKeyRootNull && groupKeyRootHasValue) + jobject fabricIndex = nullptr; + if (!fabricIndexNull && fabricIndexHasValue) { - groupKeyRoot = env->NewByteArray(groupKeyRootValue.size()); - env->SetByteArrayRegion(groupKeyRoot, 0, groupKeyRootValue.size(), - reinterpret_cast(groupKeyRootValue.data())); + jclass fabricIndexEntryCls; + chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", fabricIndexEntryCls); + chip::JniClass fabricIndexJniClass(fabricIndexEntryCls); + jmethodID fabricIndexEntryTypeCtor = env->GetMethodID(fabricIndexEntryCls, "", "(I)V"); + fabricIndex = env->NewObject(fabricIndexEntryCls, fabricIndexEntryTypeCtor, fabricIndexValue); } - bool groupKeyEpochStartTimeNull = false; - bool groupKeyEpochStartTimeHasValue = true; + bool groupIdNull = false; + bool groupIdHasValue = true; - uint64_t groupKeyEpochStartTimeValue = entry.groupKeyEpochStartTime; + uint16_t groupIdValue = entry.groupId; - jobject groupKeyEpochStartTime = nullptr; - if (!groupKeyEpochStartTimeNull && groupKeyEpochStartTimeHasValue) + jobject groupId = nullptr; + if (!groupIdNull && groupIdHasValue) { - jclass groupKeyEpochStartTimeEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Long", groupKeyEpochStartTimeEntryCls); - chip::JniClass groupKeyEpochStartTimeJniClass(groupKeyEpochStartTimeEntryCls); - jmethodID groupKeyEpochStartTimeEntryTypeCtor = env->GetMethodID(groupKeyEpochStartTimeEntryCls, "", "(J)V"); - groupKeyEpochStartTime = - env->NewObject(groupKeyEpochStartTimeEntryCls, groupKeyEpochStartTimeEntryTypeCtor, groupKeyEpochStartTimeValue); + jclass groupIdEntryCls; + chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupIdEntryCls); + chip::JniClass groupIdJniClass(groupIdEntryCls); + jmethodID groupIdEntryTypeCtor = env->GetMethodID(groupIdEntryCls, "", "(I)V"); + groupId = env->NewObject(groupIdEntryCls, groupIdEntryTypeCtor, groupIdValue); } - bool groupKeySecurityPolicyNull = false; - bool groupKeySecurityPolicyHasValue = true; + bool groupNameNull = false; + bool groupNameHasValue = true; - chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy groupKeySecurityPolicyValue = entry.groupKeySecurityPolicy; + chip::CharSpan groupNameValue = entry.groupName; - jobject groupKeySecurityPolicy = nullptr; - if (!groupKeySecurityPolicyNull && groupKeySecurityPolicyHasValue) + jstring groupName = nullptr; + chip::UtfString groupNameStr(env, groupNameValue); + if (!groupNameNull && groupNameHasValue) { - jclass groupKeySecurityPolicyEntryCls; - chip::JniReferences::GetInstance().GetClassRef(env, "java/lang/Integer", groupKeySecurityPolicyEntryCls); - chip::JniClass groupKeySecurityPolicyJniClass(groupKeySecurityPolicyEntryCls); - jmethodID groupKeySecurityPolicyEntryTypeCtor = env->GetMethodID(groupKeySecurityPolicyEntryCls, "", "(I)V"); - groupKeySecurityPolicy = - env->NewObject(groupKeySecurityPolicyEntryCls, groupKeySecurityPolicyEntryTypeCtor, groupKeySecurityPolicyValue); + groupName = jstring(groupNameStr.jniValue()); } - jobject attributeObj = env->NewObject(attributeClass, attributeCtor, vendorId, groupKeyIndex, groupKeyRoot, - groupKeyEpochStartTime, groupKeySecurityPolicy); - VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupKeysAttribute object")); + jobject attributeObj = env->NewObject(attributeClass, attributeCtor, fabricIndex, groupId, groupName); + VerifyOrReturn(attributeObj != nullptr, ChipLogError(Zcl, "Could not create GroupTableAttribute object")); env->CallBooleanMethod(arrayListObj, arrayListAddMethod, attributeObj); } VerifyOrReturn(iter.GetStatus() == CHIP_NO_ERROR, - ChipLogError(Zcl, "Error decoding GroupKeysAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); + ChipLogError(Zcl, "Error decoding GroupTableAttribute value: %" CHIP_ERROR_FORMAT, iter.GetStatus().Format())); env->ExceptionClear(); env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index 1a9afa8d7523cd..086798c1975baa 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -1386,26 +1386,26 @@ class CHIPGeneralDiagnosticsAttributeListAttributeCallback bool keepAlive; }; -class CHIPGroupKeyManagementGroupsAttributeCallback - : public chip::Callback::Callback +class CHIPGroupKeyManagementGroupKeyMapAttributeCallback + : public chip::Callback::Callback { public: - CHIPGroupKeyManagementGroupsAttributeCallback(jobject javaCallback, bool keepAlive = false); + CHIPGroupKeyManagementGroupKeyMapAttributeCallback(jobject javaCallback, bool keepAlive = false); - ~CHIPGroupKeyManagementGroupsAttributeCallback(); + ~CHIPGroupKeyManagementGroupKeyMapAttributeCallback(); - static void maybeDestroy(CHIPGroupKeyManagementGroupsAttributeCallback * callback) + static void maybeDestroy(CHIPGroupKeyManagementGroupKeyMapAttributeCallback * callback) { if (!callback->keepAlive) { callback->Cancel(); - chip::Platform::Delete(callback); + chip::Platform::Delete(callback); } } static void CallbackFn( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & list); private: @@ -1413,26 +1413,26 @@ class CHIPGroupKeyManagementGroupsAttributeCallback bool keepAlive; }; -class CHIPGroupKeyManagementGroupKeysAttributeCallback - : public chip::Callback::Callback +class CHIPGroupKeyManagementGroupTableAttributeCallback + : public chip::Callback::Callback { public: - CHIPGroupKeyManagementGroupKeysAttributeCallback(jobject javaCallback, bool keepAlive = false); + CHIPGroupKeyManagementGroupTableAttributeCallback(jobject javaCallback, bool keepAlive = false); - ~CHIPGroupKeyManagementGroupKeysAttributeCallback(); + ~CHIPGroupKeyManagementGroupTableAttributeCallback(); - static void maybeDestroy(CHIPGroupKeyManagementGroupKeysAttributeCallback * callback) + static void maybeDestroy(CHIPGroupKeyManagementGroupTableAttributeCallback * callback) { if (!callback->keepAlive) { callback->Cancel(); - chip::Platform::Delete(callback); + chip::Platform::Delete(callback); } } static void CallbackFn( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & list); private: diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 9f5e18649f2a5d..93973842c41920 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -5862,91 +5862,147 @@ public static long clusterId() { @Override public native long initWithDevice(long devicePtr, int endpointId); - public static class GroupsAttribute { - public Integer vendorId; - public Integer vendorGroupId; - public Integer groupKeySetIndex; + public void keySetRead(KeySetReadResponseCallback callback, Integer groupKeySetID) { + keySetRead(chipClusterPtr, callback, groupKeySetID); + } - public GroupsAttribute(Integer vendorId, Integer vendorGroupId, Integer groupKeySetIndex) { - this.vendorId = vendorId; - this.vendorGroupId = vendorGroupId; - this.groupKeySetIndex = groupKeySetIndex; + public void keySetReadAllIndices( + KeySetReadAllIndicesResponseCallback callback, Integer groupKeySetIDs) { + keySetReadAllIndices(chipClusterPtr, callback, groupKeySetIDs); + } + + public void keySetRemove(DefaultClusterCallback callback, Integer groupKeySetID) { + keySetRemove(chipClusterPtr, callback, groupKeySetID); + } + + public void keySetWrite( + DefaultClusterCallback callback, + Integer groupKeySetID, + Integer groupKeySecurityPolicy, + byte[] epochKey0, + Long epochStartTime0, + byte[] epochKey1, + Long epochStartTime1, + byte[] epochKey2, + Long epochStartTime2) { + keySetWrite( + chipClusterPtr, + callback, + groupKeySetID, + groupKeySecurityPolicy, + epochKey0, + epochStartTime0, + epochKey1, + epochStartTime1, + epochKey2, + epochStartTime2); + } + + private native void keySetRead( + long chipClusterPtr, KeySetReadResponseCallback Callback, Integer groupKeySetID); + + private native void keySetReadAllIndices( + long chipClusterPtr, KeySetReadAllIndicesResponseCallback Callback, Integer groupKeySetIDs); + + private native void keySetRemove( + long chipClusterPtr, DefaultClusterCallback Callback, Integer groupKeySetID); + + private native void keySetWrite( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer groupKeySetID, + Integer groupKeySecurityPolicy, + byte[] epochKey0, + Long epochStartTime0, + byte[] epochKey1, + Long epochStartTime1, + byte[] epochKey2, + Long epochStartTime2); + + public interface KeySetReadAllIndicesResponseCallback { + void onSuccess( // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + ); + + void onError(Exception error); + } + + public interface KeySetReadResponseCallback { + void onSuccess( // groupKeySet: Struct GroupKeySet + // Conversion from this type to Java is not properly implemented yet + ); + + void onError(Exception error); + } + + public static class GroupKeyMapAttribute { + public Integer fabricIndex; + public Integer groupId; + public Integer groupKeySetID; + + public GroupKeyMapAttribute(Integer fabricIndex, Integer groupId, Integer groupKeySetID) { + this.fabricIndex = fabricIndex; + this.groupId = groupId; + this.groupKeySetID = groupKeySetID; } @Override public String toString() { StringBuilder output = new StringBuilder(""); - output.append("int vendorId: "); - output.append(this.vendorId); + output.append("int fabricIndex: "); + output.append(this.fabricIndex); output.append("\n"); - output.append("int vendorGroupId: "); - output.append(this.vendorGroupId); + output.append("int groupId: "); + output.append(this.groupId); output.append("\n"); - output.append("int groupKeySetIndex: "); - output.append(this.groupKeySetIndex); + output.append("int groupKeySetID: "); + output.append(this.groupKeySetID); output.append("\n"); return output.toString(); } } - public interface GroupsAttributeCallback { - void onSuccess(List valueList); + public interface GroupKeyMapAttributeCallback { + void onSuccess(List valueList); void onError(Exception ex); } - public static class GroupKeysAttribute { - public Integer vendorId; - public Integer groupKeyIndex; - public byte[] groupKeyRoot; - public Long groupKeyEpochStartTime; - public Integer groupKeySecurityPolicy; + public static class GroupTableAttribute { + public Integer fabricIndex; + public Integer groupId; + public String groupName; - public GroupKeysAttribute( - Integer vendorId, - Integer groupKeyIndex, - byte[] groupKeyRoot, - Long groupKeyEpochStartTime, - Integer groupKeySecurityPolicy) { - this.vendorId = vendorId; - this.groupKeyIndex = groupKeyIndex; - this.groupKeyRoot = groupKeyRoot; - this.groupKeyEpochStartTime = groupKeyEpochStartTime; - this.groupKeySecurityPolicy = groupKeySecurityPolicy; + public GroupTableAttribute(Integer fabricIndex, Integer groupId, String groupName) { + this.fabricIndex = fabricIndex; + this.groupId = groupId; + this.groupName = groupName; } @Override public String toString() { StringBuilder output = new StringBuilder(""); - output.append("int vendorId: "); - output.append(this.vendorId); - output.append("\n"); - - output.append("int groupKeyIndex: "); - output.append(this.groupKeyIndex); - output.append("\n"); - - output.append("byte[] "); - output.append(Arrays.toString(groupKeyRoot)); + output.append("int fabricIndex: "); + output.append(this.fabricIndex); output.append("\n"); - output.append("long groupKeyEpochStartTime: "); - output.append(this.groupKeyEpochStartTime); + output.append("int groupId: "); + output.append(this.groupId); output.append("\n"); - output.append("int groupKeySecurityPolicy: "); - output.append(this.groupKeySecurityPolicy); + output.append("String groupName: "); + output.append(this.groupName); output.append("\n"); return output.toString(); } } - public interface GroupKeysAttributeCallback { - void onSuccess(List valueList); + public interface GroupTableAttributeCallback { + void onSuccess(List valueList); void onError(Exception ex); } @@ -5957,12 +6013,20 @@ public interface AttributeListAttributeCallback { void onError(Exception ex); } - public void readGroupsAttribute(GroupsAttributeCallback callback) { - readGroupsAttribute(chipClusterPtr, callback); + public void readGroupKeyMapAttribute(GroupKeyMapAttributeCallback callback) { + readGroupKeyMapAttribute(chipClusterPtr, callback); + } + + public void readGroupTableAttribute(GroupTableAttributeCallback callback) { + readGroupTableAttribute(chipClusterPtr, callback); + } + + public void readMaxGroupsPerFabricAttribute(IntegerAttributeCallback callback) { + readMaxGroupsPerFabricAttribute(chipClusterPtr, callback); } - public void readGroupKeysAttribute(GroupKeysAttributeCallback callback) { - readGroupKeysAttribute(chipClusterPtr, callback); + public void readMaxGroupKeysPerFabricAttribute(IntegerAttributeCallback callback) { + readMaxGroupKeysPerFabricAttribute(chipClusterPtr, callback); } public void readAttributeListAttribute(AttributeListAttributeCallback callback) { @@ -5982,10 +6046,17 @@ public void reportClusterRevisionAttribute(IntegerAttributeCallback callback) { reportClusterRevisionAttribute(chipClusterPtr, callback); } - private native void readGroupsAttribute(long chipClusterPtr, GroupsAttributeCallback callback); + private native void readGroupKeyMapAttribute( + long chipClusterPtr, GroupKeyMapAttributeCallback callback); + + private native void readGroupTableAttribute( + long chipClusterPtr, GroupTableAttributeCallback callback); - private native void readGroupKeysAttribute( - long chipClusterPtr, GroupKeysAttributeCallback callback); + private native void readMaxGroupsPerFabricAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void readMaxGroupKeysPerFabricAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); private native void readAttributeListAttribute( long chipClusterPtr, AttributeListAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 90903eccfe26d9..4085389e5b730f 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -1663,8 +1663,8 @@ public void onError(Exception ex) { } } - public static class DelegatedGroupKeyManagementClusterGroupsAttributeCallback - implements ChipClusters.GroupKeyManagementCluster.GroupsAttributeCallback, + public static class DelegatedKeySetReadAllIndicesResponseCallback + implements ChipClusters.GroupKeyManagementCluster.KeySetReadAllIndicesResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -1674,11 +1674,64 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess( // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + ) { + Map responseValues = new LinkedHashMap<>(); + // groupKeySetIDs: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedKeySetReadResponseCallback + implements ChipClusters.GroupKeyManagementCluster.KeySetReadResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( // groupKeySet: Struct GroupKeySet + // Conversion from this type to Java is not properly implemented yet + ) { + Map responseValues = new LinkedHashMap<>(); + // groupKeySet: Struct GroupKeySet + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedGroupKeyManagementClusterGroupKeyMapAttributeCallback + implements ChipClusters.GroupKeyManagementCluster.GroupKeyMapAttributeCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); @@ -1690,8 +1743,8 @@ public void onError(Exception ex) { } } - public static class DelegatedGroupKeyManagementClusterGroupKeysAttributeCallback - implements ChipClusters.GroupKeyManagementCluster.GroupKeysAttributeCallback, + public static class DelegatedGroupKeyManagementClusterGroupTableAttributeCallback + implements ChipClusters.GroupKeyManagementCluster.GroupTableAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -1702,11 +1755,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { @Override public void onSuccess( - List valueList) { + List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo( - "valueList", "List"); + "valueList", "List"); responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); @@ -6829,6 +6882,130 @@ public Map> getCommandMap() { commandMap.put("generalDiagnostics", generalDiagnosticsClusterInteractionInfoMap); Map groupKeyManagementClusterInteractionInfoMap = new LinkedHashMap<>(); + Map groupKeyManagementkeySetReadCommandParams = + new LinkedHashMap(); + CommandParameterInfo groupKeyManagementkeySetReadgroupKeySetIDCommandParameterInfo = + new CommandParameterInfo("groupKeySetID", int.class); + groupKeyManagementkeySetReadCommandParams.put( + "groupKeySetID", groupKeyManagementkeySetReadgroupKeySetIDCommandParameterInfo); + + // Populate commands + InteractionInfo groupKeyManagementkeySetReadInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .keySetRead( + (ChipClusters.GroupKeyManagementCluster.KeySetReadResponseCallback) callback, + (Integer) commandArguments.get("groupKeySetID")); + }, + () -> new DelegatedKeySetReadResponseCallback(), + groupKeyManagementkeySetReadCommandParams); + groupKeyManagementClusterInteractionInfoMap.put( + "keySetRead", groupKeyManagementkeySetReadInteractionInfo); + Map groupKeyManagementkeySetReadAllIndicesCommandParams = + new LinkedHashMap(); + CommandParameterInfo groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo = + new CommandParameterInfo("groupKeySetIDs", int.class); + groupKeyManagementkeySetReadAllIndicesCommandParams.put( + "groupKeySetIDs", groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo); + + // Populate commands + InteractionInfo groupKeyManagementkeySetReadAllIndicesInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .keySetReadAllIndices( + (ChipClusters.GroupKeyManagementCluster.KeySetReadAllIndicesResponseCallback) + callback, + (Integer) commandArguments.get("groupKeySetIDs")); + }, + () -> new DelegatedKeySetReadAllIndicesResponseCallback(), + groupKeyManagementkeySetReadAllIndicesCommandParams); + groupKeyManagementClusterInteractionInfoMap.put( + "keySetReadAllIndices", groupKeyManagementkeySetReadAllIndicesInteractionInfo); + Map groupKeyManagementkeySetRemoveCommandParams = + new LinkedHashMap(); + CommandParameterInfo groupKeyManagementkeySetRemovegroupKeySetIDCommandParameterInfo = + new CommandParameterInfo("groupKeySetID", int.class); + groupKeyManagementkeySetRemoveCommandParams.put( + "groupKeySetID", groupKeyManagementkeySetRemovegroupKeySetIDCommandParameterInfo); + + // Populate commands + InteractionInfo groupKeyManagementkeySetRemoveInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .keySetRemove( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("groupKeySetID")); + }, + () -> new DelegatedDefaultClusterCallback(), + groupKeyManagementkeySetRemoveCommandParams); + groupKeyManagementClusterInteractionInfoMap.put( + "keySetRemove", groupKeyManagementkeySetRemoveInteractionInfo); + Map groupKeyManagementkeySetWriteCommandParams = + new LinkedHashMap(); + CommandParameterInfo groupKeyManagementkeySetWritegroupKeySetIDCommandParameterInfo = + new CommandParameterInfo("groupKeySetID", int.class); + groupKeyManagementkeySetWriteCommandParams.put( + "groupKeySetID", groupKeyManagementkeySetWritegroupKeySetIDCommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWritegroupKeySecurityPolicyCommandParameterInfo = + new CommandParameterInfo("groupKeySecurityPolicy", int.class); + groupKeyManagementkeySetWriteCommandParams.put( + "groupKeySecurityPolicy", + groupKeyManagementkeySetWritegroupKeySecurityPolicyCommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochKey0CommandParameterInfo = + new CommandParameterInfo("epochKey0", byte[].class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochKey0", groupKeyManagementkeySetWriteepochKey0CommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime0CommandParameterInfo = + new CommandParameterInfo("epochStartTime0", long.class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochStartTime0", groupKeyManagementkeySetWriteepochStartTime0CommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochKey1CommandParameterInfo = + new CommandParameterInfo("epochKey1", byte[].class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochKey1", groupKeyManagementkeySetWriteepochKey1CommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime1CommandParameterInfo = + new CommandParameterInfo("epochStartTime1", long.class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochStartTime1", groupKeyManagementkeySetWriteepochStartTime1CommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochKey2CommandParameterInfo = + new CommandParameterInfo("epochKey2", byte[].class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochKey2", groupKeyManagementkeySetWriteepochKey2CommandParameterInfo); + + CommandParameterInfo groupKeyManagementkeySetWriteepochStartTime2CommandParameterInfo = + new CommandParameterInfo("epochStartTime2", long.class); + groupKeyManagementkeySetWriteCommandParams.put( + "epochStartTime2", groupKeyManagementkeySetWriteepochStartTime2CommandParameterInfo); + + // Populate commands + InteractionInfo groupKeyManagementkeySetWriteInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .keySetWrite( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("groupKeySetID"), + (Integer) commandArguments.get("groupKeySecurityPolicy"), + (byte[]) commandArguments.get("epochKey0"), + (Long) commandArguments.get("epochStartTime0"), + (byte[]) commandArguments.get("epochKey1"), + (Long) commandArguments.get("epochStartTime1"), + (byte[]) commandArguments.get("epochKey2"), + (Long) commandArguments.get("epochStartTime2")); + }, + () -> new DelegatedDefaultClusterCallback(), + groupKeyManagementkeySetWriteCommandParams); + groupKeyManagementClusterInteractionInfoMap.put( + "keySetWrite", groupKeyManagementkeySetWriteInteractionInfo); commandMap.put("groupKeyManagement", groupKeyManagementClusterInteractionInfoMap); Map groupsClusterInteractionInfoMap = new LinkedHashMap<>(); Map groupsaddGroupCommandParams = diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 3583754cfbe90c..c98dd3fc8168b1 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -2758,35 +2758,66 @@ public Map> getReadAttributeMap() { readGeneralDiagnosticsClusterRevisionAttributeInteractionInfo); readAttributeMap.put("generalDiagnostics", readGeneralDiagnosticsInteractionInfo); Map readGroupKeyManagementInteractionInfo = new LinkedHashMap<>(); - Map readGroupKeyManagementGroupsCommandParams = + Map readGroupKeyManagementGroupKeyMapCommandParams = new LinkedHashMap(); - InteractionInfo readGroupKeyManagementGroupsAttributeInteractionInfo = + InteractionInfo readGroupKeyManagementGroupKeyMapAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.GroupKeyManagementCluster) cluster) - .readGroupsAttribute( - (ChipClusters.GroupKeyManagementCluster.GroupsAttributeCallback) callback); + .readGroupKeyMapAttribute( + (ChipClusters.GroupKeyManagementCluster.GroupKeyMapAttributeCallback) + callback); }, () -> - new ClusterInfoMapping.DelegatedGroupKeyManagementClusterGroupsAttributeCallback(), - readGroupKeyManagementGroupsCommandParams); + new ClusterInfoMapping + .DelegatedGroupKeyManagementClusterGroupKeyMapAttributeCallback(), + readGroupKeyManagementGroupKeyMapCommandParams); readGroupKeyManagementInteractionInfo.put( - "readGroupsAttribute", readGroupKeyManagementGroupsAttributeInteractionInfo); - Map readGroupKeyManagementGroupKeysCommandParams = + "readGroupKeyMapAttribute", readGroupKeyManagementGroupKeyMapAttributeInteractionInfo); + Map readGroupKeyManagementGroupTableCommandParams = new LinkedHashMap(); - InteractionInfo readGroupKeyManagementGroupKeysAttributeInteractionInfo = + InteractionInfo readGroupKeyManagementGroupTableAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.GroupKeyManagementCluster) cluster) - .readGroupKeysAttribute( - (ChipClusters.GroupKeyManagementCluster.GroupKeysAttributeCallback) callback); + .readGroupTableAttribute( + (ChipClusters.GroupKeyManagementCluster.GroupTableAttributeCallback) + callback); }, () -> new ClusterInfoMapping - .DelegatedGroupKeyManagementClusterGroupKeysAttributeCallback(), - readGroupKeyManagementGroupKeysCommandParams); + .DelegatedGroupKeyManagementClusterGroupTableAttributeCallback(), + readGroupKeyManagementGroupTableCommandParams); + readGroupKeyManagementInteractionInfo.put( + "readGroupTableAttribute", readGroupKeyManagementGroupTableAttributeInteractionInfo); + Map readGroupKeyManagementMaxGroupsPerFabricCommandParams = + new LinkedHashMap(); + InteractionInfo readGroupKeyManagementMaxGroupsPerFabricAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .readMaxGroupsPerFabricAttribute( + (ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readGroupKeyManagementMaxGroupsPerFabricCommandParams); + readGroupKeyManagementInteractionInfo.put( + "readMaxGroupsPerFabricAttribute", + readGroupKeyManagementMaxGroupsPerFabricAttributeInteractionInfo); + Map readGroupKeyManagementMaxGroupKeysPerFabricCommandParams = + new LinkedHashMap(); + InteractionInfo readGroupKeyManagementMaxGroupKeysPerFabricAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.GroupKeyManagementCluster) cluster) + .readMaxGroupKeysPerFabricAttribute( + (ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readGroupKeyManagementMaxGroupKeysPerFabricCommandParams); readGroupKeyManagementInteractionInfo.put( - "readGroupKeysAttribute", readGroupKeyManagementGroupKeysAttributeInteractionInfo); + "readMaxGroupKeysPerFabricAttribute", + readGroupKeyManagementMaxGroupKeysPerFabricAttributeInteractionInfo); Map readGroupKeyManagementAttributeListCommandParams = new LinkedHashMap(); InteractionInfo readGroupKeyManagementAttributeListAttributeInteractionInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index cd19b6e5599669..93663cb40e2198 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -2013,20 +2013,66 @@ class ChipClusters: "clusterName": "GroupKeyManagement", "clusterId": 0x0000003F, "commands": { + 0x00000001: { + "commandId": 0x00000001, + "commandName": "KeySetRead", + "args": { + "groupKeySetID": "int", + }, + }, + 0x00000004: { + "commandId": 0x00000004, + "commandName": "KeySetReadAllIndices", + "args": { + "groupKeySetIDs": "int", + }, + }, + 0x00000003: { + "commandId": 0x00000003, + "commandName": "KeySetRemove", + "args": { + "groupKeySetID": "int", + }, + }, + 0x00000000: { + "commandId": 0x00000000, + "commandName": "KeySetWrite", + "args": { + "groupKeySetID": "int", + "groupKeySecurityPolicy": "int", + "epochKey0": "bytes", + "epochStartTime0": "int", + "epochKey1": "bytes", + "epochStartTime1": "int", + "epochKey2": "bytes", + "epochStartTime2": "int", + }, + }, }, "attributes": { 0x00000000: { - "attributeName": "Groups", + "attributeName": "GroupKeyMap", "attributeId": 0x00000000, "type": "", "reportable": True, + "writable": True, }, 0x00000001: { - "attributeName": "GroupKeys", + "attributeName": "GroupTable", "attributeId": 0x00000001, "type": "", "reportable": True, }, + 0x00000002: { + "attributeName": "MaxGroupsPerFabric", + "attributeId": 0x00000002, + "type": "int", + }, + 0x00000003: { + "attributeName": "MaxGroupKeysPerFabric", + "attributeId": 0x00000003, + "type": "int", + }, 0x0000FFFB: { "attributeName": "AttributeList", "attributeId": 0x0000FFFB, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 7b17da90f9cd04..77b8e09af69712 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -12683,15 +12683,19 @@ class GroupKeyManagement(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="groups", Tag=0x00000000, Type=typing.List[GroupKeyManagement.Structs.GroupState]), - ClusterObjectFieldDescriptor(Label="groupKeys", Tag=0x00000001, Type=typing.List[GroupKeyManagement.Structs.GroupKey]), + ClusterObjectFieldDescriptor(Label="groupKeyMap", Tag=0x00000000, Type=typing.List[GroupKeyManagement.Structs.GroupKey]), + ClusterObjectFieldDescriptor(Label="groupTable", Tag=0x00000001, Type=typing.List[GroupKeyManagement.Structs.GroupInfo]), + ClusterObjectFieldDescriptor(Label="maxGroupsPerFabric", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="maxGroupKeysPerFabric", Tag=0x00000003, Type=uint), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) - groups: 'typing.List[GroupKeyManagement.Structs.GroupState]' = None - groupKeys: 'typing.List[GroupKeyManagement.Structs.GroupKey]' = None + groupKeyMap: 'typing.List[GroupKeyManagement.Structs.GroupKey]' = None + groupTable: 'typing.List[GroupKeyManagement.Structs.GroupInfo]' = None + maxGroupsPerFabric: 'uint' = None + maxGroupKeysPerFabric: 'uint' = None attributeList: 'typing.List[uint]' = None featureMap: 'typing.Optional[uint]' = None clusterRevision: 'uint' = None @@ -12703,46 +12707,160 @@ class GroupKeySecurityPolicy(IntEnum): class Structs: + @dataclass + class GroupInfo(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="groupId", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="endpoints", Tag=3, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="groupName", Tag=4, Type=str), + ]) + + fabricIndex: 'uint' = 0 + groupId: 'uint' = 0 + endpoints: 'typing.List[uint]' = field(default_factory=lambda: []) + groupName: 'str' = "" + @dataclass class GroupKey(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="vendorId", Tag=1, Type=uint), - ClusterObjectFieldDescriptor(Label="groupKeyIndex", Tag=2, Type=uint), - ClusterObjectFieldDescriptor(Label="groupKeyRoot", Tag=3, Type=bytes), - ClusterObjectFieldDescriptor(Label="groupKeyEpochStartTime", Tag=4, Type=uint), - ClusterObjectFieldDescriptor(Label="groupKeySecurityPolicy", Tag=5, Type=GroupKeyManagement.Enums.GroupKeySecurityPolicy), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="groupId", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="groupKeySetID", Tag=3, Type=uint), ]) - vendorId: 'uint' = 0 - groupKeyIndex: 'uint' = 0 - groupKeyRoot: 'bytes' = b"" - groupKeyEpochStartTime: 'uint' = 0 + fabricIndex: 'uint' = 0 + groupId: 'uint' = 0 + groupKeySetID: 'uint' = 0 + + @dataclass + class GroupKeySet(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySetID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="groupKeySecurityPolicy", Tag=2, Type=GroupKeyManagement.Enums.GroupKeySecurityPolicy), + ClusterObjectFieldDescriptor(Label="epochKey0", Tag=3, Type=bytes), + ClusterObjectFieldDescriptor(Label="epochStartTime0", Tag=4, Type=uint), + ClusterObjectFieldDescriptor(Label="epochKey1", Tag=5, Type=bytes), + ClusterObjectFieldDescriptor(Label="epochStartTime1", Tag=6, Type=uint), + ClusterObjectFieldDescriptor(Label="epochKey2", Tag=7, Type=bytes), + ClusterObjectFieldDescriptor(Label="epochStartTime2", Tag=8, Type=uint), + ]) + + groupKeySetID: 'uint' = 0 groupKeySecurityPolicy: 'GroupKeyManagement.Enums.GroupKeySecurityPolicy' = 0 + epochKey0: 'bytes' = b"" + epochStartTime0: 'uint' = 0 + epochKey1: 'bytes' = b"" + epochStartTime1: 'uint' = 0 + epochKey2: 'bytes' = b"" + epochStartTime2: 'uint' = 0 + + + + class Commands: + @dataclass + class KeySetWrite(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0000 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySet", Tag=0, Type=GroupKeyManagement.Structs.GroupKeySet), + ]) + + groupKeySet: 'GroupKeyManagement.Structs.GroupKeySet' = field(default_factory=lambda: GroupKeyManagement.Structs.GroupKeySet()) @dataclass - class GroupState(ClusterObject): + class KeySetRead(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0001 + is_client: typing.ClassVar[bool] = True + @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="vendorId", Tag=1, Type=uint), - ClusterObjectFieldDescriptor(Label="vendorGroupId", Tag=2, Type=uint), - ClusterObjectFieldDescriptor(Label="groupKeySetIndex", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="groupKeySetID", Tag=0, Type=uint), ]) - vendorId: 'uint' = 0 - vendorGroupId: 'uint' = 0 - groupKeySetIndex: 'uint' = 0 + groupKeySetID: 'uint' = 0 + @dataclass + class KeySetReadResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0002 + is_client: typing.ClassVar[bool] = False + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySet", Tag=0, Type=GroupKeyManagement.Structs.GroupKeySet), + ]) + + groupKeySet: 'GroupKeyManagement.Structs.GroupKeySet' = field(default_factory=lambda: GroupKeyManagement.Structs.GroupKeySet()) + + @dataclass + class KeySetRemove(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0003 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySetID", Tag=0, Type=uint), + ]) + + groupKeySetID: 'uint' = 0 + + @dataclass + class KeySetReadAllIndices(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0004 + is_client: typing.ClassVar[bool] = True + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySetIDs", Tag=0, Type=typing.List[uint]), + ]) + + groupKeySetIDs: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class KeySetReadAllIndicesResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x003F + command_id: typing.ClassVar[int] = 0x0005 + is_client: typing.ClassVar[bool] = False + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields = [ + ClusterObjectFieldDescriptor(Label="groupKeySetIDs", Tag=0, Type=typing.List[uint]), + ]) + + groupKeySetIDs: 'typing.List[uint]' = field(default_factory=lambda: []) class Attributes: @dataclass - class Groups(ClusterAttributeDescriptor): + class GroupKeyMap(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x003F @@ -12753,12 +12871,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[GroupKeyManagement.Structs.GroupState]) + return ClusterObjectFieldDescriptor(Type=typing.List[GroupKeyManagement.Structs.GroupKey]) - value: 'typing.List[GroupKeyManagement.Structs.GroupState]' = field(default_factory=lambda: []) + value: 'typing.List[GroupKeyManagement.Structs.GroupKey]' = field(default_factory=lambda: []) @dataclass - class GroupKeys(ClusterAttributeDescriptor): + class GroupTable(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x003F @@ -12769,9 +12887,41 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[GroupKeyManagement.Structs.GroupKey]) + return ClusterObjectFieldDescriptor(Type=typing.List[GroupKeyManagement.Structs.GroupInfo]) - value: 'typing.List[GroupKeyManagement.Structs.GroupKey]' = field(default_factory=lambda: []) + value: 'typing.List[GroupKeyManagement.Structs.GroupInfo]' = field(default_factory=lambda: []) + + @dataclass + class MaxGroupsPerFabric(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class MaxGroupKeysPerFabric(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x003F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 @dataclass class AttributeList(ClusterAttributeDescriptor): diff --git a/src/credentials/GroupDataProvider.h b/src/credentials/GroupDataProvider.h index ce9a2914c4b1a3..1bc02b0dfc01b5 100644 --- a/src/credentials/GroupDataProvider.h +++ b/src/credentials/GroupDataProvider.h @@ -232,6 +232,8 @@ class GroupDataProvider virtual CHIP_ERROR SetGroupKeyAt(chip::FabricIndex fabric_index, size_t index, const GroupKey & info) = 0; virtual CHIP_ERROR GetGroupKeyAt(chip::FabricIndex fabric_index, size_t index, GroupKey & info) = 0; virtual CHIP_ERROR RemoveGroupKeyAt(chip::FabricIndex fabric_index, size_t index) = 0; + virtual CHIP_ERROR RemoveGroupKeys(chip::FabricIndex fabric_index) = 0; + /** * Creates an iterator that may be used to obtain the list of (group, keyset) pairs associated with the given fabric. * The number of concurrent instances of this iterator is limited. In order to release the allocated memory, @@ -239,7 +241,7 @@ class GroupDataProvider * @retval An instance of GroupKeyIterator on success * @retval nullptr if no iterator instances are available. */ - virtual GroupKeyIterator * IterateGroupKey(chip::FabricIndex fabric_index) = 0; + virtual GroupKeyIterator * IterateGroupKeys(chip::FabricIndex fabric_index) = 0; // // Key Sets diff --git a/src/credentials/GroupDataProviderImpl.cpp b/src/credentials/GroupDataProviderImpl.cpp index 47e78122794528..69f9977c66b9cb 100644 --- a/src/credentials/GroupDataProviderImpl.cpp +++ b/src/credentials/GroupDataProviderImpl.cpp @@ -1206,7 +1206,32 @@ CHIP_ERROR GroupDataProviderImpl::RemoveGroupKeyAt(chip::FabricIndex fabric_inde return fabric.Save(mStorage); } -GroupDataProvider::GroupKeyIterator * GroupDataProviderImpl::IterateGroupKey(chip::FabricIndex fabric_index) +CHIP_ERROR GroupDataProviderImpl::RemoveGroupKeys(chip::FabricIndex fabric_index) +{ + VerifyOrReturnError(mInitialized, CHIP_ERROR_INTERNAL); + + FabricData fabric(fabric_index); + VerifyOrReturnError(CHIP_NO_ERROR == fabric.Load(mStorage), CHIP_ERROR_INVALID_FABRIC_ID); + + size_t count = 0; + KeyMapData map(fabric_index, fabric.first_map); + while (count++ < fabric.map_count) + { + if (CHIP_NO_ERROR != map.Load(mStorage)) + { + break; + } + map.Delete(mStorage); + map.id = map.next; + } + + // Update fabric + fabric.first_map = 0; + fabric.map_count = 0; + return fabric.Save(mStorage); +} + +GroupDataProvider::GroupKeyIterator * GroupDataProviderImpl::IterateGroupKeys(chip::FabricIndex fabric_index) { VerifyOrReturnError(mInitialized, nullptr); return mGroupKeyIterators.CreateObject(*this, fabric_index); diff --git a/src/credentials/GroupDataProviderImpl.h b/src/credentials/GroupDataProviderImpl.h index bd96080842e425..122c0d1cf8f21e 100644 --- a/src/credentials/GroupDataProviderImpl.h +++ b/src/credentials/GroupDataProviderImpl.h @@ -61,7 +61,8 @@ class GroupDataProviderImpl : public GroupDataProvider CHIP_ERROR SetGroupKeyAt(chip::FabricIndex fabric_index, size_t index, const GroupKey & info) override; CHIP_ERROR GetGroupKeyAt(chip::FabricIndex fabric_index, size_t index, GroupKey & info) override; CHIP_ERROR RemoveGroupKeyAt(chip::FabricIndex fabric_index, size_t index) override; - GroupKeyIterator * IterateGroupKey(chip::FabricIndex fabric_index) override; + CHIP_ERROR RemoveGroupKeys(chip::FabricIndex fabric_index) override; + GroupKeyIterator * IterateGroupKeys(chip::FabricIndex fabric_index) override; // // Key Sets diff --git a/src/credentials/tests/TestGroupDataProvider.cpp b/src/credentials/tests/TestGroupDataProvider.cpp index 2012f7933b53bd..4d0f3b35d78544 100644 --- a/src/credentials/tests/TestGroupDataProvider.cpp +++ b/src/credentials/tests/TestGroupDataProvider.cpp @@ -456,7 +456,7 @@ void TestEndpointIterator(nlTestSuite * apSuite, void * apContext) } } -void TestGroupKey(nlTestSuite * apSuite, void * apContext) +void TestGroupKeys(nlTestSuite * apSuite, void * apContext) { GroupDataProvider * provider = GetGroupDataProvider(); NL_TEST_ASSERT(apSuite, provider); @@ -542,6 +542,23 @@ void TestGroupKey(nlTestSuite * apSuite, void * apContext) NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == provider->GetGroupKeyAt(kFabric2, 0, pair)); NL_TEST_ASSERT(apSuite, pair == kGroup3Keyset1); + + // Remove all + + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == provider->RemoveGroupKeys(kFabric1)); + + NL_TEST_ASSERT(apSuite, CHIP_ERROR_KEY_NOT_FOUND == provider->GetGroupKeyAt(kFabric1, 3, pair)); + NL_TEST_ASSERT(apSuite, CHIP_ERROR_KEY_NOT_FOUND == provider->GetGroupKeyAt(kFabric1, 2, pair)); + NL_TEST_ASSERT(apSuite, CHIP_ERROR_KEY_NOT_FOUND == provider->GetGroupKeyAt(kFabric1, 1, pair)); + NL_TEST_ASSERT(apSuite, CHIP_ERROR_KEY_NOT_FOUND == provider->GetGroupKeyAt(kFabric1, 0, pair)); + + NL_TEST_ASSERT(apSuite, CHIP_ERROR_KEY_NOT_FOUND == provider->GetGroupKeyAt(kFabric2, 3, pair)); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == provider->GetGroupKeyAt(kFabric2, 2, pair)); + NL_TEST_ASSERT(apSuite, pair == kGroup2Keyset3); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == provider->GetGroupKeyAt(kFabric2, 1, pair)); + NL_TEST_ASSERT(apSuite, pair == kGroup2Keyset2); + NL_TEST_ASSERT(apSuite, CHIP_NO_ERROR == provider->GetGroupKeyAt(kFabric2, 0, pair)); + NL_TEST_ASSERT(apSuite, pair == kGroup3Keyset1); } void TestGroupKeyIterator(nlTestSuite * apSuite, void * apContext) @@ -577,7 +594,7 @@ void TestGroupKeyIterator(nlTestSuite * apSuite, void * apContext) kGroup1Keyset0, kGroup1Keyset1, kGroup1Keyset2, kGroup1Keyset3 }; size_t expected_f1_count = sizeof(expected_f1) / sizeof(GroupKey); - auto it = provider->IterateGroupKey(kFabric1); + auto it = provider->IterateGroupKeys(kFabric1); size_t count = 0; NL_TEST_ASSERT(apSuite, it); if (it) @@ -596,7 +613,7 @@ void TestGroupKeyIterator(nlTestSuite * apSuite, void * apContext) GroupKey expected_f2[] = { kGroup2Keyset0, kGroup2Keyset1, kGroup2Keyset2, kGroup2Keyset3 }; size_t expected_f2_count = sizeof(expected_f2) / sizeof(GroupKey); - it = provider->IterateGroupKey(kFabric2); + it = provider->IterateGroupKeys(kFabric2); NL_TEST_ASSERT(apSuite, it); if (it) { @@ -982,7 +999,7 @@ const nlTest sTests[] = { NL_TEST_DEF("TestStorageDelegate", chip::app::TestGrou NL_TEST_DEF("TestGroupInfoIterator", chip::app::TestGroups::TestGroupInfoIterator), NL_TEST_DEF("TestEndpoints", chip::app::TestGroups::TestEndpoints), NL_TEST_DEF("TestEndpointIterator", chip::app::TestGroups::TestEndpointIterator), - NL_TEST_DEF("TestGroupKey", chip::app::TestGroups::TestGroupKey), + NL_TEST_DEF("TestGroupKeys", chip::app::TestGroups::TestGroupKeys), NL_TEST_DEF("TestGroupKeyIterator", chip::app::TestGroups::TestGroupKeyIterator), NL_TEST_DEF("TestKeySets", chip::app::TestGroups::TestKeySets), NL_TEST_DEF("TestKeySetIterator", chip::app::TestGroups::TestKeySetIterator), diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 5df08da8882552..5ce6a7af79b4ed 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -3242,8 +3242,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader case Clusters::GroupKeyManagement::Id: { using namespace Clusters::GroupKeyManagement; switch (aPath.mAttributeId) { - case Attributes::Groups::Id: { - using TypeInfo = Attributes::Groups::TypeInfo; + case Attributes::GroupKeyMap::Id: { + using TypeInfo = Attributes::GroupKeyMap::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -3254,11 +3254,11 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - CHIPGroupKeyManagementClusterGroupState * newElement_0; - newElement_0 = [CHIPGroupKeyManagementClusterGroupState new]; - newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; - newElement_0.vendorGroupId = [NSNumber numberWithUnsignedShort:entry_0.vendorGroupId]; - newElement_0.groupKeySetIndex = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetIndex]; + CHIPGroupKeyManagementClusterGroupKey * newElement_0; + newElement_0 = [CHIPGroupKeyManagementClusterGroupKey new]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedShort:entry_0.fabricIndex]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named @@ -3271,8 +3271,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader value = array_0; return value; } - case Attributes::GroupKeys::Id: { - using TypeInfo = Attributes::GroupKeys::TypeInfo; + case Attributes::GroupTable::Id: { + using TypeInfo = Attributes::GroupTable::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -3283,14 +3283,29 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - CHIPGroupKeyManagementClusterGroupKey * newElement_0; - newElement_0 = [CHIPGroupKeyManagementClusterGroupKey new]; - newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; - newElement_0.groupKeyIndex = [NSNumber numberWithUnsignedShort:entry_0.groupKeyIndex]; - newElement_0.groupKeyRoot = [NSData dataWithBytes:entry_0.groupKeyRoot.data() length:entry_0.groupKeyRoot.size()]; - newElement_0.groupKeyEpochStartTime = [NSNumber numberWithUnsignedLongLong:entry_0.groupKeyEpochStartTime]; - newElement_0.groupKeySecurityPolicy = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.groupKeySecurityPolicy)]; + CHIPGroupKeyManagementClusterGroupInfo * newElement_0; + newElement_0 = [CHIPGroupKeyManagementClusterGroupInfo new]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedShort:entry_0.fabricIndex]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.endpoints.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSNumber * newElement_2; + newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; + [array_2 addObject:newElement_2]; + } + { // Scope for the error so we will know what it's named + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + } + newElement_0.endpoints = array_2; + newElement_0.groupName = [[NSString alloc] initWithBytes:entry_0.groupName.data() + length:entry_0.groupName.size() + encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named @@ -3303,6 +3318,28 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader value = array_0; return value; } + case Attributes::MaxGroupsPerFabric::Id: { + using TypeInfo = Attributes::MaxGroupsPerFabric::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::MaxGroupKeysPerFabric::Id: { + using TypeInfo = Attributes::MaxGroupKeysPerFabric::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } case Attributes::AttributeList::Id: { using TypeInfo = Attributes::AttributeList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index e041b5dc1bdf8d..696f703ea14890 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -2455,19 +2455,19 @@ } } -void CHIPGroupKeyManagementGroupsListAttributeCallbackBridge::OnSuccessFn(void * context, - const chip::app::DataModel::DecodableList & value) +void CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::DecodableList & value) { NSArray * _Nonnull objCValue; auto * array_0 = [NSMutableArray new]; auto iter_0 = value.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - CHIPGroupKeyManagementClusterGroupState * newElement_0; - newElement_0 = [CHIPGroupKeyManagementClusterGroupState new]; - newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; - newElement_0.vendorGroupId = [NSNumber numberWithUnsignedShort:entry_0.vendorGroupId]; - newElement_0.groupKeySetIndex = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetIndex]; + CHIPGroupKeyManagementClusterGroupKey * newElement_0; + newElement_0 = [CHIPGroupKeyManagementClusterGroupKey new]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedShort:entry_0.fabricIndex]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named @@ -2481,9 +2481,9 @@ DispatchSuccess(context, objCValue); }; -void CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +void CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) { - auto * self = static_cast(context); + auto * self = static_cast(context); if (!self->mQueue) { return; } @@ -2497,21 +2497,37 @@ } } -void CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge::OnSuccessFn(void * context, - const chip::app::DataModel::DecodableList & value) +void CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::DecodableList & value) { NSArray * _Nonnull objCValue; auto * array_0 = [NSMutableArray new]; auto iter_0 = value.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - CHIPGroupKeyManagementClusterGroupKey * newElement_0; - newElement_0 = [CHIPGroupKeyManagementClusterGroupKey new]; - newElement_0.vendorId = [NSNumber numberWithUnsignedShort:entry_0.vendorId]; - newElement_0.groupKeyIndex = [NSNumber numberWithUnsignedShort:entry_0.groupKeyIndex]; - newElement_0.groupKeyRoot = [NSData dataWithBytes:entry_0.groupKeyRoot.data() length:entry_0.groupKeyRoot.size()]; - newElement_0.groupKeyEpochStartTime = [NSNumber numberWithUnsignedLongLong:entry_0.groupKeyEpochStartTime]; - newElement_0.groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.groupKeySecurityPolicy)]; + CHIPGroupKeyManagementClusterGroupInfo * newElement_0; + newElement_0 = [CHIPGroupKeyManagementClusterGroupInfo new]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedShort:entry_0.fabricIndex]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.endpoints.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSNumber * newElement_2; + newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; + [array_2 addObject:newElement_2]; + } + { // Scope for the error so we will know what it's named + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, EMBER_ZCL_STATUS_INVALID_VALUE); + return; + } + } + newElement_0.endpoints = array_2; + newElement_0.groupName = [[NSString alloc] initWithBytes:entry_0.groupName.data() + length:entry_0.groupName.size() + encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } { // Scope for the error so we will know what it's named @@ -2525,9 +2541,9 @@ DispatchSuccess(context, objCValue); }; -void CHIPGroupKeyManagementGroupKeysListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +void CHIPGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) { - auto * self = static_cast(context); + auto * self = static_cast(context); if (!self->mQueue) { return; } @@ -5245,6 +5261,53 @@ DispatchSuccess(context, response); }; +void CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType & data) +{ + auto * response = [CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseParams new]; + { + auto * array_0 = [NSMutableArray new]; + auto iter_0 = data.groupKeySetIDs.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + { // Scope for the error so we will know what it's named + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + OnFailureFn(context, EMBER_ZCL_STATUS_INVALID_VALUE); + return; + } + } + response.groupKeySetIDs = array_0; + } + DispatchSuccess(context, response); +}; + +void CHIPGroupKeyManagementClusterKeySetReadResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType & data) +{ + auto * response = [CHIPGroupKeyManagementClusterKeySetReadResponseParams new]; + { + response.groupKeySet = [CHIPGroupKeyManagementClusterGroupKeySet new]; + response.groupKeySet.groupKeySetID = [NSNumber numberWithUnsignedShort:data.groupKeySet.groupKeySetID]; + response.groupKeySet.groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:chip::to_underlying(data.groupKeySet.groupKeySecurityPolicy)]; + response.groupKeySet.epochKey0 = [NSData dataWithBytes:data.groupKeySet.epochKey0.data() + length:data.groupKeySet.epochKey0.size()]; + response.groupKeySet.epochStartTime0 = [NSNumber numberWithUnsignedLongLong:data.groupKeySet.epochStartTime0]; + response.groupKeySet.epochKey1 = [NSData dataWithBytes:data.groupKeySet.epochKey1.data() + length:data.groupKeySet.epochKey1.size()]; + response.groupKeySet.epochStartTime1 = [NSNumber numberWithUnsignedLongLong:data.groupKeySet.epochStartTime1]; + response.groupKeySet.epochKey2 = [NSData dataWithBytes:data.groupKeySet.epochKey2.data() + length:data.groupKeySet.epochKey2.size()]; + response.groupKeySet.epochStartTime2 = [NSNumber numberWithUnsignedLongLong:data.groupKeySet.epochStartTime2]; + } + DispatchSuccess(context, response); +}; + void CHIPGroupsClusterAddGroupResponseCallbackBridge::OnSuccessFn( void * context, const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType & data) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 1e3603fbe12549..9fdba7c73cc7f0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -57,6 +57,10 @@ typedef void (*CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallb void *, const chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType &); typedef void (*CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackType)( void *, const chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType &); +typedef void (*CHIPGroupKeyManagementClusterKeySetReadResponseCallbackType)( + void *, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType &); typedef void (*CHIPGroupsClusterAddGroupResponseCallbackType)( void *, const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType &); typedef void (*CHIPGroupsClusterGetGroupMembershipResponseCallbackType)( @@ -2415,28 +2419,28 @@ class CHIPGeneralDiagnosticsAttributeListListAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPGroupKeyManagementGroupsListAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPGroupKeyManagementGroupsListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, - bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; static void OnSuccessFn( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value); }; -class CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge - : public CHIPGroupKeyManagementGroupsListAttributeCallbackBridge +class CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge + : public CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge { public: - CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, - SubscriptionEstablishedHandler establishedHandler) : - CHIPGroupKeyManagementGroupsListAttributeCallbackBridge(queue, handler, action, true), + CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -2446,28 +2450,28 @@ class CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge SubscriptionEstablishedHandler mEstablishedHandler; }; -class CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge - : public CHIPCallbackBridge +class CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge + : public CHIPCallbackBridge { public: - CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, bool keepAlive = false) : - CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; static void OnSuccessFn( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value); }; -class CHIPGroupKeyManagementGroupKeysListAttributeCallbackSubscriptionBridge - : public CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge +class CHIPGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge + : public CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge { public: - CHIPGroupKeyManagementGroupKeysListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, - CHIPActionBlock action, - SubscriptionEstablishedHandler establishedHandler) : - CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge(queue, handler, action, true), + CHIPGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge(queue, handler, action, true), mEstablishedHandler(establishedHandler) {} @@ -4224,6 +4228,33 @@ class CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackBridge const chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType & data); }; +class CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType & data); +}; + +class CHIPGroupKeyManagementClusterKeySetReadResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGroupKeyManagementClusterKeySetReadResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType & data); +}; + class CHIPGroupsClusterAddGroupResponseCallbackBridge : public CHIPCallbackBridge { public: diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 42dabdd81919e4..1938957c895889 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1808,18 +1808,37 @@ NS_ASSUME_NONNULL_BEGIN */ @interface CHIPGroupKeyManagement : CHIPCluster -- (void)readAttributeGroupsWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; -- (void)subscribeAttributeGroupsWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; +- (void)keySetReadWithParams:(CHIPGroupKeyManagementClusterKeySetReadParams *)params + completionHandler:(void (^)(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; +- (void)keySetReadAllIndicesWithParams:(CHIPGroupKeyManagementClusterKeySetReadAllIndicesParams *)params + completionHandler:(void (^)(CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; +- (void)keySetRemoveWithParams:(CHIPGroupKeyManagementClusterKeySetRemoveParams *)params + completionHandler:(StatusCompletion)completionHandler; +- (void)keySetWriteWithParams:(CHIPGroupKeyManagementClusterKeySetWriteParams *)params + completionHandler:(StatusCompletion)completionHandler; -- (void)readAttributeGroupKeysWithCompletionHandler:(void (^)( - NSArray * _Nullable value, NSError * _Nullable error))completionHandler; -- (void)subscribeAttributeGroupKeysWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; +- (void)readAttributeGroupKeyMapWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)writeAttributeGroupKeyMapWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)subscribeAttributeGroupKeyMapWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; + +- (void)readAttributeGroupTableWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeGroupTableWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler; + +- (void)readAttributeMaxGroupsPerFabricWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; + +- (void)readAttributeMaxGroupKeysPerFabricWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; - (void)readAttributeAttributeListWithCompletionHandler:(void (^)( NSArray * _Nullable value, NSError * _Nullable error))completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index c26fefa3c323ba..f641de377f6129 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -7580,65 +7580,230 @@ @implementation CHIPGroupKeyManagement return &_cppCluster; } -- (void)readAttributeGroupsWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)keySetReadWithParams:(CHIPGroupKeyManagementClusterKeySetReadParams *)params + completionHandler:(void (^)(CHIPGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler { - new CHIPGroupKeyManagementGroupsListAttributeCallbackBridge( + ListFreer listFreer; + GroupKeyManagement::Commands::KeySetRead::Type request; + request.groupKeySetID = params.groupKeySetID.unsignedShortValue; + + new CHIPGroupKeyManagementClusterKeySetReadResponseCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)keySetReadAllIndicesWithParams:(CHIPGroupKeyManagementClusterKeySetReadAllIndicesParams *)params + completionHandler:(void (^)(CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler +{ + ListFreer listFreer; + GroupKeyManagement::Commands::KeySetReadAllIndices::Type request; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (params.groupKeySetIDs.count != 0) { + auto * listHolder_0 = new ListHolder(params.groupKeySetIDs.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < params.groupKeySetIDs.count; ++i_0) { + if (![params.groupKeySetIDs[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return; + } + auto element_0 = (NSNumber *) params.groupKeySetIDs[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedShortValue; + } + request.groupKeySetIDs = ListType_0(listHolder_0->mList, params.groupKeySetIDs.count); + } else { + request.groupKeySetIDs = ListType_0(); + } + } + + new CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge( self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = GroupKeyManagement::Attributes::Groups::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn + = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)keySetRemoveWithParams:(CHIPGroupKeyManagementClusterKeySetRemoveParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + GroupKeyManagement::Commands::KeySetRemove::Type request; + request.groupKeySetID = params.groupKeySetID.unsignedShortValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)keySetWriteWithParams:(CHIPGroupKeyManagementClusterKeySetWriteParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + GroupKeyManagement::Commands::KeySetWrite::Type request; + request.groupKeySet.groupKeySetID = params.groupKeySet.groupKeySetID.unsignedShortValue; + request.groupKeySet.groupKeySecurityPolicy + = static_cast>( + params.groupKeySet.groupKeySecurityPolicy.unsignedCharValue); + request.groupKeySet.epochKey0 = [self asByteSpan:params.groupKeySet.epochKey0]; + request.groupKeySet.epochStartTime0 = params.groupKeySet.epochStartTime0.unsignedLongLongValue; + request.groupKeySet.epochKey1 = [self asByteSpan:params.groupKeySet.epochKey1]; + request.groupKeySet.epochStartTime1 = params.groupKeySet.epochStartTime1.unsignedLongLongValue; + request.groupKeySet.epochKey2 = [self asByteSpan:params.groupKeySet.epochKey2]; + request.groupKeySet.epochStartTime2 = params.groupKeySet.epochStartTime2.unsignedLongLongValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)readAttributeGroupKeyMapWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); } -- (void)subscribeAttributeGroupsWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeGroupKeyMapWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + TypeInfo::Type cppValue; + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (value.count != 0) { + auto * listHolder_0 = new ListHolder(value.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < value.count; ++i_0) { + if (![value[i_0] isKindOfClass:[CHIPGroupKeyManagementClusterGroupKey class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (CHIPGroupKeyManagementClusterGroupKey *) value[i_0]; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedShortValue; + listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; + listHolder_0->mList[i_0].groupKeySetID = element_0.groupKeySetID.unsignedShortValue; + } + cppValue = ListType_0(listHolder_0->mList, value.count); + } else { + cppValue = ListType_0(); + } + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeGroupKeyMapWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge( + new CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = GroupKeyManagement::Attributes::Groups::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = GroupKeyManagement::Attributes::GroupKeyMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, minInterval, maxInterval, - CHIPGroupKeyManagementGroupsListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + CHIPGroupKeyManagementGroupKeyMapListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); }, subscriptionEstablishedHandler); } -- (void)readAttributeGroupKeysWithCompletionHandler:(void (^)( - NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeGroupTableWithCompletionHandler:(void (^)( + NSArray * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPGroupKeyManagementGroupKeysListAttributeCallbackBridge( + new CHIPGroupKeyManagementGroupTableListAttributeCallbackBridge( self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = GroupKeyManagement::Attributes::GroupKeys::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); } -- (void)subscribeAttributeGroupKeysWithMinInterval:(uint16_t)minInterval - maxInterval:(uint16_t)maxInterval - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGroupTableWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPGroupKeyManagementGroupKeysListAttributeCallbackSubscriptionBridge( + new CHIPGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = GroupKeyManagement::Attributes::GroupKeys::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, minInterval, maxInterval, - CHIPGroupKeyManagementGroupKeysListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + CHIPGroupKeyManagementGroupTableListAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); }, subscriptionEstablishedHandler); } +- (void)readAttributeMaxGroupsPerFabricWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = GroupKeyManagement::Attributes::MaxGroupsPerFabric::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)readAttributeMaxGroupKeysPerFabricWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPInt16uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)readAttributeAttributeListWithCompletionHandler:(void (^)( NSArray * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 856d8402c6acbf..108a6e83ff4ba6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -825,6 +825,36 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPGroupKeyManagementClusterKeySetWriteParams : NSObject +@property (strong, nonatomic) CHIPGroupKeyManagementClusterGroupKeySet * _Nonnull groupKeySet; +- (instancetype)init; +@end + +@interface CHIPGroupKeyManagementClusterKeySetReadParams : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull groupKeySetID; +- (instancetype)init; +@end + +@interface CHIPGroupKeyManagementClusterKeySetReadResponseParams : NSObject +@property (strong, nonatomic) CHIPGroupKeyManagementClusterGroupKeySet * _Nonnull groupKeySet; +- (instancetype)init; +@end + +@interface CHIPGroupKeyManagementClusterKeySetRemoveParams : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull groupKeySetID; +- (instancetype)init; +@end + +@interface CHIPGroupKeyManagementClusterKeySetReadAllIndicesParams : NSObject +@property (strong, nonatomic) NSArray * _Nonnull groupKeySetIDs; +- (instancetype)init; +@end + +@interface CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseParams : NSObject +@property (strong, nonatomic) NSArray * _Nonnull groupKeySetIDs; +- (instancetype)init; +@end + @interface CHIPModeSelectClusterChangeToModeParams : NSObject @property (strong, nonatomic, getter=getNewMode) NSNumber * _Nonnull newMode; - (instancetype)init; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index caf82e865dd04d..9dbdff1dd4d5ea 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -1742,6 +1742,72 @@ - (instancetype)init } @end +@implementation CHIPGroupKeyManagementClusterKeySetWriteParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySet = [CHIPGroupKeyManagementClusterGroupKeySet new]; + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterKeySetReadParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetID = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterKeySetReadResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySet = [CHIPGroupKeyManagementClusterGroupKeySet new]; + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterKeySetRemoveParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetID = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterKeySetReadAllIndicesParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetIDs = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetIDs = [NSArray array]; + } + return self; +} +@end + @implementation CHIPModeSelectClusterChangeToModeParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index 9c6267167c22df..e11e7d2b4753be 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -230,19 +230,30 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPGroupKeyManagementClusterGroupInfo : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; +@property (strong, nonatomic) NSNumber * _Nonnull groupId; +@property (strong, nonatomic) NSArray * _Nonnull endpoints; +@property (strong, nonatomic) NSString * _Nonnull groupName; +- (instancetype)init; +@end + @interface CHIPGroupKeyManagementClusterGroupKey : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull vendorId; -@property (strong, nonatomic) NSNumber * _Nonnull groupKeyIndex; -@property (strong, nonatomic) NSData * _Nonnull groupKeyRoot; -@property (strong, nonatomic) NSNumber * _Nonnull groupKeyEpochStartTime; -@property (strong, nonatomic) NSNumber * _Nonnull groupKeySecurityPolicy; +@property (strong, nonatomic) NSNumber * _Nonnull fabricIndex; +@property (strong, nonatomic) NSNumber * _Nonnull groupId; +@property (strong, nonatomic) NSNumber * _Nonnull groupKeySetID; - (instancetype)init; @end -@interface CHIPGroupKeyManagementClusterGroupState : NSObject -@property (strong, nonatomic) NSNumber * _Nonnull vendorId; -@property (strong, nonatomic) NSNumber * _Nonnull vendorGroupId; -@property (strong, nonatomic) NSNumber * _Nonnull groupKeySetIndex; +@interface CHIPGroupKeyManagementClusterGroupKeySet : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull groupKeySetID; +@property (strong, nonatomic) NSNumber * _Nonnull groupKeySecurityPolicy; +@property (strong, nonatomic) NSData * _Nonnull epochKey0; +@property (strong, nonatomic) NSNumber * _Nonnull epochStartTime0; +@property (strong, nonatomic) NSData * _Nonnull epochKey1; +@property (strong, nonatomic) NSNumber * _Nonnull epochStartTime1; +@property (strong, nonatomic) NSData * _Nonnull epochKey2; +@property (strong, nonatomic) NSNumber * _Nonnull epochStartTime2; - (instancetype)init; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index 00e1b8bd5e8b4d..4daf80b2bded42 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -456,35 +456,58 @@ - (instancetype)init } @end -@implementation CHIPGroupKeyManagementClusterGroupKey +@implementation CHIPGroupKeyManagementClusterGroupInfo - (instancetype)init { if (self = [super init]) { - _vendorId = @(0); + _fabricIndex = @(0); - _groupKeyIndex = @(0); + _groupId = @(0); - _groupKeyRoot = [NSData data]; + _endpoints = [NSArray array]; - _groupKeyEpochStartTime = @(0); + _groupName = @""; + } + return self; +} +@end - _groupKeySecurityPolicy = @(0); +@implementation CHIPGroupKeyManagementClusterGroupKey +- (instancetype)init +{ + if (self = [super init]) { + + _fabricIndex = @(0); + + _groupId = @(0); + + _groupKeySetID = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupState +@implementation CHIPGroupKeyManagementClusterGroupKeySet - (instancetype)init { if (self = [super init]) { - _vendorId = @(0); + _groupKeySetID = @(0); + + _groupKeySecurityPolicy = @(0); + + _epochKey0 = [NSData data]; + + _epochStartTime0 = @(0); + + _epochKey1 = [NSData data]; + + _epochStartTime1 = @(0); - _vendorGroupId = @(0); + _epochKey2 = [NSData data]; - _groupKeySetIndex = @(0); + _epochStartTime2 = @(0); } return self; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index 5aa678b0be1c45..6fa9f71f91b78b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -433,8 +433,10 @@ NS_ASSUME_NONNULL_BEGIN */ @interface CHIPTestGroupKeyManagement : CHIPGroupKeyManagement -- (void)writeAttributeGroupsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeGroupKeysWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeGroupTableWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeMaxGroupsPerFabricWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeMaxGroupKeysPerFabricWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 633f34100cfdb8..32426cf68abc11 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -4381,7 +4381,7 @@ @implementation CHIPTestGroupKeyManagement return &_cppCluster; } -- (void)writeAttributeGroupsWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeGroupTableWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -4390,7 +4390,7 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::Groups::TypeInfo; + using TypeInfo = GroupKeyManagement::Attributes::GroupTable::TypeInfo; TypeInfo::Type cppValue; { using ListType_0 = std::remove_reference_t; @@ -4402,14 +4402,36 @@ new CHIPDefaultSuccessCallbackBridge( } listFreer.add(listHolder_0); for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPGroupKeyManagementClusterGroupState class]]) { + if (![value[i_0] isKindOfClass:[CHIPGroupKeyManagementClusterGroupInfo class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (CHIPGroupKeyManagementClusterGroupState *) value[i_0]; - listHolder_0->mList[i_0].vendorId = element_0.vendorId.unsignedShortValue; - listHolder_0->mList[i_0].vendorGroupId = element_0.vendorGroupId.unsignedShortValue; - listHolder_0->mList[i_0].groupKeySetIndex = element_0.groupKeySetIndex.unsignedShortValue; + auto element_0 = (CHIPGroupKeyManagementClusterGroupInfo *) value[i_0]; + listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedShortValue; + listHolder_0->mList[i_0].groupId = element_0.groupId.unsignedShortValue; + { + using ListType_2 = std::remove_reference_tmList[i_0].endpoints)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.endpoints.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.endpoints.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.endpoints.count; ++i_2) { + if (![element_0.endpoints[i_2] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_2 = (NSNumber *) element_0.endpoints[i_2]; + listHolder_2->mList[i_2] = element_2.unsignedShortValue; + } + listHolder_0->mList[i_0].endpoints = ListType_2(listHolder_2->mList, element_0.endpoints.count); + } else { + listHolder_0->mList[i_0].endpoints = ListType_2(); + } + } + listHolder_0->mList[i_0].groupName = [self asCharSpan:element_0.groupName]; } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -4422,7 +4444,7 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeGroupKeysWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeMaxGroupsPerFabricWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -4431,36 +4453,28 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = GroupKeyManagement::Attributes::GroupKeys::TypeInfo; + using TypeInfo = GroupKeyManagement::Attributes::MaxGroupsPerFabric::TypeInfo; TypeInfo::Type cppValue; - { - using ListType_0 = std::remove_reference_t; - using ListMemberType_0 = ListMemberTypeGetter::Type; - if (value.count != 0) { - auto * listHolder_0 = new ListHolder(value.count); - if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < value.count; ++i_0) { - if (![value[i_0] isKindOfClass:[CHIPGroupKeyManagementClusterGroupKey class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_0 = (CHIPGroupKeyManagementClusterGroupKey *) value[i_0]; - listHolder_0->mList[i_0].vendorId = element_0.vendorId.unsignedShortValue; - listHolder_0->mList[i_0].groupKeyIndex = element_0.groupKeyIndex.unsignedShortValue; - listHolder_0->mList[i_0].groupKeyRoot = [self asByteSpan:element_0.groupKeyRoot]; - listHolder_0->mList[i_0].groupKeyEpochStartTime = element_0.groupKeyEpochStartTime.unsignedLongLongValue; - listHolder_0->mList[i_0].groupKeySecurityPolicy - = static_castmList[i_0].groupKeySecurityPolicy)>>( - element_0.groupKeySecurityPolicy.unsignedCharValue); - } - cppValue = ListType_0(listHolder_0->mList, value.count); - } else { - cppValue = ListType_0(); - } - } + cppValue = value.unsignedShortValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeMaxGroupKeysPerFabricWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedShortValue; auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 4fd3677cd01583..8561d7cd05ca92 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -36576,7 +36576,7 @@ - (void)testSendClusterGeneralDiagnosticsReadAttributeClusterRevisionWithComplet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterGroupKeyManagementReadAttributeGroupsWithCompletionHandler +- (void)testSendClusterGroupKeyManagementReadAttributeGroupKeyMapWithCompletionHandler { dispatch_queue_t queue = dispatch_get_main_queue(); @@ -36590,10 +36590,10 @@ - (void)testSendClusterGroupKeyManagementReadAttributeGroupsWithCompletionHandle XCTAssertNotNil(cluster); XCTestExpectation * expectation = - [self expectationWithDescription:@"GroupKeyManagementReadAttributeGroupsWithCompletionHandler"]; + [self expectationWithDescription:@"GroupKeyManagementReadAttributeGroupKeyMapWithCompletionHandler"]; - [cluster readAttributeGroupsWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"GroupKeyManagement Groups Error: %@", err); + [cluster readAttributeGroupKeyMapWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"GroupKeyManagement GroupKeyMap Error: %@", err); XCTAssertEqual(err.code, 0); [expectation fulfill]; }]; @@ -36601,7 +36601,82 @@ - (void)testSendClusterGroupKeyManagementReadAttributeGroupsWithCompletionHandle [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterGroupKeyManagementReadAttributeGroupKeysWithCompletionHandler +- (void)testSendClusterGroupKeyManagementWriteAttributeGroupKeyMapWithValue +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPGroupKeyManagement * cluster = [[CHIPGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = [self expectationWithDescription:@"GroupKeyManagementWriteAttributeGroupKeyMapWithValue"]; + + NSArray * _Nonnull value = [NSArray array]; + [cluster writeAttributeGroupKeyMapWithValue:value + completionHandler:^(NSError * _Nullable err) { + NSLog(@"GroupKeyManagement GroupKeyMap Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterGroupKeyManagementReadAttributeGroupTableWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPGroupKeyManagement * cluster = [[CHIPGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = + [self expectationWithDescription:@"GroupKeyManagementReadAttributeGroupTableWithCompletionHandler"]; + + [cluster readAttributeGroupTableWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"GroupKeyManagement GroupTable Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterGroupKeyManagementReadAttributeMaxGroupsPerFabricWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPGroupKeyManagement * cluster = [[CHIPGroupKeyManagement alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = + [self expectationWithDescription:@"GroupKeyManagementReadAttributeMaxGroupsPerFabricWithCompletionHandler"]; + + [cluster readAttributeMaxGroupsPerFabricWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"GroupKeyManagement MaxGroupsPerFabric Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterGroupKeyManagementReadAttributeMaxGroupKeysPerFabricWithCompletionHandler { dispatch_queue_t queue = dispatch_get_main_queue(); @@ -36615,10 +36690,10 @@ - (void)testSendClusterGroupKeyManagementReadAttributeGroupKeysWithCompletionHan XCTAssertNotNil(cluster); XCTestExpectation * expectation = - [self expectationWithDescription:@"GroupKeyManagementReadAttributeGroupKeysWithCompletionHandler"]; + [self expectationWithDescription:@"GroupKeyManagementReadAttributeMaxGroupKeysPerFabricWithCompletionHandler"]; - [cluster readAttributeGroupKeysWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"GroupKeyManagement GroupKeys Error: %@", err); + [cluster readAttributeMaxGroupKeysPerFabricWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"GroupKeyManagement MaxGroupKeysPerFabric Error: %@", err); XCTAssertEqual(err.code, 0); [expectation fulfill]; }]; diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index a00849135e4baa..000f19366fdda4 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -664,6 +664,74 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace GeneralCommissioning +namespace GroupKeyManagement { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + // 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. + // The following variables are used for all commands to save code size. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::KeySetRead::Id: { + Commands::KeySetRead::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetReadCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetReadAllIndices::Id: { + Commands::KeySetReadAllIndices::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetReadAllIndicesCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetRemove::Id: { + Commands::KeySetRemove::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetRemoveCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::KeySetWrite::Id: { + Commands::KeySetWrite::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetWriteCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace GroupKeyManagement + namespace Groups { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -1868,6 +1936,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::GroupKeyManagement::Id: + Clusters::GroupKeyManagement::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::Groups::Id: Clusters::Groups::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 962979b7b6ae59..4d3a9d52ac67f9 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -277,7 +277,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), big-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -293,7 +293,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -948,7 +948,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), little-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -964,7 +964,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1460,7 +1460,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 586 +#define GENERATED_ATTRIBUTE_COUNT 588 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1686,9 +1686,11 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(632) }, /* groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* group keys */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(632) }, /* groupKeyMap */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* groupTable */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* maxGroupsPerFabric */ \ + { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* maxGroupKeysPerFabric */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ @@ -2418,210 +2420,210 @@ 0x003E, ZAP_ATTRIBUTE_INDEX(166), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { \ - 0x003F, ZAP_ATTRIBUTE_INDEX(172), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003F, ZAP_ATTRIBUTE_INDEX(172), 5, 514, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Group Key Management (server) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(175), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(177), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { \ - 0x0041, ZAP_ATTRIBUTE_INDEX(177), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0041, ZAP_ATTRIBUTE_INDEX(179), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: User Label (server) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(179), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(181), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ { 0x0003, \ - ZAP_ATTRIBUTE_INDEX(183), \ + ZAP_ATTRIBUTE_INDEX(185), \ 3, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x0004, \ - ZAP_ATTRIBUTE_INDEX(186), \ + ZAP_ATTRIBUTE_INDEX(188), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */ \ { 0x0005, \ - ZAP_ATTRIBUTE_INDEX(188), \ + ZAP_ATTRIBUTE_INDEX(190), \ 6, \ 8, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(194), \ + ZAP_ATTRIBUTE_INDEX(196), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/Off (server) */ \ { \ - 0x0007, ZAP_ATTRIBUTE_INDEX(201), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0007, ZAP_ATTRIBUTE_INDEX(203), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ { 0x0008, \ - ZAP_ATTRIBUTE_INDEX(204), \ + ZAP_ATTRIBUTE_INDEX(206), \ 15, \ 23, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x000F, ZAP_ATTRIBUTE_INDEX(219), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x000F, ZAP_ATTRIBUTE_INDEX(221), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(223), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(225), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ { \ - 0x001E, ZAP_ATTRIBUTE_INDEX(228), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001E, ZAP_ATTRIBUTE_INDEX(230), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { \ - 0x0025, ZAP_ATTRIBUTE_INDEX(229), 4, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0025, ZAP_ATTRIBUTE_INDEX(231), 4, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Actions (server) */ \ { \ - 0x002F, ZAP_ATTRIBUTE_INDEX(233), 11, 88, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002F, ZAP_ATTRIBUTE_INDEX(235), 11, 88, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Power Source (server) */ \ { \ - 0x0039, ZAP_ATTRIBUTE_INDEX(244), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0039, ZAP_ATTRIBUTE_INDEX(246), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Device Basic (server) */ \ { \ - 0x003B, ZAP_ATTRIBUTE_INDEX(245), 5, 9, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003B, ZAP_ATTRIBUTE_INDEX(247), 5, 9, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Switch (server) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(250), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(252), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Fixed Label (server) */ \ { \ - 0x0041, ZAP_ATTRIBUTE_INDEX(252), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0041, ZAP_ATTRIBUTE_INDEX(254), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: User Label (server) */ \ { \ - 0x0045, ZAP_ATTRIBUTE_INDEX(254), 2, 3, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0045, ZAP_ATTRIBUTE_INDEX(256), 2, 3, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Boolean State (server) */ \ { \ - 0x0050, ZAP_ATTRIBUTE_INDEX(256), 6, 38, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0050, ZAP_ATTRIBUTE_INDEX(258), 6, 38, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Mode Select (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(262), \ + ZAP_ATTRIBUTE_INDEX(264), \ 19, \ 29, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0102, ZAP_ATTRIBUTE_INDEX(281), 20, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(283), 20, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Window Covering (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(301), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(303), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ 0x0200, \ - ZAP_ATTRIBUTE_INDEX(306), \ + ZAP_ATTRIBUTE_INDEX(308), \ 26, \ 54, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayPumpConfigurationAndControlServer \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ { 0x0201, \ - ZAP_ATTRIBUTE_INDEX(332), \ + ZAP_ATTRIBUTE_INDEX(334), \ 19, \ 34, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayThermostatServer }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { \ 0x0204, \ - ZAP_ATTRIBUTE_INDEX(351), \ + ZAP_ATTRIBUTE_INDEX(353), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayThermostatUserInterfaceConfigurationServer \ }, /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(355), \ + ZAP_ATTRIBUTE_INDEX(357), \ 53, \ 341, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0400, ZAP_ATTRIBUTE_INDEX(408), 6, 11, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0400, ZAP_ATTRIBUTE_INDEX(410), 6, 11, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(414), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(416), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { \ - 0x0403, ZAP_ATTRIBUTE_INDEX(419), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0403, ZAP_ATTRIBUTE_INDEX(421), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ { \ - 0x0404, ZAP_ATTRIBUTE_INDEX(423), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0404, ZAP_ATTRIBUTE_INDEX(425), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(428), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(430), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(433), \ + ZAP_ATTRIBUTE_INDEX(435), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOccupancySensingServer }, /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(437), \ + ZAP_ATTRIBUTE_INDEX(439), \ 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) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(443), 2, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0503, ZAP_ATTRIBUTE_INDEX(445), 2, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(445), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(447), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (server) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(447), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(449), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(450), 7, 39, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(452), 7, 39, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(457), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(459), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(460), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(462), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(461), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(463), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(462), 3, 260, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(464), 3, 260, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(465), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(467), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(468), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(470), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(470), 7, 106, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(472), 7, 106, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(477), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(479), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(478), 78, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(480), 78, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x0B04, ZAP_ATTRIBUTE_INDEX(556), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0B04, ZAP_ATTRIBUTE_INDEX(558), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { 0x0004, \ - ZAP_ATTRIBUTE_INDEX(568), \ + ZAP_ATTRIBUTE_INDEX(570), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 2, Cluster: Groups (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(570), \ + ZAP_ATTRIBUTE_INDEX(572), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(577), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(579), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Descriptor (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(582), \ + ZAP_ATTRIBUTE_INDEX(584), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2633,7 +2635,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 23, 1988 }, { ZAP_CLUSTER_INDEX(23), 45, 6078 }, { ZAP_CLUSTER_INDEX(68), 4, 21 }, \ + { ZAP_CLUSTER_INDEX(0), 23, 1992 }, { ZAP_CLUSTER_INDEX(23), 45, 6078 }, { ZAP_CLUSTER_INDEX(68), 4, 21 }, \ } // Largest attribute size is needed for various buffers @@ -2643,7 +2645,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (689) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8087) +#define ATTRIBUTE_MAX_SIZE (8091) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/app-common/app-common/zap-generated/af-structs.h b/zzz_generated/app-common/app-common/zap-generated/af-structs.h index d8e7b831abcbb4..33c21ab0dd3269 100644 --- a/zzz_generated/app-common/app-common/zap-generated/af-structs.h +++ b/zzz_generated/app-common/app-common/zap-generated/af-structs.h @@ -245,23 +245,35 @@ typedef struct _FabricDescriptor chip::CharSpan Label; } FabricDescriptor; +// Struct for GroupInfo +typedef struct _GroupInfo +{ + uint16_t FabricIndex; + uint16_t GroupId; + /* TYPE WARNING: array array defaults to */ uint8_t * Endpoints; + chip::CharSpan GroupName; +} GroupInfo; + // Struct for GroupKey typedef struct _GroupKey { - uint16_t VendorId; - uint16_t GroupKeyIndex; - chip::ByteSpan GroupKeyRoot; - uint64_t GroupKeyEpochStartTime; - uint8_t GroupKeySecurityPolicy; + uint16_t FabricIndex; + uint16_t GroupId; + uint16_t GroupKeySetID; } GroupKey; -// Struct for GroupState -typedef struct _GroupState +// Struct for GroupKeySet +typedef struct _GroupKeySet { - uint16_t VendorId; - uint16_t VendorGroupId; - uint16_t GroupKeySetIndex; -} GroupState; + uint16_t GroupKeySetID; + uint8_t GroupKeySecurityPolicy; + chip::ByteSpan EpochKey0; + uint64_t EpochStartTime0; + chip::ByteSpan EpochKey1; + uint64_t EpochStartTime1; + chip::ByteSpan EpochKey2; + uint64_t EpochStartTime2; +} GroupKeySet; // Struct for IasAceZoneStatusResult typedef struct _IasAceZoneStatusResult diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index ad86368560140c..b0965f415b6d0f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -600,8 +600,10 @@ // Client attributes // Server attributes -#define ZCL_GROUPS_ATTRIBUTE_ID (0x0000) -#define ZCL_GROUPKEYS_ATTRIBUTE_ID (0x0001) +#define ZCL_GROUP_KEY_MAP_ATTRIBUTE_ID (0x0000) +#define ZCL_GROUP_TABLE_ATTRIBUTE_ID (0x0001) +#define ZCL_MAX_GROUPS_PER_FABRIC_ATTRIBUTE_ID (0x0002) +#define ZCL_MAX_GROUP_KEYS_PER_FABRIC_ATTRIBUTE_ID (0x0003) // Attribute ids for cluster: Fixed Label diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index f198a0ce5a77c1..f5f5ec3c1d7111 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -11547,6 +11547,64 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace GroupKeyManagement { namespace Attributes { +namespace MaxGroupsPerFabric { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + NumericAttributeTraits::StorageType temp; + uint8_t * readable = NumericAttributeTraits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = NumericAttributeTraits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + NumericAttributeTraits::StorageType storageValue; + NumericAttributeTraits::WorkingToStorage(value, storageValue); + uint8_t * writable = NumericAttributeTraits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace MaxGroupsPerFabric + +namespace MaxGroupKeysPerFabric { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + NumericAttributeTraits::StorageType temp; + uint8_t * readable = NumericAttributeTraits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = NumericAttributeTraits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + if (!NumericAttributeTraits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + NumericAttributeTraits::StorageType storageValue; + NumericAttributeTraits::WorkingToStorage(value, storageValue); + uint8_t * writable = NumericAttributeTraits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::GroupKeyManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace MaxGroupKeysPerFabric + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 98542cd1c87708..223c550f3118b2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2193,6 +2193,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace GroupKeyManagement { namespace Attributes { +namespace MaxGroupsPerFabric { +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +} // namespace MaxGroupsPerFabric + +namespace MaxGroupKeysPerFabric { +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +} // namespace MaxGroupKeysPerFabric + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index a49d1d373232ac..e688e121a3e5ca 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -14124,6 +14124,42 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback( bool emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::OperationalCredentials::Commands::RemoveTrustedRootCertificate::DecodableType & commandData); +/** + * @brief Group Key Management Cluster KeySetWrite Command callback (from client) + */ +bool emberAfGroupKeyManagementClusterKeySetWriteCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::DecodableType & commandData); +/** + * @brief Group Key Management Cluster KeySetRead Command callback (from client) + */ +bool emberAfGroupKeyManagementClusterKeySetReadCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::DecodableType & commandData); +/** + * @brief Group Key Management Cluster KeySetReadResponse Command callback (from server) + */ +bool emberAfGroupKeyManagementClusterKeySetReadResponseCallback( + chip::EndpointId endpoint, chip::app::CommandSender * commandObj, + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::DecodableType groupKeySet); +/** + * @brief Group Key Management Cluster KeySetRemove Command callback (from client) + */ +bool emberAfGroupKeyManagementClusterKeySetRemoveCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::DecodableType & commandData); +/** + * @brief Group Key Management Cluster KeySetReadAllIndices Command callback (from client) + */ +bool emberAfGroupKeyManagementClusterKeySetReadAllIndicesCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::DecodableType & commandData); +/** + * @brief Group Key Management Cluster KeySetReadAllIndicesResponse Command callback (from server) + */ +bool emberAfGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback( + chip::EndpointId endpoint, chip::app::CommandSender * commandObj, + /* TYPE WARNING: array array defaults to */ uint8_t * groupKeySetIDs); /** * @brief Mode Select Cluster ChangeToMode Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 8af4792ee8e875..b0b943084126f7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -10160,18 +10160,15 @@ namespace Events { } // namespace OperationalCredentials namespace GroupKeyManagement { namespace Structs { -namespace GroupKey { +namespace GroupInfo { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kVendorId)), vendorId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeyIndex)), groupKeyIndex)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeyRoot)), groupKeyRoot)); - ReturnErrorOnFailure( - DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeyEpochStartTime)), groupKeyEpochStartTime)); - ReturnErrorOnFailure( - DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySecurityPolicy)), groupKeySecurityPolicy)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEndpoints)), endpoints)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupName)), groupName)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10188,20 +10185,61 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kVendorId): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorId)); + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); break; - case to_underlying(Fields::kGroupKeyIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeyIndex)); + case to_underlying(Fields::kGroupId): + ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); break; - case to_underlying(Fields::kGroupKeyRoot): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeyRoot)); + case to_underlying(Fields::kEndpoints): + ReturnErrorOnFailure(DataModel::Decode(reader, endpoints)); break; - case to_underlying(Fields::kGroupKeyEpochStartTime): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeyEpochStartTime)); + case to_underlying(Fields::kGroupName): + ReturnErrorOnFailure(DataModel::Decode(reader, groupName)); break; - case to_underlying(Fields::kGroupKeySecurityPolicy): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySecurityPolicy)); + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} + +} // namespace GroupInfo +namespace GroupKey { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kFabricIndex)), fabricIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupId)), groupId)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; + case to_underlying(Fields::kGroupId): + ReturnErrorOnFailure(DataModel::Decode(reader, groupId)); + break; + case to_underlying(Fields::kGroupKeySetID): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); break; default: break; @@ -10214,14 +10252,20 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace GroupKey -namespace GroupState { +namespace GroupKeySet { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kVendorId)), vendorId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kVendorGroupId)), vendorGroupId)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetIndex)), groupKeySetIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); + ReturnErrorOnFailure( + DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySecurityPolicy)), groupKeySecurityPolicy)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochKey0)), epochKey0)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochStartTime0)), epochStartTime0)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochKey1)), epochKey1)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochStartTime1)), epochStartTime1)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochKey2)), epochKey2)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kEpochStartTime2)), epochStartTime2)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -10238,14 +10282,29 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kVendorId): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorId)); + case to_underlying(Fields::kGroupKeySetID): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); + break; + case to_underlying(Fields::kGroupKeySecurityPolicy): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySecurityPolicy)); + break; + case to_underlying(Fields::kEpochKey0): + ReturnErrorOnFailure(DataModel::Decode(reader, epochKey0)); + break; + case to_underlying(Fields::kEpochStartTime0): + ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime0)); break; - case to_underlying(Fields::kVendorGroupId): - ReturnErrorOnFailure(DataModel::Decode(reader, vendorGroupId)); + case to_underlying(Fields::kEpochKey1): + ReturnErrorOnFailure(DataModel::Decode(reader, epochKey1)); break; - case to_underlying(Fields::kGroupKeySetIndex): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetIndex)); + case to_underlying(Fields::kEpochStartTime1): + ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime1)); + break; + case to_underlying(Fields::kEpochKey2): + ReturnErrorOnFailure(DataModel::Decode(reader, epochKey2)); + break; + case to_underlying(Fields::kEpochStartTime2): + ReturnErrorOnFailure(DataModel::Decode(reader, epochStartTime2)); break; default: break; @@ -10257,10 +10316,214 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) return CHIP_NO_ERROR; } -} // namespace GroupState +} // namespace GroupKeySet } // namespace Structs namespace Commands { +namespace KeySetWrite { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySet)), groupKeySet)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySet): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySet)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetWrite. +namespace KeySetRead { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySetID): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetRead. +namespace KeySetReadResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySet)), groupKeySet)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySet): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySet)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetReadResponse. +namespace KeySetRemove { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetID)), groupKeySetID)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySetID): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetID)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetRemove. +namespace KeySetReadAllIndices { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetIDs)), groupKeySetIDs)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySetIDs): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetIDs)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetReadAllIndices. +namespace KeySetReadAllIndicesResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(to_underlying(Fields::kGroupKeySetIDs)), groupKeySetIDs)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + VerifyOrReturnError(TLV::IsContextTag(reader.GetTag()), CHIP_ERROR_INVALID_TLV_TAG); + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kGroupKeySetIDs): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeySetIDs)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace KeySetReadAllIndicesResponse. } // namespace Commands namespace Attributes { @@ -10268,11 +10531,17 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { switch (path.mAttributeId) { - case Attributes::Groups::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, groups)); + case Attributes::GroupKeyMap::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, groupKeyMap)); + break; + case Attributes::GroupTable::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, groupTable)); + break; + case Attributes::MaxGroupsPerFabric::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, maxGroupsPerFabric)); break; - case Attributes::GroupKeys::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, groupKeys)); + case Attributes::MaxGroupKeysPerFabric::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, maxGroupKeysPerFabric)); break; case Attributes::AttributeList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, attributeList)); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index b8b2a224b1dc3e..8a633782e13dba 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -14861,24 +14861,51 @@ enum class GroupKeySecurityPolicy : uint8_t }; namespace Structs { +namespace GroupInfo { +enum class Fields +{ + kFabricIndex = 1, + kGroupId = 2, + kEndpoints = 3, + kGroupName = 4, +}; + +struct Type +{ +public: + uint16_t fabricIndex; + uint16_t groupId; + DataModel::List endpoints; + chip::CharSpan groupName; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + uint16_t fabricIndex; + uint16_t groupId; + DataModel::DecodableList endpoints; + chip::CharSpan groupName; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; + +} // namespace GroupInfo namespace GroupKey { enum class Fields { - kVendorId = 1, - kGroupKeyIndex = 2, - kGroupKeyRoot = 3, - kGroupKeyEpochStartTime = 4, - kGroupKeySecurityPolicy = 5, + kFabricIndex = 1, + kGroupId = 2, + kGroupKeySetID = 3, }; struct Type { public: - uint16_t vendorId; - uint16_t groupKeyIndex; - chip::ByteSpan groupKeyRoot; - uint64_t groupKeyEpochStartTime; - GroupKeySecurityPolicy groupKeySecurityPolicy; + uint16_t fabricIndex; + uint16_t groupId; + uint16_t groupKeySetID; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -14887,20 +14914,30 @@ struct Type using DecodableType = Type; } // namespace GroupKey -namespace GroupState { +namespace GroupKeySet { enum class Fields { - kVendorId = 1, - kVendorGroupId = 2, - kGroupKeySetIndex = 3, + kGroupKeySetID = 1, + kGroupKeySecurityPolicy = 2, + kEpochKey0 = 3, + kEpochStartTime0 = 4, + kEpochKey1 = 5, + kEpochStartTime1 = 6, + kEpochKey2 = 7, + kEpochStartTime2 = 8, }; struct Type { public: - uint16_t vendorId; - uint16_t vendorGroupId; - uint16_t groupKeySetIndex; + uint16_t groupKeySetID; + GroupKeySecurityPolicy groupKeySecurityPolicy; + chip::ByteSpan epochKey0; + uint64_t epochStartTime0; + chip::ByteSpan epochKey1; + uint64_t epochStartTime1; + chip::ByteSpan epochKey2; + uint64_t epochStartTime2; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -14908,24 +14945,242 @@ struct Type using DecodableType = Type; -} // namespace GroupState +} // namespace GroupKeySet } // namespace Structs -namespace Attributes { +namespace Commands { +// Forward-declarations so we can reference these later. -namespace Groups { -struct TypeInfo +namespace KeySetWrite { +struct Type; +struct DecodableType; +} // namespace KeySetWrite + +namespace KeySetRead { +struct Type; +struct DecodableType; +} // namespace KeySetRead + +namespace KeySetReadResponse { +struct Type; +struct DecodableType; +} // namespace KeySetReadResponse + +namespace KeySetRemove { +struct Type; +struct DecodableType; +} // namespace KeySetRemove + +namespace KeySetReadAllIndices { +struct Type; +struct DecodableType; +} // namespace KeySetReadAllIndices + +namespace KeySetReadAllIndicesResponse { +struct Type; +struct DecodableType; +} // namespace KeySetReadAllIndicesResponse + +} // namespace Commands + +namespace Commands { +namespace KeySetWrite { +enum class Fields +{ + kGroupKeySet = 0, +}; + +struct Type { - using Type = DataModel::List; - using DecodableType = DataModel::DecodableList; - using DecodableArgType = const DataModel::DecodableList &; +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetWrite::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + Structs::GroupKeySet::Type groupKeySet; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetWrite::Id; } static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::Groups::Id; } - static constexpr bool MustUseTimedWrite() { return false; } + + Structs::GroupKeySet::DecodableType groupKeySet; + CHIP_ERROR Decode(TLV::TLVReader & reader); }; -} // namespace Groups -namespace GroupKeys { +}; // namespace KeySetWrite +namespace KeySetRead { +enum class Fields +{ + kGroupKeySetID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetRead::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + uint16_t groupKeySetID; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetRead::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + uint16_t groupKeySetID; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeySetRead +namespace KeySetReadResponse { +enum class Fields +{ + kGroupKeySet = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetReadResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + Structs::GroupKeySet::Type groupKeySet; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetReadResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + Structs::GroupKeySet::DecodableType groupKeySet; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeySetReadResponse +namespace KeySetRemove { +enum class Fields +{ + kGroupKeySetID = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetRemove::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + uint16_t groupKeySetID; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetRemove::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + uint16_t groupKeySetID; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeySetRemove +namespace KeySetReadAllIndices { +enum class Fields +{ + kGroupKeySetIDs = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetReadAllIndices::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + DataModel::List groupKeySetIDs; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetReadAllIndices::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + DataModel::DecodableList groupKeySetIDs; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeySetReadAllIndices +namespace KeySetReadAllIndicesResponse { +enum class Fields +{ + kGroupKeySetIDs = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeySetReadAllIndicesResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + DataModel::List groupKeySetIDs; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::KeySetReadAllIndicesResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + + DataModel::DecodableList groupKeySetIDs; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeySetReadAllIndicesResponse +} // namespace Commands + +namespace Attributes { + +namespace GroupKeyMap { struct TypeInfo { using Type = DataModel::List; @@ -14933,10 +15188,46 @@ struct TypeInfo using DecodableArgType = const DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::GroupKeys::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::GroupKeyMap::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace GroupKeyMap +namespace GroupTable { +struct TypeInfo +{ + using Type = DataModel::List; + using DecodableType = DataModel::DecodableList; + using DecodableArgType = const DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::GroupTable::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace GroupTable +namespace MaxGroupsPerFabric { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::MaxGroupsPerFabric::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace MaxGroupsPerFabric +namespace MaxGroupKeysPerFabric { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::GroupKeyManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::MaxGroupKeysPerFabric::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace GroupKeys +} // namespace MaxGroupKeysPerFabric namespace AttributeList { struct TypeInfo { @@ -14982,8 +15273,10 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); - Attributes::Groups::TypeInfo::DecodableType groups; - Attributes::GroupKeys::TypeInfo::DecodableType groupKeys; + Attributes::GroupKeyMap::TypeInfo::DecodableType groupKeyMap; + Attributes::GroupTable::TypeInfo::DecodableType groupTable; + Attributes::MaxGroupsPerFabric::TypeInfo::DecodableType maxGroupsPerFabric; + Attributes::MaxGroupKeysPerFabric::TypeInfo::DecodableType maxGroupKeysPerFabric; Attributes::AttributeList::TypeInfo::DecodableType attributeList; Attributes::FeatureMap::TypeInfo::DecodableType featureMap; Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision; diff --git a/zzz_generated/app-common/app-common/zap-generated/command-id.h b/zzz_generated/app-common/app-common/zap-generated/command-id.h index 3044b854769259..074943897bfc80 100644 --- a/zzz_generated/app-common/app-common/zap-generated/command-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/command-id.h @@ -229,6 +229,14 @@ #define ZCL_ADD_TRUSTED_ROOT_CERTIFICATE_COMMAND_ID (0x0B) #define ZCL_REMOVE_TRUSTED_ROOT_CERTIFICATE_COMMAND_ID (0x0C) +// Commands for cluster: Group Key Management +#define ZCL_KEY_SET_WRITE_COMMAND_ID (0x00) +#define ZCL_KEY_SET_READ_COMMAND_ID (0x01) +#define ZCL_KEY_SET_READ_RESPONSE_COMMAND_ID (0x02) +#define ZCL_KEY_SET_REMOVE_COMMAND_ID (0x03) +#define ZCL_KEY_SET_READ_ALL_INDICES_COMMAND_ID (0x04) +#define ZCL_KEY_SET_READ_ALL_INDICES_RESPONSE_COMMAND_ID (0x05) + // Commands for cluster: Mode Select #define ZCL_CHANGE_TO_MODE_COMMAND_ID (0x00) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 4794917210dd97..ef9c60d9894137 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -2078,13 +2078,21 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; namespace GroupKeyManagement { namespace Attributes { -namespace Groups { +namespace GroupKeyMap { static constexpr AttributeId Id = 0x00000000; -} // namespace Groups +} // namespace GroupKeyMap -namespace GroupKeys { +namespace GroupTable { static constexpr AttributeId Id = 0x00000001; -} // namespace GroupKeys +} // namespace GroupTable + +namespace MaxGroupsPerFabric { +static constexpr AttributeId Id = 0x00000002; +} // namespace MaxGroupsPerFabric + +namespace MaxGroupKeysPerFabric { +static constexpr AttributeId Id = 0x00000003; +} // namespace MaxGroupKeysPerFabric namespace AttributeList { static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 431fd1d5a31100..9c88c4b9218faf 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -767,6 +767,36 @@ static constexpr CommandId Id = 0x0000000C; } // namespace Commands } // namespace OperationalCredentials +namespace GroupKeyManagement { +namespace Commands { + +namespace KeySetWrite { +static constexpr CommandId Id = 0x00000000; +} // namespace KeySetWrite + +namespace KeySetRead { +static constexpr CommandId Id = 0x00000001; +} // namespace KeySetRead + +namespace KeySetReadResponse { +static constexpr CommandId Id = 0x00000002; +} // namespace KeySetReadResponse + +namespace KeySetRemove { +static constexpr CommandId Id = 0x00000003; +} // namespace KeySetRemove + +namespace KeySetReadAllIndices { +static constexpr CommandId Id = 0x00000004; +} // namespace KeySetReadAllIndices + +namespace KeySetReadAllIndicesResponse { +static constexpr CommandId Id = 0x00000005; +} // namespace KeySetReadAllIndicesResponse + +} // namespace Commands +} // namespace GroupKeyManagement + namespace ModeSelect { namespace Commands { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index c6e534819cce58..4dc68325c23e55 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -86,10 +86,12 @@ CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::OperationalCredentials::Structs::NOCStruct::DecodableType & value); +CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::GroupKeyManagement::Structs::GroupState::DecodableType & value); + const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::FixedLabel::Structs::LabelStruct::DecodableType & value); CHIP_ERROR LogValue(const char * label, size_t indent, @@ -1370,48 +1372,69 @@ CHIP_ERROR LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::DecodableType & value) + const chip::app::Clusters::GroupKeyManagement::Structs::GroupInfo::DecodableType & value) { ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); { - CHIP_ERROR err = LogValue("VendorId", indent + 1, value.vendorId); + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'VendorId'", IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'FabricIndex'", IndentStr(indent + 1).c_str()); return err; } } { - CHIP_ERROR err = LogValue("GroupKeyIndex", indent + 1, value.groupKeyIndex); + CHIP_ERROR err = LogValue("GroupId", indent + 1, value.groupId); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeyIndex'", IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupId'", IndentStr(indent + 1).c_str()); return err; } } { - CHIP_ERROR err = LogValue("GroupKeyRoot", indent + 1, value.groupKeyRoot); + CHIP_ERROR err = LogValue("Endpoints", indent + 1, value.endpoints); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeyRoot'", IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'Endpoints'", IndentStr(indent + 1).c_str()); return err; } } { - CHIP_ERROR err = LogValue("GroupKeyEpochStartTime", indent + 1, value.groupKeyEpochStartTime); + CHIP_ERROR err = LogValue("GroupName", indent + 1, value.groupName); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeyEpochStartTime'", - IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupName'", IndentStr(indent + 1).c_str()); return err; } } + ChipLogProgress(chipTool, "%s}", IndentStr(indent).c_str()); + return CHIP_NO_ERROR; +} +CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::DecodableType & value) +{ + ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); { - CHIP_ERROR err = LogValue("GroupKeySecurityPolicy", indent + 1, value.groupKeySecurityPolicy); + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeySecurityPolicy'", - IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'FabricIndex'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("GroupId", indent + 1, value.groupId); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupId'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("GroupKeySetID", indent + 1, value.groupKeySetID); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeySetID'", IndentStr(indent + 1).c_str()); return err; } } @@ -1419,30 +1442,73 @@ CHIP_ERROR LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::GroupKeyManagement::Structs::GroupState::DecodableType & value) + const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::DecodableType & value) { ChipLogProgress(chipTool, "%s%s: {", IndentStr(indent).c_str(), label); { - CHIP_ERROR err = LogValue("VendorId", indent + 1, value.vendorId); + CHIP_ERROR err = LogValue("GroupKeySetID", indent + 1, value.groupKeySetID); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'VendorId'", IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeySetID'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("GroupKeySecurityPolicy", indent + 1, value.groupKeySecurityPolicy); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeySecurityPolicy'", + IndentStr(indent + 1).c_str()); return err; } } { - CHIP_ERROR err = LogValue("VendorGroupId", indent + 1, value.vendorGroupId); + CHIP_ERROR err = LogValue("EpochKey0", indent + 1, value.epochKey0); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'VendorGroupId'", IndentStr(indent + 1).c_str()); + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochKey0'", IndentStr(indent + 1).c_str()); return err; } } { - CHIP_ERROR err = LogValue("GroupKeySetIndex", indent + 1, value.groupKeySetIndex); + CHIP_ERROR err = LogValue("EpochStartTime0", indent + 1, value.epochStartTime0); if (err != CHIP_NO_ERROR) { - ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'GroupKeySetIndex'", + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochStartTime0'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("EpochKey1", indent + 1, value.epochKey1); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochKey1'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("EpochStartTime1", indent + 1, value.epochStartTime1); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochStartTime1'", + IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("EpochKey2", indent + 1, value.epochKey2); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochKey2'", IndentStr(indent + 1).c_str()); + return err; + } + } + { + CHIP_ERROR err = LogValue("EpochStartTime2", indent + 1, value.epochStartTime2); + if (err != CHIP_NO_ERROR) + { + ChipLogProgress(chipTool, "%sStruct truncated due to invalid value for 'EpochStartTime2'", IndentStr(indent + 1).c_str()); return err; } @@ -2678,6 +2744,34 @@ static void OnGeneralCommissioningSetRegulatoryConfigResponseSuccess( command->SetCommandExitStatus(err); }; +static void OnGroupKeyManagementKeySetReadAllIndicesResponseSuccess( + void * context, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::DecodableType & data) +{ + ChipLogProgress(Zcl, "Received KeySetReadAllIndicesResponse:"); + CHIP_ERROR err = CHIP_NO_ERROR; + if (err == CHIP_NO_ERROR) + { + err = LogValue("groupKeySetIDs", 1, data.groupKeySetIDs); + } + + ModelCommand * command = static_cast(context); + command->SetCommandExitStatus(err); +}; + +static void OnGroupKeyManagementKeySetReadResponseSuccess( + void * context, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType & data) +{ + ChipLogProgress(Zcl, "Received KeySetReadResponse:"); + CHIP_ERROR err = CHIP_NO_ERROR; + if (err == CHIP_NO_ERROR) + { + err = LogValue("groupKeySet", 1, data.groupKeySet); + } + + ModelCommand * command = static_cast(context); + command->SetCommandExitStatus(err); +}; + static void OnGroupsAddGroupResponseSuccess(void * context, const chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType & data) { @@ -19108,27 +19202,129 @@ class ReportGeneralDiagnosticsClusterRevision : public ModelCommand | Cluster GroupKeyManagement | 0x003F | |------------------------------------------------------------------------------| | Commands: | | +| * KeySetRead | 0x01 | +| * KeySetReadAllIndices | 0x04 | +| * KeySetRemove | 0x03 | +| * KeySetWrite | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Groups | 0x0000 | -| * GroupKeys | 0x0001 | +| * GroupKeyMap | 0x0000 | +| * GroupTable | 0x0001 | +| * MaxGroupsPerFabric | 0x0002 | +| * MaxGroupKeysPerFabric | 0x0003 | | * AttributeList | 0xFFFB | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ /* - * Attribute Groups + * Command KeySetRead + */ +class GroupKeyManagementKeySetRead : public ModelCommand +{ +public: + GroupKeyManagementKeySetRead() : ModelCommand("key-set-read") + { + AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000001) on endpoint %" PRIu8, endpointId); + + return chip::Controller::InvokeCommand(device, this, OnGroupKeyManagementKeySetReadResponseSuccess, OnDefaultFailure, + endpointId, mRequest, mTimedInteractionTimeoutMs); + } + +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type mRequest; +}; + +/* + * Command KeySetReadAllIndices */ -class ReadGroupKeyManagementGroups : public ModelCommand +class GroupKeyManagementKeySetReadAllIndices : public ModelCommand { public: - ReadGroupKeyManagementGroups() : ModelCommand("read") + GroupKeyManagementKeySetReadAllIndices() : ModelCommand("key-set-read-all-indices") { - AddArgument("attr-name", "groups"); + // groupKeySetIDs Array parsing is not supported yet ModelCommand::AddArguments(); } - ~ReadGroupKeyManagementGroups() {} + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000004) on endpoint %" PRIu8, endpointId); + + return chip::Controller::InvokeCommand(device, this, OnGroupKeyManagementKeySetReadAllIndicesResponseSuccess, + OnDefaultFailure, endpointId, mRequest, mTimedInteractionTimeoutMs); + } + +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Type mRequest; +}; + +/* + * Command KeySetRemove + */ +class GroupKeyManagementKeySetRemove : public ModelCommand +{ +public: + GroupKeyManagementKeySetRemove() : ModelCommand("key-set-remove") + { + AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000003) on endpoint %" PRIu8, endpointId); + + return chip::Controller::InvokeCommand(device, this, OnDefaultSuccess, OnDefaultFailure, endpointId, mRequest, + mTimedInteractionTimeoutMs); + } + +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type mRequest; +}; + +/* + * Command KeySetWrite + */ +class GroupKeyManagementKeySetWrite : public ModelCommand +{ +public: + GroupKeyManagementKeySetWrite() : ModelCommand("key-set-write") + { + // groupKeySet Struct parsing is not supported yet + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000003F) command (0x00000000) on endpoint %" PRIu8, endpointId); + + return chip::Controller::InvokeCommand(device, this, OnDefaultSuccess, OnDefaultFailure, endpointId, mRequest, + mTimedInteractionTimeoutMs); + } + +private: + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type mRequest; +}; + +/* + * Attribute GroupKeyMap + */ +class ReadGroupKeyManagementGroupKeyMap : public ModelCommand +{ +public: + ReadGroupKeyManagementGroupKeyMap() : ModelCommand("read") + { + AddArgument("attr-name", "group-key-map"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementGroupKeyMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19136,32 +19332,32 @@ class ReadGroupKeyManagementGroups : public ModelCommand chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttribute( + return cluster.ReadAttribute( this, OnAttributeResponse, OnDefaultFailure); } static void OnAttributeResponse( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value) { - OnGeneralAttributeResponse(context, "GroupKeyManagement.Groups response", value); + OnGeneralAttributeResponse(context, "GroupKeyManagement.GroupKeyMap response", value); } }; -class ReportGroupKeyManagementGroups : public ModelCommand +class ReportGroupKeyManagementGroupKeyMap : public ModelCommand { public: - ReportGroupKeyManagementGroups() : ModelCommand("report") + ReportGroupKeyManagementGroupKeyMap() : ModelCommand("report") { - AddArgument("attr-name", "groups"); + AddArgument("attr-name", "group-key-map"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~ReportGroupKeyManagementGroups() {} + ~ReportGroupKeyManagementGroupKeyMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19171,7 +19367,7 @@ class ReportGroupKeyManagementGroups : public ModelCommand cluster.Associate(device, endpointId); auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; - return cluster.SubscribeAttribute( + return cluster.SubscribeAttribute( this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } @@ -19182,10 +19378,10 @@ class ReportGroupKeyManagementGroups : public ModelCommand static void OnValueReport( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value) { - LogValue("GroupKeyManagement.Groups report", 0, value); + LogValue("GroupKeyManagement.GroupKeyMap report", 0, value); } private: @@ -19195,18 +19391,18 @@ class ReportGroupKeyManagementGroups : public ModelCommand }; /* - * Attribute GroupKeys + * Attribute GroupTable */ -class ReadGroupKeyManagementGroupKeys : public ModelCommand +class ReadGroupKeyManagementGroupTable : public ModelCommand { public: - ReadGroupKeyManagementGroupKeys() : ModelCommand("read") + ReadGroupKeyManagementGroupTable() : ModelCommand("read") { - AddArgument("attr-name", "group-keys"); + AddArgument("attr-name", "group-table"); ModelCommand::AddArguments(); } - ~ReadGroupKeyManagementGroupKeys() {} + ~ReadGroupKeyManagementGroupTable() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19214,32 +19410,32 @@ class ReadGroupKeyManagementGroupKeys : public ModelCommand chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - return cluster.ReadAttribute( + return cluster.ReadAttribute( this, OnAttributeResponse, OnDefaultFailure); } static void OnAttributeResponse( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value) { - OnGeneralAttributeResponse(context, "GroupKeyManagement.GroupKeys response", value); + OnGeneralAttributeResponse(context, "GroupKeyManagement.GroupTable response", value); } }; -class ReportGroupKeyManagementGroupKeys : public ModelCommand +class ReportGroupKeyManagementGroupTable : public ModelCommand { public: - ReportGroupKeyManagementGroupKeys() : ModelCommand("report") + ReportGroupKeyManagementGroupTable() : ModelCommand("report") { - AddArgument("attr-name", "group-keys"); + AddArgument("attr-name", "group-table"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~ReportGroupKeyManagementGroupKeys() {} + ~ReportGroupKeyManagementGroupTable() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19249,7 +19445,7 @@ class ReportGroupKeyManagementGroupKeys : public ModelCommand cluster.Associate(device, endpointId); auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; - return cluster.SubscribeAttribute( + return cluster.SubscribeAttribute( this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } @@ -19260,10 +19456,10 @@ class ReportGroupKeyManagementGroupKeys : public ModelCommand static void OnValueReport( void * context, - const chip::app::DataModel::DecodableList & + const chip::app::DataModel::DecodableList & value) { - LogValue("GroupKeyManagement.GroupKeys report", 0, value); + LogValue("GroupKeyManagement.GroupTable report", 0, value); } private: @@ -19272,6 +19468,66 @@ class ReportGroupKeyManagementGroupKeys : public ModelCommand bool mWait; }; +/* + * Attribute MaxGroupsPerFabric + */ +class ReadGroupKeyManagementMaxGroupsPerFabric : public ModelCommand +{ +public: + ReadGroupKeyManagementMaxGroupsPerFabric() : ModelCommand("read") + { + AddArgument("attr-name", "max-groups-per-fabric"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementMaxGroupsPerFabric() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003F) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute( + this, OnAttributeResponse, OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, uint16_t value) + { + OnGeneralAttributeResponse(context, "GroupKeyManagement.MaxGroupsPerFabric response", value); + } +}; + +/* + * Attribute MaxGroupKeysPerFabric + */ +class ReadGroupKeyManagementMaxGroupKeysPerFabric : public ModelCommand +{ +public: + ReadGroupKeyManagementMaxGroupKeysPerFabric() : ModelCommand("read") + { + AddArgument("attr-name", "max-group-keys-per-fabric"); + ModelCommand::AddArguments(); + } + + ~ReadGroupKeyManagementMaxGroupKeysPerFabric() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003F) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute( + this, OnAttributeResponse, OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, uint16_t value) + { + OnGeneralAttributeResponse(context, "GroupKeyManagement.MaxGroupKeysPerFabric response", value); + } +}; + /* * Attribute AttributeList */ @@ -51437,11 +51693,17 @@ void registerClusterGroupKeyManagement(Commands & commands) const char * clusterName = "GroupKeyManagement"; commands_list clusterCommands = { - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // }; commands.Register(clusterName, clusterCommands); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index 2df9174f0d2cd2..1e7dd572741959 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -1003,10 +1003,10 @@ void GeneralDiagnosticsClusterAttributeListListAttributeFilter(TLV::TLVReader * cb->mCall(cb->mContext, list); } -void GroupKeyManagementClusterGroupsListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) +void GroupKeyManagementClusterGroupKeyMapListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) { - chip::app::DataModel::DecodableList list; + chip::app::DataModel::DecodableList list; CHIP_ERROR err = Decode(*tlvData, list); if (err != CHIP_NO_ERROR) { @@ -1019,15 +1019,15 @@ void GroupKeyManagementClusterGroupsListAttributeFilter(TLV::TLVReader * tlvData return; } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); cb->mCall(cb->mContext, list); } -void GroupKeyManagementClusterGroupKeysListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback) +void GroupKeyManagementClusterGroupTableListAttributeFilter(TLV::TLVReader * tlvData, Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) { - chip::app::DataModel::DecodableList list; + chip::app::DataModel::DecodableList list; CHIP_ERROR err = Decode(*tlvData, list); if (err != CHIP_NO_ERROR) { @@ -1040,8 +1040,8 @@ void GroupKeyManagementClusterGroupKeysListAttributeFilter(TLV::TLVReader * tlvD return; } - Callback::Callback * cb = - Callback::Callback::FromCancelable(onSuccessCallback); + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); cb->mCall(cb->mContext, list); } @@ -2437,6 +2437,35 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(Endpo return true; } +bool emberAfGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback( + EndpointId endpoint, app::CommandSender * commandObj, /* TYPE WARNING: array array defaults to */ uint8_t * groupKeySetIDs) +{ + ChipLogProgress(Zcl, "KeySetReadAllIndicesResponse:"); + ChipLogProgress(Zcl, " groupKeySetIDs: %p", groupKeySetIDs); + + GET_CLUSTER_RESPONSE_CALLBACKS("GroupKeyManagementClusterKeySetReadAllIndicesResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, groupKeySetIDs); + return true; +} + +bool emberAfGroupKeyManagementClusterKeySetReadResponseCallback( + EndpointId endpoint, app::CommandSender * commandObj, + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::DecodableType groupKeySet) +{ + ChipLogProgress(Zcl, "KeySetReadResponse:"); + ChipLogProgress(Zcl, " groupKeySet: Not sure how to log struct GroupKeySet"); + + GET_CLUSTER_RESPONSE_CALLBACKS("GroupKeyManagementClusterKeySetReadResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, GroupKeySet()); + return true; +} + bool emberAfGroupsClusterAddGroupResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, uint16_t groupId) { diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 63c28f75060381..826aa1cc69e55b 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -59,6 +59,9 @@ typedef void (*GeneralCommissioningClusterCommissioningCompleteResponseCallback) chip::CharSpan debugText); typedef void (*GeneralCommissioningClusterSetRegulatoryConfigResponseCallback)(void * context, uint8_t errorCode, chip::CharSpan debugText); +typedef void (*GroupKeyManagementClusterKeySetReadAllIndicesResponseCallback)( + void * context, /* TYPE WARNING: array array defaults to */ uint8_t * groupKeySetIDs); +typedef void (*GroupKeyManagementClusterKeySetReadResponseCallback)(void * context, GroupKeySet groupKeySet); typedef void (*GroupsClusterAddGroupResponseCallback)(void * context, uint8_t status, uint16_t groupId); typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context, uint8_t capacity, /* TYPE WARNING: array array defaults to */ uint8_t * groupList); @@ -330,17 +333,18 @@ void GeneralDiagnosticsClusterAttributeListListAttributeFilter(chip::TLV::TLVRea chip::Callback::Cancelable * onFailureCallback); typedef void (*GeneralDiagnosticsAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); -void GroupKeyManagementClusterGroupsListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, - chip::Callback::Cancelable * onFailureCallback); -typedef void (*GroupKeyManagementGroupsListAttributeCallback)( - void * context, - const chip::app::DataModel::DecodableList & data); -void GroupKeyManagementClusterGroupKeysListAttributeFilter(chip::TLV::TLVReader * data, - chip::Callback::Cancelable * onSuccessCallback, - chip::Callback::Cancelable * onFailureCallback); -typedef void (*GroupKeyManagementGroupKeysListAttributeCallback)( +void GroupKeyManagementClusterGroupKeyMapListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*GroupKeyManagementGroupKeyMapListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +void GroupKeyManagementClusterGroupTableListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*GroupKeyManagementGroupTableListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & data); void GroupKeyManagementClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index 9fb89cf91df139..78c34328bac346 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -5496,6 +5496,188 @@ CHIP_ERROR GeneralDiagnosticsCluster::ReportAttributeClusterRevision(Callback::C } // GroupKeyManagement Cluster Commands +CHIP_ERROR GroupKeyManagementCluster::KeySetRead(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t groupKeySetID) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, GroupKeyManagement::Commands::KeySetRead::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // groupKeySetID: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupKeySetID)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get())); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR GroupKeyManagementCluster::KeySetReadAllIndices(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t groupKeySetIDs) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, + GroupKeyManagement::Commands::KeySetReadAllIndices::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // groupKeySetIDs: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupKeySetIDs)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get())); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR GroupKeyManagementCluster::KeySetRemove(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t groupKeySetID) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, GroupKeyManagement::Commands::KeySetRemove::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // groupKeySetID: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupKeySetID)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get())); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR GroupKeyManagementCluster::KeySetWrite(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t groupKeySetID, + uint8_t groupKeySecurityPolicy, chip::ByteSpan epochKey0, + uint64_t epochStartTime0, chip::ByteSpan epochKey1, uint64_t epochStartTime1, + chip::ByteSpan epochKey2, uint64_t epochStartTime2) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, GroupKeyManagement::Commands::KeySetWrite::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // groupKeySetID: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupKeySetID)); + // groupKeySecurityPolicy: groupKeySecurityPolicy + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), groupKeySecurityPolicy)); + // epochKey0: octetString + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochKey0)); + // epochStartTime0: int64u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochStartTime0)); + // epochKey1: octetString + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochKey1)); + // epochStartTime1: int64u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochStartTime1)); + // epochKey2: octetString + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochKey2)); + // epochStartTime2: int64u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), epochStartTime2)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get())); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + // GroupKeyManagement Cluster Attributes CHIP_ERROR GroupKeyManagementCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index a0a56519efc3b0..f47102cc8ea421 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -928,10 +928,24 @@ class DLL_EXPORT GroupKeyManagementCluster : public ClusterBase GroupKeyManagementCluster() : ClusterBase(app::Clusters::GroupKeyManagement::Id) {} ~GroupKeyManagementCluster() {} + // Cluster Commands + CHIP_ERROR KeySetRead(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t groupKeySetID); + CHIP_ERROR KeySetReadAllIndices(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t groupKeySetIDs); + CHIP_ERROR KeySetRemove(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t groupKeySetID); + CHIP_ERROR KeySetWrite(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t groupKeySetID, uint8_t groupKeySecurityPolicy, chip::ByteSpan epochKey0, + uint64_t epochStartTime0, chip::ByteSpan epochKey1, uint64_t epochStartTime1, chip::ByteSpan epochKey2, + uint64_t epochStartTime2); + // Cluster Attributes CHIP_ERROR SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); CHIP_ERROR ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback); + +private: }; class DLL_EXPORT GroupsCluster : public ClusterBase diff --git a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp index 728e686b0b7924..72159b1a5f0f48 100644 --- a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp @@ -1134,6 +1134,164 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa } // namespace GeneralCommissioning +namespace GroupKeyManagement { + +void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + // 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. + // The following variables are used for all commands to save code size. + CHIP_ERROR TLVError = CHIP_NO_ERROR; + CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR; + uint32_t validArgumentCount = 0; + uint32_t expectArgumentCount = 0; + uint32_t currentDecodeTagId = 0; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::KeySetReadAllIndicesResponse::Id: { + expectArgumentCount = 1; + /* TYPE WARNING: array array defaults to */ uint8_t * groupKeySetIDs; + bool argExists[1]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 1) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + // Just for compatibility, we will add array type support in IM later. + TLVUnpackError = aDataTlv.GetDataPtr(const_cast(groupKeySetIDs)); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != 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; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + wasHandled = emberAfGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(aCommandPath.mEndpointId, + apCommandObj, groupKeySetIDs); + } + break; + } + case Commands::KeySetReadResponse::Id: { + expectArgumentCount = 1; + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySet::DecodableType groupKeySet; + bool argExists[1]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 1) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + // Not supported, just error out. + TLVUnpackError = CHIP_ERROR_UNEXPECTED_TLV_ELEMENT; + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != 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; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount) + { + wasHandled = + emberAfGroupKeyManagementClusterKeySetReadResponseCallback(aCommandPath.mEndpointId, apCommandObj, groupKeySet); + } + break; + } + default: { + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) + { + ChipLogProgress(Zcl, + "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT + ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, + validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); + // A command with no arguments would never write currentDecodeTagId. If + // progress logging is also disabled, it would look unused. Silence that + // warning. + UNUSED_VAR(currentDecodeTagId); + } +} + +} // namespace GroupKeyManagement + namespace Groups { void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -4389,6 +4547,9 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchClientCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::GroupKeyManagement::Id: + Clusters::GroupKeyManagement::DispatchClientCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::Groups::Id: Clusters::Groups::DispatchClientCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/thermostat/zap-generated/endpoint_config.h b/zzz_generated/thermostat/zap-generated/endpoint_config.h index 31e99d2499ab4a..2db73403e87dd8 100644 --- a/zzz_generated/thermostat/zap-generated/endpoint_config.h +++ b/zzz_generated/thermostat/zap-generated/endpoint_config.h @@ -277,7 +277,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), big-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -293,7 +293,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -574,7 +574,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), little-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -590,7 +590,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -869,9 +869,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(632) }, /* groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* group keys */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(632) }, /* groupKeyMap */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* groupTable */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ diff --git a/zzz_generated/tv-app/zap-generated/endpoint_config.h b/zzz_generated/tv-app/zap-generated/endpoint_config.h index 69ffa9c6bb798d..72f228fd334336 100644 --- a/zzz_generated/tv-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-app/zap-generated/endpoint_config.h @@ -279,7 +279,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), big-endian */ \ \ - /* 619 - groups, */ \ + /* 619 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -295,7 +295,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, \ \ - /* 873 - group keys, */ \ + /* 873 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -738,7 +738,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), little-endian */ \ \ - /* 619 - groups, */ \ + /* 619 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -754,7 +754,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, \ \ - /* 873 - group keys, */ \ + /* 873 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1184,9 +1184,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(619) }, /* groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(873) }, /* group keys */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(619) }, /* groupKeyMap */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(873) }, /* groupTable */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 7b99fc7b819629..ce0179f835678a 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -277,7 +277,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), big-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -293,7 +293,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -776,7 +776,7 @@ \ /* Endpoint: 0, Cluster: Group Key Management (server), little-endian */ \ \ - /* 632 - groups, */ \ + /* 632 - groupKeyMap, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -792,7 +792,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, \ \ - /* 886 - group keys, */ \ + /* 886 - groupTable, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -1286,9 +1286,9 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Group Key Management (server) */ \ - { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(632) }, /* groups */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* group keys */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ + { 0x0000, ZAP_TYPE(ARRAY), 254, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(632) }, /* groupKeyMap */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(886) }, /* groupTable */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \