diff --git a/examples/lighting-app/esp32/main/CMakeLists.txt b/examples/lighting-app/esp32/main/CMakeLists.txt index f928ea2d243aed..b2a748452b8208 100644 --- a/examples/lighting-app/esp32/main/CMakeLists.txt +++ b/examples/lighting-app/esp32/main/CMakeLists.txt @@ -60,6 +60,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/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" PRIV_REQUIRES chip QRCode bt led_strip app_update) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 04e15ca871582c..fb17d80f2fa389 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -619,6 +619,72 @@ server cluster GeneralDiagnostics = 51 { readonly global attribute int16u clusterRevision = 65533; } +server cluster GroupKeyManagement = 63 { + enum GroupKeySecurityPolicy : ENUM8 { + kStandard = 0; + kLowLatency = 1; + } + + struct GroupKeyMapStruct { + fabric_idx fabricIndex = 0; + group_id groupId = 1; + INT16U groupKeySetID = 2; + } + + struct GroupInfoMapStruct { + fabric_idx fabricIndex = 0; + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional CHAR_STRING<16> groupName = 3; + } + + struct GroupKeySetStruct { + INT16U groupKeySetID = 0; + GroupKeySecurityPolicy groupKeySecurityPolicy = 1; + nullable OCTET_STRING<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable OCTET_STRING<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable OCTET_STRING<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly global attribute int16u clusterRevision = 65533; + + request struct KeySetReadRequest { + INT16U groupKeySetID = 0; + } + + request struct KeySetReadAllIndicesRequest { + INT16U groupKeySetIDs[] = 0; + } + + request struct KeySetRemoveRequest { + INT16U groupKeySetID = 0; + } + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + response struct KeySetReadAllIndicesResponse { + INT16U groupKeySetIDs[] = 0; + } + + response struct KeySetReadResponse { + GroupKeySetStruct groupKeySet = 0; + } + + command KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + command KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4; + command KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + command KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; +} + server cluster Groups = 4 { readonly attribute bitmap8 nameSupport = 0; readonly global attribute int16u clusterRevision = 65533; @@ -1602,6 +1668,7 @@ endpoint 0 { server cluster FixedLabel; server cluster GeneralCommissioning; server cluster GeneralDiagnostics; + server cluster GroupKeyManagement; server cluster Groups; server cluster LocalizationConfiguration; server cluster NetworkCommissioning; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 3b6dcbbc730c55..865942c263fcca 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -4509,6 +4509,152 @@ } ] }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 0, + "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": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "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": "groupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "groupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "maxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "maxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Fixed Label", "code": 64, diff --git a/src/app/tests/suites/TestGroupDemoCommand.yaml b/src/app/tests/suites/TestGroupDemoCommand.yaml index 1c99e54cca5ce6..de7b77339da9de 100644 --- a/src/app/tests/suites/TestGroupDemoCommand.yaml +++ b/src/app/tests/suites/TestGroupDemoCommand.yaml @@ -39,7 +39,7 @@ tests: - label: "Turn On the light to see attribute change" cluster: "On/Off" command: "On" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -52,7 +52,7 @@ tests: - label: "Turn Off the light to see attribute change" cluster: "On/Off" command: "Off" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -66,7 +66,7 @@ tests: - label: "Turn On the light to see attribute change" cluster: "On/Off" command: "On" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -79,7 +79,7 @@ tests: - label: "Turn Off the light to see attribute change" cluster: "On/Off" command: "Off" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -93,7 +93,7 @@ tests: - label: "Turn On the light to see attribute change" cluster: "On/Off" command: "On" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -106,7 +106,7 @@ tests: - label: "Turn Off the light to see attribute change" cluster: "On/Off" command: "Off" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -120,7 +120,7 @@ tests: - label: "Turn On the light to see attribute change" cluster: "On/Off" command: "On" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -133,7 +133,7 @@ tests: - label: "Turn Off the light to see attribute change" cluster: "On/Off" command: "Off" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -147,7 +147,7 @@ tests: - label: "Turn On the light to see attribute change" cluster: "On/Off" command: "On" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" @@ -160,7 +160,7 @@ tests: - label: "Turn Off the light to see attribute change" cluster: "On/Off" command: "Off" - groupId: "4660" + groupId: 0x0101 - label: "Wait 100ms" cluster: "DelayCommands" diff --git a/src/app/tests/suites/TestGroupDemoConfig.yaml b/src/app/tests/suites/TestGroupDemoConfig.yaml index 0a8bd6dd542cc7..58e6fd0cd29f34 100644 --- a/src/app/tests/suites/TestGroupDemoConfig.yaml +++ b/src/app/tests/suites/TestGroupDemoConfig.yaml @@ -40,7 +40,7 @@ tests: arguments: values: - name: "groupId" - value: 0x1234 + value: 0x0101 - name: "groupName" value: "Group #1" response: @@ -48,4 +48,29 @@ tests: - name: "status" value: 0 - name: "groupId" - value: 0x1234 + value: 0x0101 + + - label: "KeySet Write 1" + cluster: "Group Key Management" + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: "Map Group Key Set to group ID on a given fabric" + cluster: "Group Key Management" + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: [{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 }] diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 9fb6d9fc63696e..b92b3fa4105471 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -90392,7 +90392,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_1() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; RequestType request; @@ -90430,7 +90430,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_3() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; RequestType request; @@ -90468,7 +90468,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_5() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; RequestType request; @@ -90506,7 +90506,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_7() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; RequestType request; @@ -90544,7 +90544,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_9() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; RequestType request; @@ -90582,7 +90582,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_11() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; RequestType request; @@ -90620,7 +90620,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_13() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; RequestType request; @@ -90658,7 +90658,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_15() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; RequestType request; @@ -90696,7 +90696,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_17() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; RequestType request; @@ -90734,7 +90734,7 @@ class TestGroupDemoCommand : public TestCommand CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_19() { - const chip::GroupId groupId = 4660; + const chip::GroupId groupId = 257; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; RequestType request; @@ -90816,6 +90816,14 @@ class TestGroupDemoConfig : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 1 : Add Group 1 - endpoint 1\n"); err = TestAddGroup1Endpoint1_1(); break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : KeySet Write 1\n"); + err = TestKeySetWrite1_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Map Group Key Set to group ID on a given fabric\n"); + err = TestMapGroupKeySetToGroupIdOnAGivenFabric_3(); + break; } if (CHIP_NO_ERROR != err) @@ -90827,7 +90835,7 @@ class TestGroupDemoConfig : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 4; chip::Optional mCluster; chip::Optional mEndpoint; @@ -90840,6 +90848,13 @@ class TestGroupDemoConfig : public TestCommand NextTest(); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + // // Tests methods // @@ -90856,7 +90871,7 @@ class TestGroupDemoConfig : public TestCommand using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; RequestType request; - request.groupId = 4660U; + request.groupId = 257U; request.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); auto success = [](void * context, const typename RequestType::ResponseType & data) { @@ -90881,10 +90896,92 @@ class TestGroupDemoConfig : public TestCommand { VerifyOrReturn(CheckValue("status", status, 0)); - VerifyOrReturn(CheckValue("groupId", groupId, 4660U)); + VerifyOrReturn(CheckValue("groupId", groupId, 257U)); NextTest(); } + + CHIP_ERROR TestKeySetWrite1_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; + + RequestType request; + + request.groupKeySet.groupKeySetID = 417U; + request.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + request.groupKeySet.epochKey0.SetNonNull(); + request.groupKeySet.epochKey0.Value() = + chip::ByteSpan(chip::Uint8::from_const_char( + "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xafgarbage: not in length on purpose"), + 16); + request.groupKeySet.epochStartTime0.SetNonNull(); + request.groupKeySet.epochStartTime0.Value() = 1110000ULL; + request.groupKeySet.epochKey1.SetNonNull(); + request.groupKeySet.epochKey1.Value() = + chip::ByteSpan(chip::Uint8::from_const_char( + "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbfgarbage: not in length on purpose"), + 16); + request.groupKeySet.epochStartTime1.SetNonNull(); + request.groupKeySet.epochStartTime1.Value() = 1110001ULL; + request.groupKeySet.epochKey2.SetNonNull(); + request.groupKeySet.epochKey2.Value() = + chip::ByteSpan(chip::Uint8::from_const_char( + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcfgarbage: not in length on purpose"), + 16); + request.groupKeySet.epochStartTime2.SetNonNull(); + request.groupKeySet.epochStartTime2.Value() = 1110002ULL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestMapGroupKeySetToGroupIdOnAGivenFabric_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GroupKeyManagementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::List + groupKeyMapArgument; + + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::Type groupKeyMapList_0[1]; + + groupKeyMapList_0[0].fabricIndex = 1; + groupKeyMapList_0[0].groupId = 257U; + groupKeyMapList_0[0].groupKeySetID = 417U; + + groupKeyMapArgument = groupKeyMapList_0; + + ReturnErrorOnFailure(cluster.WriteAttribute( + groupKeyMapArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } }; void registerCommandsTests(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) diff --git a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 9947c5a3125ba6..0098a676aff474 100644 --- a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -429,6 +429,70 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace GeneralCommissioning +namespace GroupKeyManagement { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + 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) @@ -1117,6 +1181,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/lighting-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h index 20381f380fb0b9..000667dd1523b2 100644 --- a/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/lighting-app/zap-generated/PluginApplicationCallbacks.h @@ -32,6 +32,7 @@ MatterFixedLabelPluginServerInitCallback(); \ MatterGeneralCommissioningPluginServerInitCallback(); \ MatterGeneralDiagnosticsPluginServerInitCallback(); \ + MatterGroupKeyManagementPluginServerInitCallback(); \ MatterGroupsPluginServerInitCallback(); \ MatterIdentifyPluginServerInitCallback(); \ MatterLevelControlPluginServerInitCallback(); \ diff --git a/zzz_generated/lighting-app/zap-generated/callback-stub.cpp b/zzz_generated/lighting-app/zap-generated/callback-stub.cpp index bdca6a8c396ba5..2666f6d8561283 100644 --- a/zzz_generated/lighting-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/lighting-app/zap-generated/callback-stub.cpp @@ -59,6 +59,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_GENERAL_DIAGNOSTICS_CLUSTER_ID: emberAfGeneralDiagnosticsClusterInitCallback(endpoint); break; + case ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID: + emberAfGroupKeyManagementClusterInitCallback(endpoint); + break; case ZCL_GROUPS_CLUSTER_ID: emberAfGroupsClusterInitCallback(endpoint); break; @@ -166,6 +169,11 @@ void __attribute__((weak)) emberAfGeneralDiagnosticsClusterInitCallback(Endpoint // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfGroupKeyManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/zzz_generated/lighting-app/zap-generated/endpoint_config.h index 6575b5e38c7ba6..84a8f0576e059d 100644 --- a/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -560,7 +560,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 242 +#define GENERATED_ATTRIBUTE_COUNT 247 #define GENERATED_ATTRIBUTES \ { \ \ @@ -808,6 +808,16 @@ ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Group Key Management (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* GroupKeyMap */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* GroupTable */ \ + { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupsPerFabric */ \ + { 0x00000003, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* MaxGroupKeysPerFabric */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* label list */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ @@ -1035,6 +1045,17 @@ 0x00000005 /* CSRResponse */, \ 0x00000008 /* NOCResponse */, \ chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Group Key Management (server) */\ + /* client_generated */ \ + 0x00000000 /* KeySetWrite */, \ + 0x00000001 /* KeySetRead */, \ + 0x00000003 /* KeySetRemove */, \ + 0x00000004 /* KeySetReadAllIndices */, \ + chip::kInvalidCommandId /* end of list */, \ + /* server_generated */ \ + 0x00000002 /* KeySetReadResponse */, \ + 0x00000005 /* KeySetReadAllIndicesResponse */, \ + chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Identify (server) */\ /* client_generated */ \ 0x00000000 /* Identify */, \ @@ -1106,7 +1127,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 30 +#define GENERATED_CLUSTER_COUNT 31 // clang-format off #define GENERATED_CLUSTERS { \ @@ -1319,10 +1340,21 @@ .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 45 ) ,\ .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 55 ) ,\ },\ + { \ + /* Endpoint: 0, Cluster: Group Key Management (server) */ \ + .clusterId = 0x0000003F, \ + .attributes = ZAP_ATTRIBUTE_INDEX(176), \ + .attributeCount = 5, \ + .clusterSize = 2, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ + },\ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(176), \ + .attributes = ZAP_ATTRIBUTE_INDEX(181), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1333,7 +1365,7 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(178), \ + .attributes = ZAP_ATTRIBUTE_INDEX(183), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1344,51 +1376,51 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(180), \ + .attributes = ZAP_ATTRIBUTE_INDEX(185), \ .attributeCount = 3, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 64 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 68 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(183), \ + .attributes = ZAP_ATTRIBUTE_INDEX(188), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 66 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 73 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 74 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 81 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(185), \ + .attributes = ZAP_ATTRIBUTE_INDEX(190), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 78 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 86 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(192), \ + .attributes = ZAP_ATTRIBUTE_INDEX(197), \ .attributeCount = 16, \ .clusterSize = 27, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 85 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 93 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(208), \ + .attributes = ZAP_ATTRIBUTE_INDEX(213), \ .attributeCount = 5, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1399,18 +1431,18 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(213), \ + .attributes = ZAP_ATTRIBUTE_INDEX(218), \ .attributeCount = 22, \ .clusterSize = 36, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 94 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 102 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(235), \ + .attributes = ZAP_ATTRIBUTE_INDEX(240), \ .attributeCount = 4, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -1421,7 +1453,7 @@ { \ /* Endpoint: 2, Cluster: On/Off (client) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(239), \ + .attributes = ZAP_ATTRIBUTE_INDEX(244), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -1432,7 +1464,7 @@ { \ /* Endpoint: 2, Cluster: On/off Switch Configuration (server) */ \ .clusterId = 0x00000007, \ - .attributes = ZAP_ATTRIBUTE_INDEX(239), \ + .attributes = ZAP_ATTRIBUTE_INDEX(244), \ .attributeCount = 3, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1446,12 +1478,12 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 28 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 29 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 586 }, { ZAP_CLUSTER_INDEX(21), 7, 89 }, { ZAP_CLUSTER_INDEX(28), 2, 4 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 588 }, { ZAP_CLUSTER_INDEX(22), 7, 89 }, { ZAP_CLUSTER_INDEX(29), 2, 4 }, \ } // Largest attribute size is needed for various buffers @@ -1463,7 +1495,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (39) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (679) +#define ATTRIBUTE_MAX_SIZE (681) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/lighting-app/zap-generated/gen_config.h b/zzz_generated/lighting-app/zap-generated/gen_config.h index f4f4a4a8283e69..1a13c2061c1f21 100644 --- a/zzz_generated/lighting-app/zap-generated/gen_config.h +++ b/zzz_generated/lighting-app/zap-generated/gen_config.h @@ -39,6 +39,7 @@ #define EMBER_AF_FIXED_LABEL_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) @@ -114,6 +115,11 @@ #define EMBER_AF_PLUGIN_GENERAL_DIAGNOSTICS_SERVER #define EMBER_AF_PLUGIN_GENERAL_DIAGNOSTICS +// Use this macro to check if the server side of the Group Key Management cluster is included +#define ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT_SERVER +#define EMBER_AF_PLUGIN_GROUP_KEY_MANAGEMENT + // Use this macro to check if the server side of the Groups cluster is included #define ZCL_USING_GROUPS_CLUSTER_SERVER #define EMBER_AF_PLUGIN_GROUPS_SERVER