From b88eafac8bb91f6f1e3df887585a9c179591e5bf Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 21 Aug 2024 06:32:50 -0700 Subject: [PATCH 01/53] [Fabric-Sync] Update the FS setup guide to wait for reverse commissioning complete (#35115) * [Fabric-Sync] Update the FS setup guide to wait for reverse commissing * Restyled by prettier-markdown --------- Co-authored-by: Restyled.io --- docs/guides/fabric_synchronization_guide.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/guides/fabric_synchronization_guide.md b/docs/guides/fabric_synchronization_guide.md index 50fa3202f8ba84..22d616211fbd01 100644 --- a/docs/guides/fabric_synchronization_guide.md +++ b/docs/guides/fabric_synchronization_guide.md @@ -110,6 +110,14 @@ Pair the Ecosystem 2 bridge to Ecosystem 1 with node ID 2: fabricsync add-bridge 2 ``` +This command will initiate the reverse commissioning process. After a few +seconds, you should see the following message, indicating that the local bridge +of Ecosystem 1 has successfully paired with Ecosystem 2 on Endpoint 2: + +``` +>>> A new device is added on Endpoint 2. +``` + ### Pair Light Example to Ecosystem 2 Since Fabric-Bridge also functions as a Matter server, running it alongside the From 9e057a3af5e331902c3e6317b723ae0a3447c49e Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 21 Aug 2024 08:02:39 -0700 Subject: [PATCH 02/53] [Fabric-Sync] Add VID/PID fields to IPC method CommissionNode (#35116) * Add VID/PID field to IPC methode CommissionNode * Use QRCodeSetupPayloadGenerator to generate pairing code --- .../pigweed/protos/fabric_admin_service.proto | 4 +++- .../fabric-admin/device_manager/DeviceManager.h | 4 ++-- examples/fabric-admin/rpc/RpcServer.cpp | 14 ++++++++------ .../linux/CommissionerControl.cpp | 3 ++- examples/fabric-bridge-app/linux/RpcClient.cpp | 4 +++- .../fabric-bridge-app/linux/include/RpcClient.h | 16 ++++++++++++---- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/examples/common/pigweed/protos/fabric_admin_service.proto b/examples/common/pigweed/protos/fabric_admin_service.proto index 3c311493d1c6f3..3df3e2a7aa5f5f 100644 --- a/examples/common/pigweed/protos/fabric_admin_service.proto +++ b/examples/common/pigweed/protos/fabric_admin_service.proto @@ -19,7 +19,9 @@ message DeviceCommissioningInfo { uint32 discriminator = 1; uint32 iterations = 2; uint32 setup_pin = 3; - bytes salt = 4; + uint32 vendor_id = 4; + uint32 product_id = 5; + bytes salt = 6; } message KeepActiveParameters { diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index d3b47c4b332276..1fb2ad52249938 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -156,11 +156,11 @@ class DeviceManager : public PairingDelegate void HandleCommandResponse(const chip::app::ConcreteCommandPath & path, chip::TLV::TLVReader & data); - void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; - private: friend DeviceManager & DeviceMgr(); + void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; + void RequestCommissioningApproval(); void HandleReadSupportedDeviceCategories(chip::TLV::TLVReader & data); diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index f240feda22a2d4..d56399514ad96f 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE @@ -103,16 +103,18 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate setupPayload.setUpPINCode = request.setup_pin; setupPayload.version = 0; + setupPayload.vendorID = request.vendor_id; + setupPayload.productID = request.product_id; setupPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kOnNetwork); SetupDiscriminator discriminator{}; discriminator.SetLongValue(request.discriminator); setupPayload.discriminator = discriminator; - char payloadBuffer[kMaxManualCodeLength + 1]; - MutableCharSpan manualCode(payloadBuffer); + QRCodeSetupPayloadGenerator generator(setupPayload); + std::string code; + CHIP_ERROR error = generator.payloadBase38RepresentationWithAutoTLVBuffer(code); - CHIP_ERROR error = ManualSetupPayloadGenerator(setupPayload).payloadDecimalStringRepresentation(manualCode); if (error == CHIP_NO_ERROR) { NodeId nodeId = DeviceMgr().GetNextAvailableNodeId(); @@ -121,11 +123,11 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate // RequestCommissioningApproval, you need to wait for it to open a commissioning window on its bridge. usleep(kCommissionPrepareTimeMs * 1000); - DeviceMgr().PairRemoteDevice(nodeId, payloadBuffer); + DeviceMgr().PairRemoteDevice(nodeId, code.c_str()); } else { - ChipLogError(NotSpecified, "Unable to generate manual code for setup payload: %" CHIP_ERROR_FORMAT, error.Format()); + ChipLogError(NotSpecified, "Unable to generate pairing code for setup payload: %" CHIP_ERROR_FORMAT, error.Format()); } return pw::OkStatus(); diff --git a/examples/fabric-bridge-app/linux/CommissionerControl.cpp b/examples/fabric-bridge-app/linux/CommissionerControl.cpp index 9f3180668de42c..3613aeec9305e4 100644 --- a/examples/fabric-bridge-app/linux/CommissionerControl.cpp +++ b/examples/fabric-bridge-app/linux/CommissionerControl.cpp @@ -137,7 +137,8 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissionNode(const Commissioning .SetTimeout(params.commissioningTimeout) .SetDiscriminator(params.discriminator) .SetIteration(params.iterations) - .SetSalt(params.salt)); + .SetSalt(params.salt), + mVendorId, mProductId); #else ChipLogProgress(NotSpecified, "Failed to reverse commission bridge: PW_RPC_FABRIC_BRIDGE_SERVICE not defined"); return CHIP_ERROR_NOT_IMPLEMENTED; diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp index b3c82303beb8f5..817479d8482af1 100644 --- a/examples/fabric-bridge-app/linux/RpcClient.cpp +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -163,12 +163,14 @@ OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams para } CHIP_ERROR -CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params) +CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params, VendorId vendorId, uint16_t productId) { chip_rpc_DeviceCommissioningInfo device; device.setup_pin = params.GetSetupPIN(); device.discriminator = params.GetDiscriminator(); device.iterations = params.GetIteration(); + device.vendor_id = vendorId; + device.product_id = productId; VerifyOrReturnError(params.GetSalt().size() <= sizeof(device.salt.bytes), CHIP_ERROR_BUFFER_TOO_SMALL); memcpy(device.salt.bytes, params.GetSalt().data(), params.GetSalt().size()); diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h index 87ccba24f645dc..c7628a8c3ba73c 100644 --- a/examples/fabric-bridge-app/linux/include/RpcClient.h +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -60,12 +60,20 @@ OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams para /** * Commission a node using the specified parameters. * - * @param params Params for commissioning the device using passcode. + * This function initiates the commissioning process for a node, utilizing + * the provided passcode parameters, vendor ID, and product ID. + * + * @param params Parameters required for commissioning the device using passcode. + * @param vendorId The Vendor ID (VID) of the device being commissioned. This identifies + * the manufacturer of the device. + * @param productId The Product ID (PID) of the device being commissioned. This identifies + * the specific product within the vendor's lineup. + * * @return CHIP_ERROR An error code indicating the success or failure of the operation. - * - CHIP_NO_ERROR: The RPC command was successfully sent. - * - CHIP_ERROR_INTERNAL: An internal error occurred. + * - CHIP_NO_ERROR: The RPC command was successfully sent and the commissioning process was initiated. + * - CHIP_ERROR_INTERNAL: An internal error occurred during the preparation or sending of the command. */ CHIP_ERROR -CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params); +CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params, chip::VendorId vendorId, uint16_t productId); CHIP_ERROR KeepActive(chip::NodeId nodeId, uint32_t stayActiveDurationMs); From 796394ffadb6d0322a16eb5eabfb28950c8e6116 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 21 Aug 2024 13:01:59 -0400 Subject: [PATCH 03/53] Revert "TC-IDM-10.2: Add check for MACL (#35086)" (#35111) This reverts commit 927c81857ae9288ffab4ffbd529979412f8cc5f1. --- .github/workflows/tests.yaml | 1 - src/python_testing/TC_DeviceConformance.py | 23 ---- src/python_testing/TestConformanceTest.py | 131 --------------------- src/python_testing/execute_python_tests.py | 1 - 4 files changed, 156 deletions(-) delete mode 100644 src/python_testing/TestConformanceTest.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d60ffb185de022..dbbda0aa36580f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -514,7 +514,6 @@ jobs: scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingDeviceType.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceSupport.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceTest.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestChoiceConformanceSupport.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_IDM_10_4.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py' diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index 611d7f54a82b62..3cc57e2b018ab6 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -50,22 +50,6 @@ async def setup_class_helper(self): self.xml_device_types, problems = build_xml_device_types() self.problems.extend(problems) - def _get_device_type_id(self, device_type_name: str) -> int: - id = [id for id, dt in self.xml_device_types.items() if dt.name.lower() == device_type_name.lower()] - if len(id) != 1: - self.fail_current_test(f"Unable to find {device_type_name} device type") - return id[0] - - def _has_nim(self): - nim_id = self._get_device_type_id('network infrastructure manager') - for endpoint in self.endpoints_tlv.values(): - desc = Clusters.Descriptor - device_types = [dt.deviceType for dt in endpoint[desc.id][desc.Attributes.DeviceTypeList.attribute_id]] - if nim_id in device_types: - # TODO: it's unclear if this needs to be present on every endpoint. Right now, this assumes one is sufficient. - return True - return False - def check_conformance(self, ignore_in_progress: bool, is_ci: bool): problems = [] success = True @@ -141,13 +125,6 @@ def record_warning(location, problem): for f in feature_masks: location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=GlobalAttributeIds.FEATURE_MAP_ID) - if cluster_id == Clusters.AccessControl.id and f == Clusters.AccessControl.Bitmaps.Feature.kManagedDevice: - # Managed ACL is treated as a special case because it is only allowed if other endpoints support NIM and disallowed otherwise. - if not self._has_nim(): - record_error( - location=location, problem="MACL feature is disallowed if the Network Infrastructure Manager device type is not present") - continue - if f not in self.xml_clusters[cluster_id].features.keys(): record_error(location=location, problem=f'Unknown feature with mask 0x{f:02x}') continue diff --git a/src/python_testing/TestConformanceTest.py b/src/python_testing/TestConformanceTest.py deleted file mode 100644 index a656e228bf716f..00000000000000 --- a/src/python_testing/TestConformanceTest.py +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. -# -# 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. -# - -from typing import Any - -import chip.clusters as Clusters -from conformance_support import ConformanceDecision -from global_attribute_ids import GlobalAttributeIds -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main -from mobly import asserts -from spec_parsing_support import build_xml_clusters, build_xml_device_types -from TC_DeviceConformance import DeviceConformanceTests - - -def is_mandatory(conformance): - return conformance(0, [], []).decision == ConformanceDecision.MANDATORY - - -class TestConformanceSupport(MatterBaseTest, DeviceConformanceTests): - def setup_class(self): - self.xml_clusters, self.problems = build_xml_clusters() - self.xml_device_types, problems = build_xml_device_types() - self.problems.extend(problems) - - def _create_minimal_cluster(self, cluster_id: int) -> dict[int, Any]: - attrs = {} - attrs[GlobalAttributeIds.FEATURE_MAP_ID] = 0 - - mandatory_attributes = [id for id, a in self.xml_clusters[cluster_id].attributes.items() if is_mandatory(a.conformance)] - for m in mandatory_attributes: - # dummy versions - we're not using the values in this test - attrs[m] = 0 - attrs[GlobalAttributeIds.ATTRIBUTE_LIST_ID] = mandatory_attributes - mandatory_accepted_commands = [id for id, a in self.xml_clusters[cluster_id].accepted_commands.items() - if is_mandatory(a.conformance)] - attrs[GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID] = mandatory_accepted_commands - mandatory_generated_commands = [id for id, a in self.xml_clusters[cluster_id].generated_commands.items() - if is_mandatory(a.conformance)] - attrs[GlobalAttributeIds.GENERATED_COMMAND_LIST_ID] = mandatory_generated_commands - attrs[GlobalAttributeIds.CLUSTER_REVISION_ID] = self.xml_clusters[cluster_id].revision - return attrs - - def _create_minimal_dt(self, device_type_id: int) -> dict[int, dict[int, Any]]: - ''' Creates the internals of an endpoint_tlv with the minimal set of clusters, with the minimal set of attributes and commands. Global attributes only. - Does NOT take into account overrides yet. - ''' - endpoint_tlv = {} - required_servers = [id for id, c in self.xml_device_types[device_type_id].server_clusters.items() - if is_mandatory(c.conformance)] - required_clients = [id for id, c in self.xml_device_types[device_type_id].client_clusters.items() - if is_mandatory(c.conformance)] - device_type_revision = self.xml_device_types[device_type_id].revision - - for s in required_servers: - endpoint_tlv[s] = self._create_minimal_cluster(s) - - # Descriptor - attr = Clusters.Descriptor.Attributes - attrs = {} - attrs[attr.FeatureMap.attribute_id] = 0 - attrs[attr.AcceptedCommandList.attribute_id] = [] - attrs[attr.GeneratedCommandList.attribute_id] = [] - attrs[attr.ClusterRevision.attribute_id] = self.xml_clusters[Clusters.Descriptor.id].revision - attrs[attr.DeviceTypeList.attribute_id] = [ - Clusters.Descriptor.Structs.DeviceTypeStruct(deviceType=device_type_id, revision=device_type_revision)] - attrs[attr.ServerList.attribute_id] = required_servers - attrs[attr.ClientList.attribute_id] = required_clients - attrs[attr.PartsList.attribute_id] = [] - attrs[attr.AttributeList.attribute_id] = [] - attrs[attr.AttributeList.attribute_id] = list(attrs.keys()) - - endpoint_tlv[Clusters.Descriptor.id] = attrs - return endpoint_tlv - - def add_macl(self, root_endpoint: dict[int, dict[int, Any]]): - ac = Clusters.AccessControl - root_endpoint[ac.id][ac.Attributes.FeatureMap.attribute_id] = ac.Bitmaps.Feature.kManagedDevice - root_endpoint[ac.id][ac.Attributes.Arl.attribute_id] = [] - root_endpoint[ac.id][ac.Attributes.CommissioningARL.attribute_id] = [] - root_endpoint[ac.id][ac.Attributes.AttributeList.attribute_id].extend([ - ac.Attributes.Arl.attribute_id, ac.Attributes.CommissioningARL.attribute_id]) - root_endpoint[ac.id][ac.Attributes.AcceptedCommandList.attribute_id].append(ac.Commands.ReviewFabricRestrictions.command_id) - root_endpoint[ac.id][ac.Attributes.GeneratedCommandList.attribute_id].append( - ac.Commands.ReviewFabricRestrictionsResponse.command_id) - - @async_test_body - async def test_macl_handling(self): - nim_id = self._get_device_type_id('network infrastructure manager') - root_node_id = self._get_device_type_id('root node') - on_off_id = self._get_device_type_id('On/Off Light') - - root = self._create_minimal_dt(device_type_id=root_node_id) - nim = self._create_minimal_dt(device_type_id=nim_id) - self.endpoints_tlv = {0: root, 1: nim} - asserts.assert_true(self._has_nim(), "Did not find NIM in generated device") - - success, problems = self.check_conformance(ignore_in_progress=False, is_ci=False) - self.problems.extend(problems) - asserts.assert_true(success, "Unexpected failure parsing minimal dt") - - self.add_macl(root) - # A MACL is allowed when there is a NIM, so this should succeed as well - success, problems = self.check_conformance(ignore_in_progress=False, is_ci=False) - self.problems.extend(problems) - asserts.assert_true(success, "Unexpected failure with NIM and MACL") - - # A MACL is not allowed when there is no NIM - self.endpoints_tlv[1] = self._create_minimal_dt(device_type_id=on_off_id) - success, problems = self.check_conformance(ignore_in_progress=False, is_ci=False) - self.problems.extend(problems) - asserts.assert_false(success, "Unexpected success with On/Off and MACL") - - # TODO: what happens if there is a NIM and a non-NIM endpoint? - - -if __name__ == "__main__": - default_matter_test_main() diff --git a/src/python_testing/execute_python_tests.py b/src/python_testing/execute_python_tests.py index 86d88e5aa1c7a5..ad3fc83c910bf8 100644 --- a/src/python_testing/execute_python_tests.py +++ b/src/python_testing/execute_python_tests.py @@ -87,7 +87,6 @@ def main(search_directory, env_file): "TestChoiceConformanceSupport.py", "TC_DEMTestBase.py", "choice_conformance_support.py", - "TestConformanceTest.py", # Unit test of the conformance test (TC_DeviceConformance) - does not run against an app. "TestIdChecks.py", "TestSpecParsingDeviceType.py", "TestMatterTestingSupport.py", From ddf8b8fbb76a02ef610b3c701b0528d70ba22e9e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Aug 2024 13:03:02 -0400 Subject: [PATCH 04/53] Fix UnregisterAllCommandHandlersForEndpoint to work correctly. (#35100) Fixes https://github.com/project-chip/connectedhomeip/issues/34953 --- src/app/CommandHandlerInterfaceRegistry.cpp | 7 +- src/app/tests/BUILD.gn | 1 + .../TestCommandHandlerInterfaceRegistry.cpp | 103 ++++++++++++++++++ 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/app/tests/TestCommandHandlerInterfaceRegistry.cpp diff --git a/src/app/CommandHandlerInterfaceRegistry.cpp b/src/app/CommandHandlerInterfaceRegistry.cpp index 01436853dd1a55..8345be5dcc2805 100644 --- a/src/app/CommandHandlerInterfaceRegistry.cpp +++ b/src/app/CommandHandlerInterfaceRegistry.cpp @@ -68,8 +68,11 @@ void CommandHandlerInterfaceRegistry::UnregisterAllCommandHandlersForEndpoint(En { CommandHandlerInterface * prev = nullptr; - for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) + for (auto * cur = mCommandHandlerList; cur;) { + // Fetch next node in the list before we remove this one. + auto * next = cur->GetNext(); + if (cur->MatchesEndpoint(endpointId)) { if (prev == nullptr) @@ -87,6 +90,8 @@ void CommandHandlerInterfaceRegistry::UnregisterAllCommandHandlersForEndpoint(En { prev = cur; } + + cur = next; } } diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 1bce08d55e0571..104a57a2fc019a 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -194,6 +194,7 @@ chip_test_suite("tests") { "TestBasicCommandPathRegistry.cpp", "TestBindingTable.cpp", "TestBuilderParser.cpp", + "TestCommandHandlerInterfaceRegistry.cpp", "TestCommandInteraction.cpp", "TestCommandPathParams.cpp", "TestConcreteAttributePath.cpp", diff --git a/src/app/tests/TestCommandHandlerInterfaceRegistry.cpp b/src/app/tests/TestCommandHandlerInterfaceRegistry.cpp new file mode 100644 index 00000000000000..aed017362c83f5 --- /dev/null +++ b/src/app/tests/TestCommandHandlerInterfaceRegistry.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * 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 + +namespace chip { +namespace app { + +namespace { + +class TestCommandHandlerInterface : public CommandHandlerInterface +{ +public: + TestCommandHandlerInterface(Optional endpointId, ClusterId clusterId) : + CommandHandlerInterface(endpointId, clusterId) + {} + + // Just need this to compile + void InvokeCommand(HandlerContext & handlerContext) override {} +}; + +} // anonymous namespace + +TEST(TestCommandHandlerInterfaceRegistry, TestRegisterUnregister) +{ + TestCommandHandlerInterface a(Optional(1), 1); + TestCommandHandlerInterface b(Optional(1), 2); + TestCommandHandlerInterface c(Optional(2), 1); + TestCommandHandlerInterface d(NullOptional, 3); + + CommandHandlerInterfaceRegistry registry; + EXPECT_EQ(registry.RegisterCommandHandler(&a), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&b), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&c), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&d), CHIP_NO_ERROR); + + EXPECT_EQ(registry.GetCommandHandler(1, 1), &a); + EXPECT_EQ(registry.GetCommandHandler(1, 2), &b); + EXPECT_EQ(registry.GetCommandHandler(2, 1), &c); + EXPECT_EQ(registry.GetCommandHandler(1, 3), &d); + EXPECT_EQ(registry.GetCommandHandler(5, 3), &d); + + EXPECT_EQ(registry.UnregisterCommandHandler(&b), CHIP_NO_ERROR); + + EXPECT_EQ(registry.GetCommandHandler(1, 1), &a); + EXPECT_EQ(registry.GetCommandHandler(1, 2), nullptr); + EXPECT_EQ(registry.GetCommandHandler(2, 1), &c); + EXPECT_EQ(registry.GetCommandHandler(1, 3), &d); + EXPECT_EQ(registry.GetCommandHandler(5, 3), &d); + + EXPECT_EQ(registry.UnregisterCommandHandler(&b), CHIP_ERROR_KEY_NOT_FOUND); +} + +TEST(TestCommandHandlerInterfaceRegistry, TestUnregisterAll) +{ + TestCommandHandlerInterface a(Optional(1), 1); + TestCommandHandlerInterface b(Optional(1), 2); + TestCommandHandlerInterface c(Optional(2), 1); + TestCommandHandlerInterface d(NullOptional, 3); + + CommandHandlerInterfaceRegistry registry; + EXPECT_EQ(registry.RegisterCommandHandler(&a), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&b), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&c), CHIP_NO_ERROR); + EXPECT_EQ(registry.RegisterCommandHandler(&d), CHIP_NO_ERROR); + + EXPECT_EQ(registry.GetCommandHandler(1, 1), &a); + EXPECT_EQ(registry.GetCommandHandler(1, 2), &b); + EXPECT_EQ(registry.GetCommandHandler(2, 1), &c); + EXPECT_EQ(registry.GetCommandHandler(1, 3), &d); + EXPECT_EQ(registry.GetCommandHandler(5, 3), &d); + + registry.UnregisterAllCommandHandlersForEndpoint(1); + + EXPECT_EQ(registry.GetCommandHandler(1, 1), nullptr); + EXPECT_EQ(registry.GetCommandHandler(1, 2), nullptr); + EXPECT_EQ(registry.GetCommandHandler(2, 1), &c); + EXPECT_EQ(registry.GetCommandHandler(1, 3), &d); + EXPECT_EQ(registry.GetCommandHandler(5, 3), &d); +} + +} // namespace app +} // namespace chip From fd9dfe26964b5f77e08782ce7ed1ff8b259a69b8 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Aug 2024 13:03:39 -0400 Subject: [PATCH 05/53] Add missing CFLAGS to instrument things for fuzzers. (#35082) -fno-sanitize-coverage=pc-table is added since we are already using inline-8bit-counters and trace-cmp to provide instrumentation for the fuzzers. It also helps reduce memory usage and improve fuzzer performance. --- build/config/compiler/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index fee0d745f6d136..2e2ebe606f089f 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -415,6 +415,8 @@ declare_args() { config("sanitize_address") { defines = [] cflags = [ + "-fsanitize-coverage=inline-8bit-counters,trace-cmp", + "-fno-sanitize-coverage=pc-table", "-fsanitize=address", "-fno-omit-frame-pointer", ] From 150aad355231832c220b5d4e9da0ba00e81b0b8d Mon Sep 17 00:00:00 2001 From: Paul Regan <64710345+paulr34@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:27:19 -0400 Subject: [PATCH 06/53] adding mandatory endpointComposition data to XML for ZAP to consume (#34818) * adding endpointComposition data to XML for ZAP to consume * explicitly adding constraint as defined by the spec and defining compositions types * fix composition type tag * changing back to prevent both types being true which is not allowed * explciitly setting conformance and contraint to account for all scenarios --- .../zap-templates/zcl/data-model/chip/matter-devices.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 14f4b9edf39958..ea18e985628071 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -2209,6 +2209,12 @@ limitations under the License. 0x0070 Simple Endpoint + + tree + + 0x0071 + + From 849634bdb00ad1083ff3e615f3eac1448a21a0bc Mon Sep 17 00:00:00 2001 From: Thirupathi S <108743108+Thirsrin@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:27:17 +0530 Subject: [PATCH 07/53] Colorcontrol xml file sync with specs (#33612) * doorlock xml file sync with specs and colorcontrol xml type changes * build error resolved * Restyled by clang-format * build error resolved * addressed review comments * Restyled by clang-format * Addressed review comments * Restyled by clang-format * build error solved * build error solved * build error solved * build error solved * build issue resolved * Restyled by clang-format * resolved build errors * removed doorlock xml changes * Restyled by clang-format * resolved build errors * Restyled by clang-format * resolved build errors * addressed review comments * addressed review comments * resolved build errors * resolved build errors * zap generated changes * Restyled by clang-format * Revert colorloopdirection type change * build error resolved * Restyled by clang-format * rebased and zap generated * color control xml file updated * build error solved * ameba build error resolved * Restyled by clang-format * ameba build error resolved * doorlock changes removed * ameba build error resolved * ameba build error resolved * addressed review comments * addressed review comments * Restyled by clang-format * Addressed review comments * Addressed review comments * Restyled by clang-format * build error resolved * build error resolved * addressed reviews comments and build error resolved * Restyled by clang-format * ZAP issue resolved * scripts updated * scripts updated * added enum values in compatenum.h file * Restyled by whitespace * Restyled by clang-format * added enum values in compatenum.h file * Restyled by whitespace * Restyled by clang-format * added enum values in compatenum.h file * added header file for to_underlying * build error resolved * build error resolved --------- Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 182 ++++---- .../ameba/main/include/ColorControlCommands.h | 204 ++++----- .../all-clusters-minimal-app.matter | 182 ++++---- ...de_colortemperaturelight_hbUnzYVeyn.matter | 182 ++++---- ...tnode_extendedcolorlight_8lcaaYJVAa.matter | 182 ++++---- examples/common/imgui_ui/windows/light.cpp | 14 +- examples/common/imgui_ui/windows/light.h | 3 +- .../light-switch-app.matter | 182 ++++---- .../light-switch-app/qpg/zap/switch.matter | 182 ++++---- .../data_model/lighting-app-ethernet.matter | 182 ++++---- .../data_model/lighting-app-thread.matter | 182 ++++---- .../data_model/lighting-app-wifi.matter | 182 ++++---- .../lighting-common/lighting-app.matter | 182 ++++---- examples/lighting-app/qpg/zap/light.matter | 182 ++++---- .../data_model/lighting-thread-app.matter | 182 ++++---- .../data_model/lighting-wifi-app.matter | 182 ++++---- .../lighting-app/tizen/src/DBusInterface.cpp | 6 +- examples/lighting-app/tizen/src/main.cpp | 2 +- .../placeholder/linux/apps/app1/config.matter | 364 ++++++++-------- .../placeholder/linux/apps/app2/config.matter | 364 ++++++++-------- .../virtual-device-app.matter | 182 ++++---- .../color-control-server.cpp | 301 ++++++------- .../color-control-server.h | 44 +- src/app/common/CompatEnumNames.h | 46 ++ .../data-model/chip/color-control-cluster.xml | 187 ++++---- .../data_model/controller-clusters.matter | 182 ++++---- .../CHIPAttributeTLVValueDecoder.cpp | 4 +- .../python/chip/clusters/Objects.py | 143 +++--- .../MTRAttributeTLVValueDecoder.mm | 10 +- .../CHIP/zap-generated/MTRBaseClusters.h | 106 ++--- .../CHIP/zap-generated/MTRBaseClusters.mm | 2 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 76 ++-- src/python_testing/TC_CC_2_2.py | 8 +- .../zap-generated/attributes/Accessors.cpp | 70 +-- .../zap-generated/attributes/Accessors.h | 44 +- .../zap-generated/cluster-enums-check.h | 56 +-- .../app-common/zap-generated/cluster-enums.h | 102 +++-- .../zap-generated/cluster-objects.h | 410 +++++++++--------- .../zap-generated/cluster/Commands.h | 23 +- .../cluster/logging/DataModelLogger.cpp | 10 +- .../zap-generated/cluster/Commands.h | 76 ++-- 41 files changed, 2825 insertions(+), 2580 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 46debb8a6cd363..c18c6164c5c717 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -5847,65 +5847,62 @@ cluster ThermostatUserInterfaceConfiguration = 516 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -5916,16 +5913,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -5957,13 +5965,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -5977,150 +5985,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/all-clusters-app/ameba/main/include/ColorControlCommands.h b/examples/all-clusters-app/ameba/main/include/ColorControlCommands.h index a80b5fe02d659d..73241be444dbcb 100644 --- a/examples/all-clusters-app/ameba/main/include/ColorControlCommands.h +++ b/examples/all-clusters-app/ameba/main/include/ColorControlCommands.h @@ -360,29 +360,29 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E { case Clusters::ColorControl::Commands::MoveToHue::Id: moveToHueCommand.hue = static_cast(data->args[0]); - moveToHueCommand.direction = static_cast(data->args[1]); + moveToHueCommand.direction = static_cast(data->args[1]); moveToHueCommand.transitionTime = static_cast(data->args[2]); - moveToHueCommand.optionsMask = static_cast(data->args[3]); - moveToHueCommand.optionsOverride = static_cast(data->args[4]); + moveToHueCommand.optionsMask = static_cast(data->args[3]); + moveToHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveToHueCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::MoveHue::Id: - moveHueCommand.moveMode = static_cast(data->args[0]); + moveHueCommand.moveMode = static_cast(data->args[0]); moveHueCommand.rate = static_cast(data->args[1]); - moveHueCommand.optionsMask = static_cast(data->args[2]); - moveHueCommand.optionsOverride = static_cast(data->args[3]); + moveHueCommand.optionsMask = static_cast(data->args[2]); + moveHueCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveHueCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::StepHue::Id: - stepHueCommand.stepMode = static_cast(data->args[0]); + stepHueCommand.stepMode = static_cast(data->args[0]); stepHueCommand.stepSize = static_cast(data->args[1]); stepHueCommand.transitionTime = static_cast(data->args[2]); - stepHueCommand.optionsMask = static_cast(data->args[3]); - stepHueCommand.optionsOverride = static_cast(data->args[4]); + stepHueCommand.optionsMask = static_cast(data->args[3]); + stepHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, stepHueCommand, onSuccess, onFailure); break; @@ -390,27 +390,27 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E case Clusters::ColorControl::Commands::MoveToSaturation::Id: moveToSaturationCommand.saturation = static_cast(data->args[0]); moveToSaturationCommand.transitionTime = static_cast(data->args[1]); - moveToSaturationCommand.optionsMask = static_cast(data->args[2]); - moveToSaturationCommand.optionsOverride = static_cast(data->args[3]); + moveToSaturationCommand.optionsMask = static_cast(data->args[2]); + moveToSaturationCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveToSaturationCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::MoveSaturation::Id: - moveSaturationCommand.moveMode = static_cast(data->args[0]); + moveSaturationCommand.moveMode = static_cast(data->args[0]); moveSaturationCommand.rate = static_cast(data->args[1]); - moveSaturationCommand.optionsMask = static_cast(data->args[2]); - moveSaturationCommand.optionsOverride = static_cast(data->args[3]); + moveSaturationCommand.optionsMask = static_cast(data->args[2]); + moveSaturationCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveSaturationCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::StepSaturation::Id: - stepSaturationCommand.stepMode = static_cast(data->args[0]); + stepSaturationCommand.stepMode = static_cast(data->args[0]); stepSaturationCommand.stepSize = static_cast(data->args[1]); stepSaturationCommand.transitionTime = static_cast(data->args[2]); - stepSaturationCommand.optionsMask = static_cast(data->args[3]); - stepSaturationCommand.optionsOverride = static_cast(data->args[4]); + stepSaturationCommand.optionsMask = static_cast(data->args[3]); + stepSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, stepSaturationCommand, onSuccess, onFailure); break; @@ -419,8 +419,8 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E moveToHueAndSaturationCommand.hue = static_cast(data->args[0]); moveToHueAndSaturationCommand.saturation = static_cast(data->args[1]); moveToHueAndSaturationCommand.transitionTime = static_cast(data->args[2]); - moveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); - moveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); + moveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); + moveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveToHueAndSaturationCommand, onSuccess, onFailure); break; @@ -429,8 +429,8 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E moveToColorCommand.colorX = static_cast(data->args[0]); moveToColorCommand.colorY = static_cast(data->args[1]); moveToColorCommand.transitionTime = static_cast(data->args[2]); - moveToColorCommand.optionsMask = static_cast(data->args[3]); - moveToColorCommand.optionsOverride = static_cast(data->args[4]); + moveToColorCommand.optionsMask = static_cast(data->args[3]); + moveToColorCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveToColorCommand, onSuccess, onFailure); break; @@ -438,8 +438,8 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E case Clusters::ColorControl::Commands::MoveColor::Id: moveColorCommand.rateX = static_cast(data->args[0]); moveColorCommand.rateY = static_cast(data->args[1]); - moveColorCommand.optionsMask = static_cast(data->args[2]); - moveColorCommand.optionsOverride = static_cast(data->args[3]); + moveColorCommand.optionsMask = static_cast(data->args[2]); + moveColorCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveColorCommand, onSuccess, onFailure); break; @@ -448,8 +448,8 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E stepColorCommand.stepX = static_cast(data->args[0]); stepColorCommand.stepY = static_cast(data->args[1]); stepColorCommand.transitionTime = static_cast(data->args[2]); - stepColorCommand.optionsMask = static_cast(data->args[3]); - stepColorCommand.optionsOverride = static_cast(data->args[4]); + stepColorCommand.optionsMask = static_cast(data->args[3]); + stepColorCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, stepColorCommand, onSuccess, onFailure); break; @@ -457,37 +457,37 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E case Clusters::ColorControl::Commands::MoveToColorTemperature::Id: moveToColorTemperatureCommand.colorTemperatureMireds = static_cast(data->args[0]); moveToColorTemperatureCommand.transitionTime = static_cast(data->args[1]); - moveToColorTemperatureCommand.optionsMask = static_cast(data->args[2]); - moveToColorTemperatureCommand.optionsOverride = static_cast(data->args[3]); + moveToColorTemperatureCommand.optionsMask = static_cast(data->args[2]); + moveToColorTemperatureCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveToColorTemperatureCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::EnhancedMoveToHue::Id: enhancedMoveToHueCommand.enhancedHue = static_cast(data->args[0]); - enhancedMoveToHueCommand.direction = static_cast(data->args[1]); + enhancedMoveToHueCommand.direction = static_cast(data->args[1]); enhancedMoveToHueCommand.transitionTime = static_cast(data->args[2]); - enhancedMoveToHueCommand.optionsMask = static_cast(data->args[3]); - enhancedMoveToHueCommand.optionsOverride = static_cast(data->args[4]); + enhancedMoveToHueCommand.optionsMask = static_cast(data->args[3]); + enhancedMoveToHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, enhancedMoveToHueCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::EnhancedMoveHue::Id: - enhancedMoveHueCommand.moveMode = static_cast(data->args[0]); + enhancedMoveHueCommand.moveMode = static_cast(data->args[0]); enhancedMoveHueCommand.rate = static_cast(data->args[1]); - enhancedMoveHueCommand.optionsMask = static_cast(data->args[2]); - enhancedMoveHueCommand.optionsOverride = static_cast(data->args[3]); + enhancedMoveHueCommand.optionsMask = static_cast(data->args[2]); + enhancedMoveHueCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, enhancedMoveHueCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::EnhancedStepHue::Id: - enhancedStepHueCommand.stepMode = static_cast(data->args[0]); + enhancedStepHueCommand.stepMode = static_cast(data->args[0]); enhancedStepHueCommand.stepSize = static_cast(data->args[1]); enhancedStepHueCommand.transitionTime = static_cast(data->args[2]); - enhancedStepHueCommand.optionsMask = static_cast(data->args[3]); - enhancedStepHueCommand.optionsOverride = static_cast(data->args[4]); + enhancedStepHueCommand.optionsMask = static_cast(data->args[3]); + enhancedStepHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, enhancedStepHueCommand, onSuccess, onFailure); break; @@ -496,51 +496,51 @@ void ProcessColorControlUnicastBindingCommand(BindingCommandData * data, const E enhancedMoveToHueAndSaturationCommand.enhancedHue = static_cast(data->args[0]); enhancedMoveToHueAndSaturationCommand.saturation = static_cast(data->args[1]); enhancedMoveToHueAndSaturationCommand.transitionTime = static_cast(data->args[2]); - enhancedMoveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); - enhancedMoveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); + enhancedMoveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); + enhancedMoveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, enhancedMoveToHueAndSaturationCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::ColorLoopSet::Id: colorLoopSetCommand.updateFlags = - static_cast>(data->args[0]); - colorLoopSetCommand.action = static_cast(data->args[1]); - colorLoopSetCommand.direction = static_cast(data->args[2]); + static_cast>(data->args[0]); + colorLoopSetCommand.action = static_cast(data->args[1]); + colorLoopSetCommand.direction = static_cast(data->args[2]); colorLoopSetCommand.time = static_cast(data->args[3]); colorLoopSetCommand.startHue = static_cast(data->args[4]); - colorLoopSetCommand.optionsMask = static_cast(data->args[5]); - colorLoopSetCommand.optionsOverride = static_cast(data->args[6]); + colorLoopSetCommand.optionsMask = static_cast(data->args[5]); + colorLoopSetCommand.optionsOverride = static_cast(data->args[6]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, colorLoopSetCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::StopMoveStep::Id: - stopMoveStepCommand.optionsMask = static_cast(data->args[0]); - stopMoveStepCommand.optionsOverride = static_cast(data->args[1]); + stopMoveStepCommand.optionsMask = static_cast(data->args[0]); + stopMoveStepCommand.optionsOverride = static_cast(data->args[1]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, stopMoveStepCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::MoveColorTemperature::Id: - moveColorTemperatureCommand.moveMode = static_cast(data->args[0]); + moveColorTemperatureCommand.moveMode = static_cast(data->args[0]); moveColorTemperatureCommand.rate = static_cast(data->args[1]); moveColorTemperatureCommand.colorTemperatureMinimumMireds = static_cast(data->args[2]); moveColorTemperatureCommand.colorTemperatureMaximumMireds = static_cast(data->args[3]); - moveColorTemperatureCommand.optionsMask = static_cast(data->args[4]); - moveColorTemperatureCommand.optionsOverride = static_cast(data->args[5]); + moveColorTemperatureCommand.optionsMask = static_cast(data->args[4]); + moveColorTemperatureCommand.optionsOverride = static_cast(data->args[5]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, moveColorTemperatureCommand, onSuccess, onFailure); break; case Clusters::ColorControl::Commands::StepColorTemperature::Id: - stepColorTemperatureCommand.stepMode = static_cast(data->args[0]); + stepColorTemperatureCommand.stepMode = static_cast(data->args[0]); stepColorTemperatureCommand.stepSize = static_cast(data->args[1]); stepColorTemperatureCommand.transitionTime = static_cast(data->args[2]); stepColorTemperatureCommand.colorTemperatureMinimumMireds = static_cast(data->args[3]); stepColorTemperatureCommand.colorTemperatureMaximumMireds = static_cast(data->args[4]); - stepColorTemperatureCommand.optionsMask = static_cast(data->args[5]); - stepColorTemperatureCommand.optionsOverride = static_cast(data->args[6]); + stepColorTemperatureCommand.optionsMask = static_cast(data->args[5]); + stepColorTemperatureCommand.optionsOverride = static_cast(data->args[6]); Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, stepColorTemperatureCommand, onSuccess, onFailure); break; @@ -577,52 +577,52 @@ void ProcessColorControlGroupBindingCommand(BindingCommandData * data, const Emb { case Clusters::ColorControl::Commands::MoveToHue::Id: moveToHueCommand.hue = static_cast(data->args[0]); - moveToHueCommand.direction = static_cast(data->args[1]); + moveToHueCommand.direction = static_cast(data->args[1]); moveToHueCommand.transitionTime = static_cast(data->args[2]); - moveToHueCommand.optionsMask = static_cast(data->args[3]); - moveToHueCommand.optionsOverride = static_cast(data->args[4]); + moveToHueCommand.optionsMask = static_cast(data->args[3]); + moveToHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToHueCommand); break; case Clusters::ColorControl::Commands::MoveHue::Id: - moveHueCommand.moveMode = static_cast(data->args[0]); + moveHueCommand.moveMode = static_cast(data->args[0]); moveHueCommand.rate = static_cast(data->args[1]); - moveHueCommand.optionsMask = static_cast(data->args[2]); - moveHueCommand.optionsOverride = static_cast(data->args[3]); + moveHueCommand.optionsMask = static_cast(data->args[2]); + moveHueCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveHueCommand); break; case Clusters::ColorControl::Commands::StepHue::Id: - stepHueCommand.stepMode = static_cast(data->args[0]); + stepHueCommand.stepMode = static_cast(data->args[0]); stepHueCommand.stepSize = static_cast(data->args[1]); stepHueCommand.transitionTime = static_cast(data->args[2]); - stepHueCommand.optionsMask = static_cast(data->args[3]); - stepHueCommand.optionsOverride = static_cast(data->args[4]); + stepHueCommand.optionsMask = static_cast(data->args[3]); + stepHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, stepHueCommand); break; case Clusters::ColorControl::Commands::MoveToSaturation::Id: moveToSaturationCommand.saturation = static_cast(data->args[0]); moveToSaturationCommand.transitionTime = static_cast(data->args[1]); - moveToSaturationCommand.optionsMask = static_cast(data->args[2]); - moveToSaturationCommand.optionsOverride = static_cast(data->args[3]); + moveToSaturationCommand.optionsMask = static_cast(data->args[2]); + moveToSaturationCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToSaturationCommand); break; case Clusters::ColorControl::Commands::MoveSaturation::Id: - moveSaturationCommand.moveMode = static_cast(data->args[0]); + moveSaturationCommand.moveMode = static_cast(data->args[0]); moveSaturationCommand.rate = static_cast(data->args[1]); - moveSaturationCommand.optionsMask = static_cast(data->args[2]); - moveSaturationCommand.optionsOverride = static_cast(data->args[3]); + moveSaturationCommand.optionsMask = static_cast(data->args[2]); + moveSaturationCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveSaturationCommand); break; case Clusters::ColorControl::Commands::StepSaturation::Id: - stepSaturationCommand.stepMode = static_cast(data->args[0]); + stepSaturationCommand.stepMode = static_cast(data->args[0]); stepSaturationCommand.stepSize = static_cast(data->args[1]); stepSaturationCommand.transitionTime = static_cast(data->args[2]); - stepSaturationCommand.optionsMask = static_cast(data->args[3]); - stepSaturationCommand.optionsOverride = static_cast(data->args[4]); + stepSaturationCommand.optionsMask = static_cast(data->args[3]); + stepSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, stepSaturationCommand); break; @@ -630,8 +630,8 @@ void ProcessColorControlGroupBindingCommand(BindingCommandData * data, const Emb moveToHueAndSaturationCommand.hue = static_cast(data->args[0]); moveToHueAndSaturationCommand.saturation = static_cast(data->args[1]); moveToHueAndSaturationCommand.transitionTime = static_cast(data->args[2]); - moveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); - moveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); + moveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); + moveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToHueAndSaturationCommand); break; @@ -639,16 +639,16 @@ void ProcessColorControlGroupBindingCommand(BindingCommandData * data, const Emb moveToColorCommand.colorX = static_cast(data->args[0]); moveToColorCommand.colorY = static_cast(data->args[1]); moveToColorCommand.transitionTime = static_cast(data->args[2]); - moveToColorCommand.optionsMask = static_cast(data->args[3]); - moveToColorCommand.optionsOverride = static_cast(data->args[4]); + moveToColorCommand.optionsMask = static_cast(data->args[3]); + moveToColorCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToColorCommand); break; case Clusters::ColorControl::Commands::MoveColor::Id: moveColorCommand.rateX = static_cast(data->args[0]); moveColorCommand.rateY = static_cast(data->args[1]); - moveColorCommand.optionsMask = static_cast(data->args[2]); - moveColorCommand.optionsOverride = static_cast(data->args[3]); + moveColorCommand.optionsMask = static_cast(data->args[2]); + moveColorCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveColorCommand); break; @@ -656,42 +656,42 @@ void ProcessColorControlGroupBindingCommand(BindingCommandData * data, const Emb stepColorCommand.stepX = static_cast(data->args[0]); stepColorCommand.stepY = static_cast(data->args[1]); stepColorCommand.transitionTime = static_cast(data->args[2]); - stepColorCommand.optionsMask = static_cast(data->args[3]); - stepColorCommand.optionsOverride = static_cast(data->args[4]); + stepColorCommand.optionsMask = static_cast(data->args[3]); + stepColorCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, stepColorCommand); break; case Clusters::ColorControl::Commands::MoveToColorTemperature::Id: moveToColorTemperatureCommand.colorTemperatureMireds = static_cast(data->args[0]); moveToColorTemperatureCommand.transitionTime = static_cast(data->args[1]); - moveToColorTemperatureCommand.optionsMask = static_cast(data->args[2]); - moveToColorTemperatureCommand.optionsOverride = static_cast(data->args[3]); + moveToColorTemperatureCommand.optionsMask = static_cast(data->args[2]); + moveToColorTemperatureCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToColorTemperatureCommand); break; case Clusters::ColorControl::Commands::EnhancedMoveToHue::Id: enhancedMoveToHueCommand.enhancedHue = static_cast(data->args[0]); - enhancedMoveToHueCommand.direction = static_cast(data->args[1]); + enhancedMoveToHueCommand.direction = static_cast(data->args[1]); enhancedMoveToHueCommand.transitionTime = static_cast(data->args[2]); - enhancedMoveToHueCommand.optionsMask = static_cast(data->args[3]); - enhancedMoveToHueCommand.optionsOverride = static_cast(data->args[4]); + enhancedMoveToHueCommand.optionsMask = static_cast(data->args[3]); + enhancedMoveToHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, enhancedMoveToHueCommand); break; case Clusters::ColorControl::Commands::EnhancedMoveHue::Id: - enhancedMoveHueCommand.moveMode = static_cast(data->args[0]); + enhancedMoveHueCommand.moveMode = static_cast(data->args[0]); enhancedMoveHueCommand.rate = static_cast(data->args[1]); - enhancedMoveHueCommand.optionsMask = static_cast(data->args[2]); - enhancedMoveHueCommand.optionsOverride = static_cast(data->args[3]); + enhancedMoveHueCommand.optionsMask = static_cast(data->args[2]); + enhancedMoveHueCommand.optionsOverride = static_cast(data->args[3]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, enhancedMoveHueCommand); break; case Clusters::ColorControl::Commands::EnhancedStepHue::Id: - enhancedStepHueCommand.stepMode = static_cast(data->args[0]); + enhancedStepHueCommand.stepMode = static_cast(data->args[0]); enhancedStepHueCommand.stepSize = static_cast(data->args[1]); enhancedStepHueCommand.transitionTime = static_cast(data->args[2]); - enhancedStepHueCommand.optionsMask = static_cast(data->args[3]); - enhancedStepHueCommand.optionsOverride = static_cast(data->args[4]); + enhancedStepHueCommand.optionsMask = static_cast(data->args[3]); + enhancedStepHueCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, enhancedStepHueCommand); break; @@ -699,48 +699,48 @@ void ProcessColorControlGroupBindingCommand(BindingCommandData * data, const Emb enhancedMoveToHueAndSaturationCommand.enhancedHue = static_cast(data->args[0]); enhancedMoveToHueAndSaturationCommand.saturation = static_cast(data->args[1]); enhancedMoveToHueAndSaturationCommand.transitionTime = static_cast(data->args[2]); - enhancedMoveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); - enhancedMoveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); + enhancedMoveToHueAndSaturationCommand.optionsMask = static_cast(data->args[3]); + enhancedMoveToHueAndSaturationCommand.optionsOverride = static_cast(data->args[4]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, enhancedMoveToHueAndSaturationCommand); break; case Clusters::ColorControl::Commands::ColorLoopSet::Id: colorLoopSetCommand.updateFlags = - static_cast>(data->args[0]); - colorLoopSetCommand.action = static_cast(data->args[1]); - colorLoopSetCommand.direction = static_cast(data->args[2]); + static_cast>(data->args[0]); + colorLoopSetCommand.action = static_cast(data->args[1]); + colorLoopSetCommand.direction = static_cast(data->args[2]); colorLoopSetCommand.time = static_cast(data->args[3]); colorLoopSetCommand.startHue = static_cast(data->args[4]); - colorLoopSetCommand.optionsMask = static_cast(data->args[5]); - colorLoopSetCommand.optionsOverride = static_cast(data->args[6]); + colorLoopSetCommand.optionsMask = static_cast(data->args[5]); + colorLoopSetCommand.optionsOverride = static_cast(data->args[6]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, colorLoopSetCommand); break; case Clusters::ColorControl::Commands::StopMoveStep::Id: - stopMoveStepCommand.optionsMask = static_cast(data->args[0]); - stopMoveStepCommand.optionsOverride = static_cast(data->args[1]); + stopMoveStepCommand.optionsMask = static_cast(data->args[0]); + stopMoveStepCommand.optionsOverride = static_cast(data->args[1]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, stopMoveStepCommand); break; case Clusters::ColorControl::Commands::MoveColorTemperature::Id: - moveColorTemperatureCommand.moveMode = static_cast(data->args[0]); + moveColorTemperatureCommand.moveMode = static_cast(data->args[0]); moveColorTemperatureCommand.rate = static_cast(data->args[1]); moveColorTemperatureCommand.colorTemperatureMinimumMireds = static_cast(data->args[2]); moveColorTemperatureCommand.colorTemperatureMaximumMireds = static_cast(data->args[3]); - moveColorTemperatureCommand.optionsMask = static_cast(data->args[4]); - moveColorTemperatureCommand.optionsOverride = static_cast(data->args[5]); + moveColorTemperatureCommand.optionsMask = static_cast(data->args[4]); + moveColorTemperatureCommand.optionsOverride = static_cast(data->args[5]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveColorTemperatureCommand); break; case Clusters::ColorControl::Commands::StepColorTemperature::Id: - stepColorTemperatureCommand.stepMode = static_cast(data->args[0]); + stepColorTemperatureCommand.stepMode = static_cast(data->args[0]); stepColorTemperatureCommand.stepSize = static_cast(data->args[1]); stepColorTemperatureCommand.transitionTime = static_cast(data->args[2]); stepColorTemperatureCommand.colorTemperatureMinimumMireds = static_cast(data->args[3]); stepColorTemperatureCommand.colorTemperatureMaximumMireds = static_cast(data->args[4]); - stepColorTemperatureCommand.optionsMask = static_cast(data->args[5]); - stepColorTemperatureCommand.optionsOverride = static_cast(data->args[6]); + stepColorTemperatureCommand.optionsMask = static_cast(data->args[5]); + stepColorTemperatureCommand.optionsOverride = static_cast(data->args[6]); Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, stepColorTemperatureCommand); break; } diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 1444915c368b6b..16f170c1379591 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -4281,65 +4281,62 @@ cluster ThermostatUserInterfaceConfiguration = 516 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -4350,16 +4347,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -4391,13 +4399,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -4411,150 +4419,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 961f40352b1052..d8758b3043edaa 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -1715,65 +1715,62 @@ cluster GroupKeyManagement = 63 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -1784,16 +1781,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -1825,13 +1833,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -1845,150 +1853,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index d9841f769a79dd..0ef1c969727a6d 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -1816,65 +1816,62 @@ cluster FixedLabel = 64 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -1885,16 +1882,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -1926,13 +1934,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -1946,150 +1954,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/common/imgui_ui/windows/light.cpp b/examples/common/imgui_ui/windows/light.cpp index 86899e044b2ed1..f4950739e6c416 100644 --- a/examples/common/imgui_ui/windows/light.cpp +++ b/examples/common/imgui_ui/windows/light.cpp @@ -155,14 +155,14 @@ void Light::Render() ImGui::Text("Color Control:"); ImGui::Indent(); const char * mode = // based on ColorMode attribute: spec 3.2.7.9 - (mColorMode == kColorModeCurrentHueAndCurrentSaturation) ? "Hue/Saturation" - : (mColorMode == kColorModeCurrentXAndCurrentY) ? "X/Y" - : (mColorMode == kColorModeColorTemperature) ? "Temperature/Mireds" - : "UNKNOWN"; + (mColorMode == ColorControl::ColorModeEnum::kCurrentHueAndCurrentSaturation) ? "Hue/Saturation" + : (mColorMode == ColorControl::ColorModeEnum::kCurrentXAndCurrentY) ? "X/Y" + : (mColorMode == ColorControl::ColorModeEnum::kColorTemperatureMireds) ? "Temperature/Mireds" + : "UNKNOWN"; ImGui::Text("Mode: %s", mode); - if (mColorMode == kColorModeCurrentHueAndCurrentSaturation) + if (mColorMode == ColorControl::ColorModeEnum::kCurrentHueAndCurrentSaturation) { const float hueDegrees = (mColorHue * 360.0f) / 254.0f; const float saturationPercent = 100.0f * (mColorSaturation / 254.0f); @@ -173,12 +173,12 @@ void Light::Render() ImGui::ColorButton("LightColor", HueSaturationToColor(hueDegrees, saturationPercent), 0 /* ImGuiColorEditFlags_* */, ImVec2(80, 80)); } - else if (mColorMode == kColorModeCurrentXAndCurrentY) + else if (mColorMode == ColorControl::ColorModeEnum::kCurrentXAndCurrentY) { ImGui::Text("Current X: %d", mColorX); ImGui::Text("Current Y: %d", mColorY); } - else if (mColorMode == kColorModeColorTemperature) + else if (mColorMode == ColorControl::ColorModeEnum::kColorTemperatureMireds) { ImGui::Text("Color Temperature Mireds: %d", mColorTemperatureMireds); } diff --git a/examples/common/imgui_ui/windows/light.h b/examples/common/imgui_ui/windows/light.h index 20942373d3111c..242f6c98b81889 100644 --- a/examples/common/imgui_ui/windows/light.h +++ b/examples/common/imgui_ui/windows/light.h @@ -62,7 +62,8 @@ class Light : public Window uint16_t mLevelRemainingTime10sOfSec = 0; // Color control - uint8_t mColorMode = kColorModeCurrentHueAndCurrentSaturation; + chip::app::Clusters::ColorControl::ColorModeEnum mColorMode = + chip::app::Clusters::ColorControl::ColorModeEnum::kCurrentHueAndCurrentSaturation; uint8_t mColorHue = 0; uint8_t mColorSaturation = 0; uint16_t mColorX = 0; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 8cd9c653a75bb5..3909b6073c8b9c 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -2502,65 +2502,62 @@ provisional cluster ScenesManagement = 98 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2571,16 +2568,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2612,13 +2620,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2632,150 +2640,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index 6924e96503d0c6..c93a50bb03e2dc 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -2558,65 +2558,62 @@ provisional cluster ScenesManagement = 98 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2627,16 +2624,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2668,13 +2676,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2688,150 +2696,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter index 331f7e79cadfe9..30f4d63c6a4e1e 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter @@ -1855,65 +1855,62 @@ cluster UserLabel = 65 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -1924,16 +1921,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -1965,13 +1973,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -1985,150 +1993,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter index f6bb26ec689619..2abf5c7251711d 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter @@ -1979,65 +1979,62 @@ cluster UserLabel = 65 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2048,16 +2045,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2089,13 +2097,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2109,150 +2117,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter index 9dee0bdcdb040d..b9dfeee6321680 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter @@ -1890,65 +1890,62 @@ cluster UserLabel = 65 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -1959,16 +1956,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2000,13 +2008,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2020,150 +2028,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 5ddd7071470692..df7f0dfe4d9a55 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -2310,65 +2310,62 @@ provisional cluster ScenesManagement = 98 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2379,16 +2376,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2420,13 +2428,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2440,150 +2448,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index 6add567a134707..35e00056736443 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -1918,65 +1918,62 @@ cluster UserLabel = 65 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -1987,16 +1984,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2028,13 +2036,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2048,150 +2056,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index d0e06e94f94dac..f4c2928a35778e 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -2014,65 +2014,62 @@ provisional cluster ScenesManagement = 98 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2083,16 +2080,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2124,13 +2132,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2144,150 +2152,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index a9d48f8ae85b3c..59919ee6b48737 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -2305,65 +2305,62 @@ provisional cluster ScenesManagement = 98 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -2374,16 +2371,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -2415,13 +2423,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -2435,150 +2443,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/lighting-app/tizen/src/DBusInterface.cpp b/examples/lighting-app/tizen/src/DBusInterface.cpp index 50dbd37930b47f..36c0f19c35bb7a 100644 --- a/examples/lighting-app/tizen/src/DBusInterface.cpp +++ b/examples/lighting-app/tizen/src/DBusInterface.cpp @@ -217,11 +217,11 @@ void DBusInterface::InitOnOff() void DBusInterface::InitColor() { { - uint8_t value = 0; - auto status = Clusters::ColorControl::Attributes::ColorMode::Get(mEndpointId, &value); + auto value = Clusters::ColorControl::ColorModeEnum::kCurrentHueAndCurrentSaturation; + auto status = Clusters::ColorControl::Attributes::ColorMode::Get(mEndpointId, &value); VerifyOrReturn(status == Protocols::InteractionModel::Status::Success, ChipLogError(NotSpecified, "Error getting ColorMode: 0x%x", to_underlying(status))); - light_app_color_control_set_color_mode(mIfaceColorControl, value); + light_app_color_control_set_color_mode(mIfaceColorControl, to_underlying(value)); } { uint16_t value = 0; diff --git a/examples/lighting-app/tizen/src/main.cpp b/examples/lighting-app/tizen/src/main.cpp index c1cda62a2378d5..040a8a5fcb231f 100644 --- a/examples/lighting-app/tizen/src/main.cpp +++ b/examples/lighting-app/tizen/src/main.cpp @@ -123,7 +123,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & void emberAfColorControlClusterInitCallback(EndpointId endpoint) { // Set the color mode to color temperature. - Clusters::ColorControl::Attributes::ColorMode::Set(endpoint, ColorControlServer::EnhancedColorMode::kColorTemperature); + Clusters::ColorControl::Attributes::ColorMode::Set(endpoint, Clusters::ColorControl::ColorModeEnum::kColorTemperatureMireds); // Preserve the state of the color temperature attribute across reboots. Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::SetNull(endpoint); } diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index b72a4b280351b9..8befb87daa5f9a 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -5872,65 +5872,62 @@ cluster ThermostatUserInterfaceConfiguration = 516 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -5941,16 +5938,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -5982,13 +5990,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -6002,150 +6010,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ @@ -6192,65 +6200,62 @@ cluster ColorControl = 768 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -6261,16 +6266,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -6302,13 +6318,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -6322,150 +6338,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 41421c7e917d0e..6cfcc1ab7ea6cf 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -5829,65 +5829,62 @@ cluster ThermostatUserInterfaceConfiguration = 516 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -5898,16 +5895,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -5939,13 +5947,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -5959,150 +5967,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ @@ -6149,65 +6157,62 @@ cluster ColorControl = 768 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -6218,16 +6223,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -6259,13 +6275,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -6279,150 +6295,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index 135846fd606d48..3c20256117f2cb 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -3161,65 +3161,62 @@ cluster WindowCovering = 258 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -3230,16 +3227,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -3271,13 +3279,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -3291,150 +3299,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 4a4fc69b4efe07..406d06f4b1e794 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -35,31 +36,6 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::ColorControl; using chip::Protocols::InteractionModel::Status; -// These constants are NOT currently spec compliant -// These should be changed once we have real specification enumeration -// names. -namespace chip { -namespace app { -namespace Clusters { -namespace ColorControl { - -namespace EnhancedColorMode { -constexpr uint8_t kCurrentHueAndCurrentSaturation = ColorControlServer::EnhancedColorMode::kCurrentHueAndCurrentSaturation; -constexpr uint8_t kCurrentXAndCurrentY = ColorControlServer::EnhancedColorMode::kCurrentXAndCurrentY; -constexpr uint8_t kColorTemperature = ColorControlServer::EnhancedColorMode::kColorTemperature; -constexpr uint8_t kEnhancedCurrentHueAndCurrentSaturation = - ColorControlServer::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation; -} // namespace EnhancedColorMode - -namespace Options { -constexpr uint8_t kExecuteIfOff = 1; -} // namespace Options - -} // namespace ColorControl -} // namespace Clusters -} // namespace app -} // namespace chip - #if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { @@ -174,12 +150,12 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl AddAttributeValuePair(pairs, Attributes::ColorTemperatureMireds::Id, temperatureValue, attributeCount); } - uint8_t modeValue; + EnhancedColorMode modeValue; if (Status::Success != Attributes::EnhancedColorMode::Get(endpoint, &modeValue)) { - modeValue = ColorControl::EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec + modeValue = EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec } - AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, modeValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, to_underlying(modeValue), attributeCount); app::DataModel::List attributeValueList(pairs, attributeCount); @@ -226,7 +202,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl #endif // Initialize action attributes to default values in case they are not in the scene - uint8_t targetColorMode = 0x00; + auto targetColorMode = EnhancedColorModeEnum::kCurrentHueAndCurrentSaturation; uint8_t loopActiveValue = 0x00; uint8_t loopDirectionValue = 0x00; uint16_t loopTimeValue = 0x0019; // Default loop time value according to spec @@ -238,7 +214,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl switch (decodePair.attributeID) { case Attributes::CurrentX::Id: - if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) + if (SupportsColorMode(endpoint, EnhancedColorMode::kCurrentXAndCurrentY)) { VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorXTransitionState->finalValue = @@ -246,7 +222,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } break; case Attributes::CurrentY::Id: - if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) + if (SupportsColorMode(endpoint, EnhancedColorMode::kCurrentXAndCurrentY)) { VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorYTransitionState->finalValue = @@ -254,14 +230,14 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } break; case Attributes::EnhancedCurrentHue::Id: - if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) + if (SupportsColorMode(endpoint, EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorHueTransitionState->finalEnhancedHue = decodePair.valueUnsigned16.Value(); } break; case Attributes::CurrentSaturation::Id: - if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation)) + if (SupportsColorMode(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation)) { VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorSaturationTransitionState->finalValue = std::min(static_cast(decodePair.valueUnsigned8.Value()), @@ -281,7 +257,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl loopTimeValue = decodePair.valueUnsigned16.Value(); break; case Attributes::ColorTemperatureMireds::Id: - if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kColorTemperature)) + if (SupportsColorMode(endpoint, EnhancedColorMode::kColorTemperatureMireds)) { VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorTempTransitionState->finalValue = @@ -290,10 +266,9 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl break; case Attributes::EnhancedColorMode::Id: VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); - if (decodePair.valueUnsigned8.Value() <= - static_cast(ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) + if (decodePair.valueUnsigned8.Value() <= to_underlying(EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { - targetColorMode = decodePair.valueUnsigned8.Value(); + targetColorMode = static_cast(decodePair.valueUnsigned8.Value()); } break; default: @@ -328,25 +303,25 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl // Execute movement to value depending on the mode in the saved scene switch (targetColorMode) { - case ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation: + case EnhancedColorMode::kCurrentHueAndCurrentSaturation: #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV ColorControlServer::Instance().moveToSaturation(static_cast(colorSaturationTransitionState->finalValue), transitionTime10th, endpoint); #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV break; - case ColorControl::EnhancedColorMode::kCurrentXAndCurrentY: + case EnhancedColorMode::kCurrentXAndCurrentY: #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY ColorControlServer::Instance().moveToColor(colorXTransitionState->finalValue, colorYTransitionState->finalValue, transitionTime10th, endpoint); #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY break; - case ColorControl::EnhancedColorMode::kColorTemperature: + case EnhancedColorMode::kColorTemperatureMireds: #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP ColorControlServer::Instance().moveToColorTemp( endpoint, static_cast(colorTempTransitionState->finalValue), transitionTime10th); #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP break; - case ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation: + case EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation: #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV ColorControlServer::Instance().moveToHueAndSaturation( colorHueTransitionState->finalEnhancedHue, static_cast(colorSaturationTransitionState->finalValue), @@ -361,20 +336,20 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } private: - bool SupportsColorMode(EndpointId endpoint, uint8_t mode) + bool SupportsColorMode(EndpointId endpoint, EnhancedColorMode mode) { switch (mode) { - case ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation: + case EnhancedColorMode::kCurrentHueAndCurrentSaturation: return ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kHueAndSaturation); break; - case ColorControl::EnhancedColorMode::kCurrentXAndCurrentY: + case EnhancedColorMode::kCurrentXAndCurrentY: return ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kXy); break; - case ColorControl::EnhancedColorMode::kColorTemperature: + case EnhancedColorMode::kColorTemperatureMireds: return ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorTemperature); break; - case ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation: + case EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation: return ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kEnhancedHue); break; default: @@ -494,7 +469,7 @@ Status ColorControlServer::stopAllColorTransitions(EndpointId endpoint) } bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - uint8_t optionsMask, uint8_t optionsOverride) + BitMask optionsMask, BitMask optionsOverride) { EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; @@ -534,7 +509,8 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c return true; } -bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride) +bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, BitMask optionMask, + BitMask optionOverride) { // From 5.2.2.2.1.10 of ZCL7 document 14-0129-15f-zcl-ch-5-lighting.docx: // "Command execution SHALL NOT continue beyond the Options processing if @@ -549,7 +525,7 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionM return true; } - uint8_t options = 0x00; + BitMask options = 0x00; Attributes::Options::Get(endpoint, &options); bool on = true; @@ -576,23 +552,23 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionM // ---------- The following order is important in decision making ------- // -----------more readable ---------- // - if (optionMask == 0xFF && optionOverride == 0xFF) + if (optionMask == static_cast(0xFF) && optionOverride == static_cast(0xFF)) { // 0xFF are the default values passed to the command handler when // the payload is not present - in that case there is use of option // attribute to decide execution of the command - return READBITS(options, ColorControl::Options::kExecuteIfOff); + return options.Has(OptionsBitmap::kExecuteIfOff); } // ---------- The above is to distinguish if the payload is present or not - if (READBITS(optionMask, ColorControl::Options::kExecuteIfOff)) + if (optionMask.Has(OptionsBitmap::kExecuteIfOff)) { // Mask is present and set in the command payload, this indicates // use the override as temporary option - return READBITS(optionOverride, ColorControl::Options::kExecuteIfOff); + return optionOverride.Has(OptionsBitmap::kExecuteIfOff); } - // if we are here - use the option attribute bits - return (READBITS(options, ColorControl::Options::kExecuteIfOff)); + // if we are here - use the option bits + return options.Has(OptionsBitmap::kExecuteIfOff); } /** @@ -606,28 +582,28 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionM * @param endpoint * @param newColorMode */ -void ColorControlServer::handleModeSwitch(EndpointId endpoint, uint8_t newColorMode) +void ColorControlServer::handleModeSwitch(EndpointId endpoint, EnhancedColorModeEnum newColorMode) { - uint8_t oldColorMode = 0; + auto oldColorMode = ColorModeEnum::kCurrentHueAndCurrentSaturation; Attributes::ColorMode::Get(endpoint, &oldColorMode); uint8_t colorModeTransition; - if (oldColorMode == newColorMode) + if (static_cast(oldColorMode) == newColorMode) { return; } Attributes::EnhancedColorMode::Set(endpoint, newColorMode); - if (newColorMode == ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation) + if (newColorMode == EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation) { - // Transpose COLOR_MODE_EHSV to ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation after setting + // Transpose COLOR_MODE_EHSV to EnhancedColorMode::kCurrentHueAndCurrentSaturation after setting // EnhancedColorMode - newColorMode = ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation; + newColorMode = EnhancedColorMode::kCurrentHueAndCurrentSaturation; } - Attributes::ColorMode::Set(endpoint, newColorMode); + Attributes::ColorMode::Set(endpoint, static_cast(newColorMode)); - colorModeTransition = static_cast((newColorMode << 4) + oldColorMode); + colorModeTransition = static_cast((to_underlying(newColorMode) << 4) + to_underlying(oldColorMode)); // Note: It may be OK to not do anything here. switch (colorModeTransition) @@ -1044,7 +1020,7 @@ void ColorControlServer::startColorLoop(EndpointId endpoint, uint8_t startFromSt colorHueTransitionState->initialEnhancedHue = startHue; - if (direction == to_underlying(ColorLoopDirection::kIncrementHue)) + if (direction == to_underlying(ColorLoopDirectionEnum::kIncrement)) { colorHueTransitionState->finalEnhancedHue = static_cast(startHue - 1); } @@ -1053,7 +1029,7 @@ void ColorControlServer::startColorLoop(EndpointId endpoint, uint8_t startFromSt colorHueTransitionState->finalEnhancedHue = static_cast(startHue + 1); } - colorHueTransitionState->up = (direction == to_underlying(ColorLoopDirection::kIncrementHue)); + colorHueTransitionState->up = (direction == to_underlying(ColorLoopDirectionEnum::kIncrement)); colorHueTransitionState->repeat = true; colorHueTransitionState->stepsRemaining = static_cast(time * TRANSITION_STEPS_PER_1S); @@ -1297,7 +1273,7 @@ Status ColorControlServer::moveToSaturation(uint8_t saturation, uint16_t transit stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); // now, kick off the state machine. initSaturationTransitionState(endpoint, colorSaturationTransitionState); @@ -1421,8 +1397,8 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati * @return false Failed */ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - HueMoveMode moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride, - bool isEnhanced) + HueMoveMode moveMode, uint16_t rate, BitMask optionsMask, + BitMask optionsOverride, bool isEnhanced) { MATTER_TRACE_SCOPE("moveHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; @@ -1464,11 +1440,11 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const // Handle color mode transition, if necessary. if (isEnhanced) { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); } else { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); } if (moveMode == HueMoveMode::kUp) @@ -1531,15 +1507,16 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const * @return false Failed */ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - uint16_t hue, HueDirection moveDirection, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, bool isEnhanced) + uint16_t hue, DirectionEnum moveDirection, uint16_t transitionTime, + BitMask optionsMask, BitMask optionsOverride, + bool isEnhanced) { MATTER_TRACE_SCOPE("moveToHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; uint16_t currentHue = 0; - HueDirection direction; + DirectionEnum direction; ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); @@ -1568,33 +1545,33 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons // Convert the ShortestDistance/LongestDistance moveDirection values into Up/Down. switch (moveDirection) { - case HueDirection::kShortestDistance: + case DirectionEnum::kShortest: if ((isEnhanced && (static_cast(currentHue - hue) > HALF_MAX_UINT16T)) || (!isEnhanced && (static_cast(currentHue - hue) > HALF_MAX_UINT8T))) { - direction = HueDirection::kUp; + direction = DirectionEnum::kUp; } else { - direction = HueDirection::kDown; + direction = DirectionEnum::kDown; } break; - case HueDirection::kLongestDistance: + case DirectionEnum::kLongest: if ((isEnhanced && (static_cast(currentHue - hue) > HALF_MAX_UINT16T)) || (!isEnhanced && (static_cast(currentHue - hue) > HALF_MAX_UINT8T))) { - direction = HueDirection::kDown; + direction = DirectionEnum::kDown; } else { - direction = HueDirection::kUp; + direction = DirectionEnum::kUp; } break; - case HueDirection::kUp: - case HueDirection::kDown: + case DirectionEnum::kUp: + case DirectionEnum::kDown: direction = moveDirection; break; - case HueDirection::kUnknownEnumValue: + case DirectionEnum::kUnknownEnumValue: commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; /* No default case, so if a new direction value gets added we will just fail @@ -1613,11 +1590,11 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons // Handle color mode transition, if necessary. if (isEnhanced) { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); } else { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); } // now, kick off the state machine. @@ -1637,7 +1614,7 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons colorHueTransitionState->timeRemaining = transitionTime; colorHueTransitionState->transitionTime = transitionTime; colorHueTransitionState->endpoint = endpoint; - colorHueTransitionState->up = (direction == HueDirection::kUp); + colorHueTransitionState->up = (direction == DirectionEnum::kUp); colorHueTransitionState->repeat = false; SetHSVRemainingTime(endpoint); @@ -1667,8 +1644,9 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons */ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, uint16_t hue, - uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, bool isEnhanced) + uint8_t saturation, uint16_t transitionTime, + BitMask optionsMask, BitMask optionsOverride, + bool isEnhanced) { MATTER_TRACE_SCOPE("moveToHueAndSaturation", "ColorControl"); // limit checking: hue and saturation are 0..254. Spec dictates we ignore @@ -1707,8 +1685,8 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com * @return false Failed */ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, - HueStepMode stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, bool isEnhanced) + HueStepMode stepMode, uint16_t stepSize, uint16_t transitionTime, + BitMask optionsMask, BitMask optionsOverride, bool isEnhanced) { MATTER_TRACE_SCOPE("stepHue", "ColorControl"); EndpointId endpoint = commandPath.mEndpointId; @@ -1737,11 +1715,11 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const // Handle color mode transition, if necessary. if (isEnhanced) { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation); } else { - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); } // now, kick off the state machine. @@ -1839,7 +1817,7 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); if (moveMode == SaturationMoveMode::kUp) { @@ -1908,14 +1886,14 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, const Commands::StepSaturation::DecodableType & commandData) { MATTER_TRACE_SCOPE("stepSaturation", "ColorControl"); - auto stepMode = commandData.stepMode; - uint8_t stepSize = commandData.stepSize; - uint8_t transitionTime = commandData.transitionTime; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; - uint8_t currentSaturation = 0; + auto stepMode = commandData.stepMode; + uint8_t stepSize = commandData.stepSize; + uint8_t transitionTime = commandData.transitionTime; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; + uint8_t currentSaturation = 0; Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); VerifyOrExit(colorSaturationTransitionState != nullptr, status = Status::UnsupportedEndpoint); @@ -1937,7 +1915,7 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentHueAndCurrentSaturation); // now, kick off the state machine. initSaturationTransitionState(endpoint, colorSaturationTransitionState); @@ -1973,24 +1951,24 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons const Commands::ColorLoopSet::DecodableType & commandData) { MATTER_TRACE_SCOPE("colorLoop", "ColorControl"); - auto updateFlags = commandData.updateFlags; - auto action = commandData.action; - auto direction = commandData.direction; - uint16_t time = commandData.time; - uint16_t startHue = commandData.startHue; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; - uint8_t isColorLoopActive = 0; - uint8_t deactiveColorLoop = 0; + auto updateFlags = commandData.updateFlags; + auto action = commandData.action; + auto direction = commandData.direction; + uint16_t time = commandData.time; + uint16_t startHue = commandData.startHue; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; + uint8_t isColorLoopActive = 0; + uint8_t deactiveColorLoop = 0; uint16_t epIndex = getEndpointIndex(endpoint); ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionStateByIndex(epIndex); VerifyOrExit(colorHueTransitionState != nullptr, status = Status::UnsupportedEndpoint); // Validate the action and direction parameters of the command - if (action == ColorLoopAction::kUnknownEnumValue || direction == ColorLoopDirection::kUnknownEnumValue) + if (action == ColorLoopActionEnum::kUnknownEnumValue || direction == ColorLoopDirectionEnum::kUnknownEnumValue) { commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; @@ -2017,10 +1995,10 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons // Checks if color loop is active and stays active if (isColorLoopActive && !deactiveColorLoop) { - colorHueTransitionState->up = (direction == ColorLoopDirection::kIncrementHue); + colorHueTransitionState->up = (direction == ColorLoopDirectionEnum::kIncrement); colorHueTransitionState->initialEnhancedHue = colorHueTransitionState->currentEnhancedHue; - if (direction == ColorLoopDirection::kIncrementHue) + if (direction == ColorLoopDirectionEnum::kIncrement) { colorHueTransitionState->finalEnhancedHue = static_cast(colorHueTransitionState->initialEnhancedHue - 1); } @@ -2346,12 +2324,12 @@ bool ColorControlServer::moveToColorCommand(app::CommandHandler * commandObj, co bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveColor::DecodableType & commandData) { - int16_t rateX = commandData.rateX; - int16_t rateY = commandData.rateY; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; + int16_t rateX = commandData.rateX; + int16_t rateY = commandData.rateY; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; uint16_t epIndex = getEndpointIndex(endpoint); Color16uTransitionState * colorXTransitionState = getXTransitionStateByIndex(epIndex); @@ -2380,7 +2358,7 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentXAndCurrentY); // now, kick off the state machine. Attributes::CurrentX::Get(endpoint, &(colorXTransitionState->initialValue)); @@ -2438,16 +2416,16 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StepColor::DecodableType & commandData) { - int16_t stepX = commandData.stepX; - int16_t stepY = commandData.stepY; - uint16_t transitionTime = commandData.transitionTime; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - uint16_t currentColorX = 0; - uint16_t currentColorY = 0; - uint16_t colorX = 0; - uint16_t colorY = 0; + int16_t stepX = commandData.stepX; + int16_t stepY = commandData.stepY; + uint16_t transitionTime = commandData.transitionTime; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + uint16_t currentColorX = 0; + uint16_t currentColorY = 0; + uint16_t colorX = 0; + uint16_t colorY = 0; Status status = Status::Success; @@ -2480,7 +2458,7 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY); + handleModeSwitch(endpoint, EnhancedColorMode::kCurrentXAndCurrentY); // now, kick off the state machine. colorXTransitionState->initialValue = currentColorX; @@ -2615,7 +2593,7 @@ Status ColorControlServer::moveToColorTemp(EndpointId aEndpoint, uint16_t colorT stopAllColorTransitions(endpoint); // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kColorTemperature); + handleModeSwitch(endpoint, EnhancedColorMode::kColorTemperatureMireds); if (colorTemperature < temperatureMin) { @@ -2724,11 +2702,10 @@ void ColorControlServer::startUpColorTempCommand(EndpointId endpoint) if (status == Status::Success) { // Set ColorMode attributes to reflect ColorTemperature. - uint8_t updateColorMode = ColorControl::EnhancedColorMode::kColorTemperature; + auto updateColorMode = ColorModeEnum::kColorTemperatureMireds; Attributes::ColorMode::Set(endpoint, updateColorMode); - updateColorMode = ColorControl::EnhancedColorMode::kColorTemperature; - Attributes::EnhancedColorMode::Set(endpoint, updateColorMode); + Attributes::EnhancedColorMode::Set(endpoint, static_cast(updateColorMode)); } } } @@ -2798,16 +2775,16 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint) bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::MoveColorTemperature::DecodableType & commandData) { - auto moveMode = commandData.moveMode; - uint16_t rate = commandData.rate; - uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds; - uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; - uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; - uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE; + auto moveMode = commandData.moveMode; + uint16_t rate = commandData.rate; + uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds; + uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; + uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; + uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE; uint16_t transitionTime; Color16uTransitionState * colorTempTransitionState = getTempTransitionState(endpoint); @@ -2854,7 +2831,7 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kColorTemperature); + handleModeSwitch(endpoint, EnhancedColorMode::kColorTemperatureMireds); // now, kick off the state machine. colorTempTransitionState->initialValue = 0; @@ -2922,17 +2899,17 @@ bool ColorControlServer::moveToColorTempCommand(app::CommandHandler * commandObj bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::StepColorTemperature::DecodableType & commandData) { - auto stepMode = commandData.stepMode; - uint16_t stepSize = commandData.stepSize; - uint16_t transitionTime = commandData.transitionTime; - uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds; - uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds; - uint8_t optionsMask = commandData.optionsMask; - uint8_t optionsOverride = commandData.optionsOverride; - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; - uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; - uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE; + auto stepMode = commandData.stepMode; + uint16_t stepSize = commandData.stepSize; + uint16_t transitionTime = commandData.transitionTime; + uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds; + uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds; + BitMask optionsMask = commandData.optionsMask; + BitMask optionsOverride = commandData.optionsOverride; + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; + uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE; + uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE; Color16uTransitionState * colorTempTransitionState = getTempTransitionState(endpoint); VerifyOrExit(colorTempTransitionState != nullptr, status = Status::UnsupportedEndpoint); @@ -2971,7 +2948,7 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, } // Handle color mode transition, if necessary. - handleModeSwitch(endpoint, ColorControl::EnhancedColorMode::kColorTemperature); + handleModeSwitch(endpoint, EnhancedColorMode::kColorTemperatureMireds); // now, kick off the state machine. colorTempTransitionState->initialValue = 0; @@ -3058,10 +3035,10 @@ void ColorControlServer::levelControlColorTempChangeCommand(EndpointId endpoint) return; } - uint8_t colorMode = 0; + auto colorMode = ColorModeEnum::kCurrentHueAndCurrentSaturation; Attributes::ColorMode::Get(endpoint, &colorMode); - if (colorMode == ColorControl::EnhancedColorMode::kColorTemperature) + if (static_cast(colorMode) == EnhancedColorMode::kColorTemperatureMireds) { app::DataModel::Nullable currentLevel; Status status = LevelControl::Attributes::CurrentLevel::Get(endpoint, currentLevel); diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index 4238fed1dd8b2d..1ed9e33c403538 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -71,18 +71,10 @@ class ColorControlServer /********************************************************** * Enums *********************************************************/ - using HueStepMode = chip::app::Clusters::ColorControl::HueStepMode; - using HueMoveMode = chip::app::Clusters::ColorControl::HueMoveMode; - using HueDirection = chip::app::Clusters::ColorControl::HueDirection; - using Feature = chip::app::Clusters::ColorControl::Feature; - - enum EnhancedColorMode : uint8_t - { - kCurrentHueAndCurrentSaturation = 0, - kCurrentXAndCurrentY = 1, - kColorTemperature = 2, - kEnhancedCurrentHueAndCurrentSaturation = 3, - }; + using StepModeEnum = chip::app::Clusters::ColorControl::StepModeEnum; + using MoveModeEnum = chip::app::Clusters::ColorControl::MoveModeEnum; + using DirectionEnum = chip::app::Clusters::ColorControl::DirectionEnum; + using Feature = chip::app::Clusters::ColorControl::Feature; enum Conversion { @@ -150,20 +142,27 @@ class ColorControlServer bool HasFeature(chip::EndpointId endpoint, Feature feature); chip::Protocols::InteractionModel::Status stopAllColorTransitions(chip::EndpointId endpoint); bool stopMoveStepCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - uint8_t optionsMask, uint8_t optionsOverride); + chip::BitMask optionsMask, + chip::BitMask optionsOverride); #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV bool moveHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - HueMoveMode moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced); + MoveModeEnum moveMode, uint16_t rate, + chip::BitMask optionsMask, + chip::BitMask optionsOverride, bool isEnhanced); bool moveToHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, uint16_t hue, - HueDirection moveDirection, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride, - bool isEnhanced); + DirectionEnum moveDirection, uint16_t transitionTime, + chip::BitMask optionsMask, + chip::BitMask optionsOverride, bool isEnhanced); bool moveToHueAndSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - uint16_t hue, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, bool isEnhanced); + uint16_t hue, uint8_t saturation, uint16_t transitionTime, + chip::BitMask optionsMask, + chip::BitMask optionsOverride, + bool isEnhanced); bool stepHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - HueStepMode stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask, - uint8_t optionsOverride, bool isEnhanced); + StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, + chip::BitMask optionsMask, + chip::BitMask optionsOverride, bool isEnhanced); bool moveSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ColorControl::Commands::MoveSaturation::DecodableType & commandData); bool moveToSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, @@ -224,8 +223,9 @@ class ColorControlServer } } - bool shouldExecuteIfOff(chip::EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride); - void handleModeSwitch(chip::EndpointId endpoint, uint8_t newColorMode); + bool shouldExecuteIfOff(chip::EndpointId endpoint, chip::BitMask optionMask, + chip::BitMask optionOverride); + void handleModeSwitch(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum newColorMode); uint16_t computeTransitionTimeFromStateAndRate(Color16uTransitionState * p, uint16_t rate); EmberEventControl * getEventControl(chip::EndpointId endpoint); void computePwmFromHsv(chip::EndpointId endpoint); diff --git a/src/app/common/CompatEnumNames.h b/src/app/common/CompatEnumNames.h index ceb91c1981d203..a3154cbb682975 100644 --- a/src/app/common/CompatEnumNames.h +++ b/src/app/common/CompatEnumNames.h @@ -21,6 +21,8 @@ */ #pragma once +#include + namespace chip { namespace app { namespace Clusters { @@ -80,6 +82,50 @@ using StepMode = StepModeEnum; using LevelControlOptions = OptionsBitmap; } // namespace LevelControl +namespace ColorControl { +// https://github.com/project-chip/connectedhomeip/pull/33612 renamed this +enum class ColorMode : uint8_t +{ + kCurrentHueAndCurrentSaturation = to_underlying(ColorModeEnum::kCurrentHueAndCurrentSaturation), + kCurrentXAndCurrentY = to_underlying(ColorModeEnum::kCurrentXAndCurrentY), + kColorTemperature = to_underlying(ColorModeEnum::kColorTemperatureMireds), + kUnknownEnumValue = to_underlying(ColorModeEnum::kUnknownEnumValue) +}; + +enum class HueDirection : uint8_t +{ + ShortestDistance = to_underlying(DirectionEnum::kShortest), + LongestDistance = to_underlying(DirectionEnum::kLongest), + Up = to_underlying(DirectionEnum::kUp), + Down = to_underlying(DirectionEnum::kDown), + kUnknownEnumValue = to_underlying(DirectionEnum::kUnknownEnumValue) +}; + +enum class ColorCapabilities : uint16_t +{ + ColorLoopSupported = to_underlying(ColorCapabilitiesBitmap::kColorLoop), + ColorTemperatureSupported = to_underlying(ColorCapabilitiesBitmap::kColorTemperature), + EnhancedHueSupported = to_underlying(ColorCapabilitiesBitmap::kEnhancedHue), + HueSaturationSupported = to_underlying(ColorCapabilitiesBitmap::kHueSaturation), + XYAttributesSupported = to_underlying(ColorCapabilitiesBitmap::kXy) +}; + +enum class ColorLoopDirection : uint8_t +{ + DecrementHue = to_underlying(ColorLoopDirectionEnum::kDecrement), + IncrementHue = to_underlying(ColorLoopDirectionEnum::kIncrement), + kUnknownEnumValue = to_underlying(ColorLoopDirectionEnum::kUnknownEnumValue) +}; + +using EnhancedColorMode = EnhancedColorModeEnum; +using ColorLoopUpdateFlags = UpdateFlagsBitmap; +using ColorLoopAction = ColorLoopActionEnum; +using HueMoveMode = MoveModeEnum; +using HueStepMode = StepModeEnum; +using SaturationMoveMode = MoveModeEnum; +using SaturationStepMode = StepModeEnum; +} // namespace ColorControl + namespace RefrigeratorAlarm { // https://github.com/project-chip/connectedhomeip/pull/31517 renamed this using AlarmMap = AlarmBitmap; diff --git a/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml index c97d4a59baa00b..f72140e712a703 100644 --- a/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml @@ -17,57 +17,44 @@ limitations under the License. - + - - + + - + - + - - - - - - - - - - - - - - + - + - + - - - - - + + + + + - + @@ -75,17 +62,39 @@ limitations under the License. - + - + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -128,15 +137,15 @@ limitations under the License. CurrentY - DriftCompensation + DriftCompensation CompensationText ColorTemperatureMireds - ColorMode + ColorMode - Options + Options NumberOfPrimaries @@ -254,31 +263,31 @@ limitations under the License. Move to specified hue. - + - - + + Move hue up or down at specified rate. - + - - + + Step hue up or down by specified size at specified rate. - + - - + + @@ -287,29 +296,29 @@ limitations under the License. - - + + Move saturation up or down at specified rate. - + - - + + Step saturation up or down by specified size at specified rate. - + - - + + @@ -319,8 +328,8 @@ limitations under the License. - - + + @@ -330,8 +339,8 @@ limitations under the License. - - + + @@ -340,8 +349,8 @@ limitations under the License. - - + + @@ -351,8 +360,8 @@ limitations under the License. - - + + @@ -361,20 +370,20 @@ limitations under the License. - - + + EnhancedCurrentHue - EnhancedColorMode - ColorLoopActive - ColorLoopDirection + EnhancedColorMode + ColorLoopActive + ColorLoopDirection ColorLoopTime ColorLoopStartEnhancedHue ColorLoopStoredEnhancedHue - ColorCapabilities + ColorCapabilities ColorTempPhysicalMinMireds ColorTempPhysicalMaxMireds @@ -383,31 +392,31 @@ limitations under the License. Command description for EnhancedMoveToHue - + - - + + Command description for EnhancedMoveHue - + - - + + Command description for EnhancedStepHue - + - - + + @@ -417,54 +426,54 @@ limitations under the License. - - + + Command description for ColorLoopSet - - - + + + - - + + Command description for StopMoveStep - - + + Command description for MoveColorTemperature - + - - + + Command description for StepColorTemperature - + - - + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 02408e1ecf74b0..bfb1354849c9c4 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -7145,65 +7145,62 @@ cluster ThermostatUserInterfaceConfiguration = 516 { cluster ColorControl = 768 { revision 7; - enum ColorLoopAction : enum8 { + enum ColorLoopActionEnum : enum8 { kDeactivate = 0; kActivateFromColorLoopStartEnhancedHue = 1; kActivateFromEnhancedCurrentHue = 2; } - enum ColorLoopDirection : enum8 { - kDecrementHue = 0; - kIncrementHue = 1; + enum ColorLoopDirectionEnum : enum8 { + kDecrement = 0; + kIncrement = 1; } - enum ColorMode : enum8 { + enum ColorModeEnum : enum8 { kCurrentHueAndCurrentSaturation = 0; kCurrentXAndCurrentY = 1; - kColorTemperature = 2; + kColorTemperatureMireds = 2; } - enum HueDirection : enum8 { - kShortestDistance = 0; - kLongestDistance = 1; + enum DirectionEnum : enum8 { + kShortest = 0; + kLongest = 1; kUp = 2; kDown = 3; } - enum HueMoveMode : enum8 { - kStop = 0; - kUp = 1; - kDown = 3; + enum DriftCompensationEnum : enum8 { + kNone = 0; + kOtherOrUnknown = 1; + kTemperatureMonitoring = 2; + kOpticalLuminanceMonitoringAndFeedback = 3; + kOpticalColorMonitoringAndFeedback = 4; } - enum HueStepMode : enum8 { - kUp = 1; - kDown = 3; + enum EnhancedColorModeEnum : enum8 { + kCurrentHueAndCurrentSaturation = 0; + kCurrentXAndCurrentY = 1; + kColorTemperatureMireds = 2; + kEnhancedCurrentHueAndCurrentSaturation = 3; } - enum SaturationMoveMode : enum8 { + enum MoveModeEnum : enum8 { kStop = 0; kUp = 1; kDown = 3; } - enum SaturationStepMode : enum8 { + enum StepModeEnum : enum8 { kUp = 1; kDown = 3; } - bitmap ColorCapabilities : bitmap16 { - kHueSaturationSupported = 0x1; - kEnhancedHueSupported = 0x2; - kColorLoopSupported = 0x4; - kXYAttributesSupported = 0x8; - kColorTemperatureSupported = 0x10; - } - - bitmap ColorLoopUpdateFlags : bitmap8 { - kUpdateAction = 0x1; - kUpdateDirection = 0x2; - kUpdateTime = 0x4; - kUpdateStartHue = 0x8; + bitmap ColorCapabilitiesBitmap : bitmap16 { + kHueSaturation = 0x1; + kEnhancedHue = 0x2; + kColorLoop = 0x4; + kXY = 0x8; + kColorTemperature = 0x10; } bitmap Feature : bitmap32 { @@ -7214,16 +7211,27 @@ cluster ColorControl = 768 { kColorTemperature = 0x10; } + bitmap OptionsBitmap : bitmap8 { + kExecuteIfOff = 0x1; + } + + bitmap UpdateFlagsBitmap : bitmap8 { + kUpdateAction = 0x1; + kUpdateDirection = 0x2; + kUpdateTime = 0x4; + kUpdateStartHue = 0x8; + } + readonly attribute optional int8u currentHue = 0; readonly attribute optional int8u currentSaturation = 1; readonly attribute optional int16u remainingTime = 2; readonly attribute optional int16u currentX = 3; readonly attribute optional int16u currentY = 4; - readonly attribute optional enum8 driftCompensation = 5; + readonly attribute optional DriftCompensationEnum driftCompensation = 5; readonly attribute optional char_string<254> compensationText = 6; readonly attribute optional int16u colorTemperatureMireds = 7; - readonly attribute enum8 colorMode = 8; - attribute bitmap8 options = 15; + readonly attribute ColorModeEnum colorMode = 8; + attribute OptionsBitmap options = 15; readonly attribute nullable int8u numberOfPrimaries = 16; readonly attribute optional int16u primary1X = 17; readonly attribute optional int16u primary1Y = 18; @@ -7255,13 +7263,13 @@ cluster ColorControl = 768 { attribute access(write: manage) optional int16u colorPointBY = 59; attribute access(write: manage) optional nullable int8u colorPointBIntensity = 60; readonly attribute optional int16u enhancedCurrentHue = 16384; - readonly attribute enum8 enhancedColorMode = 16385; + readonly attribute EnhancedColorModeEnum enhancedColorMode = 16385; readonly attribute optional int8u colorLoopActive = 16386; readonly attribute optional int8u colorLoopDirection = 16387; readonly attribute optional int16u colorLoopTime = 16388; readonly attribute optional int16u colorLoopStartEnhancedHue = 16389; readonly attribute optional int16u colorLoopStoredEnhancedHue = 16390; - readonly attribute bitmap16 colorCapabilities = 16394; + readonly attribute ColorCapabilitiesBitmap colorCapabilities = 16394; readonly attribute optional int16u colorTempPhysicalMinMireds = 16395; readonly attribute optional int16u colorTempPhysicalMaxMireds = 16396; readonly attribute optional int16u coupleColorTempToLevelMinMireds = 16397; @@ -7275,150 +7283,150 @@ cluster ColorControl = 768 { request struct MoveToHueRequest { int8u hue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToSaturationRequest { int8u saturation = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct MoveSaturationRequest { - SaturationMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int8u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepSaturationRequest { - SaturationStepMode stepMode = 0; + StepModeEnum stepMode = 0; int8u stepSize = 1; int8u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToHueAndSaturationRequest { int8u hue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorRequest { int16u colorX = 0; int16u colorY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveColorRequest { int16s rateX = 0; int16s rateY = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct StepColorRequest { int16s stepX = 0; int16s stepY = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct MoveToColorTemperatureRequest { int16u colorTemperatureMireds = 0; int16u transitionTime = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedMoveToHueRequest { int16u enhancedHue = 0; - HueDirection direction = 1; + DirectionEnum direction = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveHueRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; - bitmap8 optionsMask = 2; - bitmap8 optionsOverride = 3; + OptionsBitmap optionsMask = 2; + OptionsBitmap optionsOverride = 3; } request struct EnhancedStepHueRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct EnhancedMoveToHueAndSaturationRequest { int16u enhancedHue = 0; int8u saturation = 1; int16u transitionTime = 2; - bitmap8 optionsMask = 3; - bitmap8 optionsOverride = 4; + OptionsBitmap optionsMask = 3; + OptionsBitmap optionsOverride = 4; } request struct ColorLoopSetRequest { - ColorLoopUpdateFlags updateFlags = 0; - ColorLoopAction action = 1; - ColorLoopDirection direction = 2; + UpdateFlagsBitmap updateFlags = 0; + ColorLoopActionEnum action = 1; + ColorLoopDirectionEnum direction = 2; int16u time = 3; int16u startHue = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } request struct StopMoveStepRequest { - bitmap8 optionsMask = 0; - bitmap8 optionsOverride = 1; + OptionsBitmap optionsMask = 0; + OptionsBitmap optionsOverride = 1; } request struct MoveColorTemperatureRequest { - HueMoveMode moveMode = 0; + MoveModeEnum moveMode = 0; int16u rate = 1; int16u colorTemperatureMinimumMireds = 2; int16u colorTemperatureMaximumMireds = 3; - bitmap8 optionsMask = 4; - bitmap8 optionsOverride = 5; + OptionsBitmap optionsMask = 4; + OptionsBitmap optionsOverride = 5; } request struct StepColorTemperatureRequest { - HueStepMode stepMode = 0; + StepModeEnum stepMode = 0; int16u stepSize = 1; int16u transitionTime = 2; int16u colorTemperatureMinimumMireds = 3; int16u colorTemperatureMaximumMireds = 4; - bitmap8 optionsMask = 5; - bitmap8 optionsOverride = 6; + OptionsBitmap optionsMask = 5; + OptionsBitmap optionsOverride = 6; } /** Move to specified hue. */ diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 82a4a6fe42e669..db775e5d52e5c6 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -32152,7 +32152,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; @@ -32830,7 +32830,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index ed3c9154cc8c3a..6b8ecd1c82b577 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -34913,10 +34913,10 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="remainingTime", Tag=0x00000002, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="currentX", Tag=0x00000003, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="currentY", Tag=0x00000004, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="driftCompensation", Tag=0x00000005, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="driftCompensation", Tag=0x00000005, Type=typing.Optional[ColorControl.Enums.DriftCompensationEnum]), ClusterObjectFieldDescriptor(Label="compensationText", Tag=0x00000006, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="colorTemperatureMireds", Tag=0x00000007, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="colorMode", Tag=0x00000008, Type=uint), + ClusterObjectFieldDescriptor(Label="colorMode", Tag=0x00000008, Type=ColorControl.Enums.ColorModeEnum), ClusterObjectFieldDescriptor(Label="options", Tag=0x0000000F, Type=uint), ClusterObjectFieldDescriptor(Label="numberOfPrimaries", Tag=0x00000010, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="primary1X", Tag=0x00000011, Type=typing.Optional[uint]), @@ -34949,7 +34949,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="colorPointBY", Tag=0x0000003B, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="colorPointBIntensity", Tag=0x0000003C, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="enhancedCurrentHue", Tag=0x00004000, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="enhancedColorMode", Tag=0x00004001, Type=uint), + ClusterObjectFieldDescriptor(Label="enhancedColorMode", Tag=0x00004001, Type=ColorControl.Enums.EnhancedColorModeEnum), ClusterObjectFieldDescriptor(Label="colorLoopActive", Tag=0x00004002, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="colorLoopDirection", Tag=0x00004003, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="colorLoopTime", Tag=0x00004004, Type=typing.Optional[uint]), @@ -34973,10 +34973,10 @@ def descriptor(cls) -> ClusterObjectDescriptor: remainingTime: 'typing.Optional[uint]' = None currentX: 'typing.Optional[uint]' = None currentY: 'typing.Optional[uint]' = None - driftCompensation: 'typing.Optional[uint]' = None + driftCompensation: 'typing.Optional[ColorControl.Enums.DriftCompensationEnum]' = None compensationText: 'typing.Optional[str]' = None colorTemperatureMireds: 'typing.Optional[uint]' = None - colorMode: 'uint' = None + colorMode: 'ColorControl.Enums.ColorModeEnum' = None options: 'uint' = None numberOfPrimaries: 'typing.Union[Nullable, uint]' = None primary1X: 'typing.Optional[uint]' = None @@ -35009,7 +35009,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: colorPointBY: 'typing.Optional[uint]' = None colorPointBIntensity: 'typing.Union[None, Nullable, uint]' = None enhancedCurrentHue: 'typing.Optional[uint]' = None - enhancedColorMode: 'uint' = None + enhancedColorMode: 'ColorControl.Enums.EnhancedColorModeEnum' = None colorLoopActive: 'typing.Optional[uint]' = None colorLoopDirection: 'typing.Optional[uint]' = None colorLoopTime: 'typing.Optional[uint]' = None @@ -35028,7 +35028,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: clusterRevision: 'uint' = None class Enums: - class ColorLoopAction(MatterIntEnum): + class ColorLoopActionEnum(MatterIntEnum): kDeactivate = 0x00 kActivateFromColorLoopStartEnhancedHue = 0x01 kActivateFromEnhancedCurrentHue = 0x02 @@ -35038,28 +35038,28 @@ class ColorLoopAction(MatterIntEnum): # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, - class ColorLoopDirection(MatterIntEnum): - kDecrementHue = 0x00 - kIncrementHue = 0x01 + class ColorLoopDirectionEnum(MatterIntEnum): + kDecrement = 0x00 + kIncrement = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, - class ColorMode(MatterIntEnum): + class ColorModeEnum(MatterIntEnum): kCurrentHueAndCurrentSaturation = 0x00 kCurrentXAndCurrentY = 0x01 - kColorTemperature = 0x02 + kColorTemperatureMireds = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, - class HueDirection(MatterIntEnum): - kShortestDistance = 0x00 - kLongestDistance = 0x01 + class DirectionEnum(MatterIntEnum): + kShortest = 0x00 + kLongest = 0x01 kUp = 0x02 kDown = 0x03 # All received enum values that are not listed above will be mapped @@ -35068,26 +35068,30 @@ class HueDirection(MatterIntEnum): # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, - class HueMoveMode(MatterIntEnum): - kStop = 0x00 - kUp = 0x01 - kDown = 0x03 + class DriftCompensationEnum(MatterIntEnum): + kNone = 0x00 + kOtherOrUnknown = 0x01 + kTemperatureMonitoring = 0x02 + kOpticalLuminanceMonitoringAndFeedback = 0x03 + kOpticalColorMonitoringAndFeedback = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. - kUnknownEnumValue = 2, + kUnknownEnumValue = 5, - class HueStepMode(MatterIntEnum): - kUp = 0x01 - kDown = 0x03 + class EnhancedColorModeEnum(MatterIntEnum): + kCurrentHueAndCurrentSaturation = 0x00 + kCurrentXAndCurrentY = 0x01 + kColorTemperatureMireds = 0x02 + kEnhancedCurrentHueAndCurrentSaturation = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. - kUnknownEnumValue = 0, + kUnknownEnumValue = 4, - class SaturationMoveMode(MatterIntEnum): + class MoveModeEnum(MatterIntEnum): kStop = 0x00 kUp = 0x01 kDown = 0x03 @@ -35097,7 +35101,7 @@ class SaturationMoveMode(MatterIntEnum): # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, - class SaturationStepMode(MatterIntEnum): + class StepModeEnum(MatterIntEnum): kUp = 0x01 kDown = 0x03 # All received enum values that are not listed above will be mapped @@ -35107,18 +35111,12 @@ class SaturationStepMode(MatterIntEnum): kUnknownEnumValue = 0, class Bitmaps: - class ColorCapabilities(IntFlag): - kHueSaturationSupported = 0x1 - kEnhancedHueSupported = 0x2 - kColorLoopSupported = 0x4 - kXYAttributesSupported = 0x8 - kColorTemperatureSupported = 0x10 - - class ColorLoopUpdateFlags(IntFlag): - kUpdateAction = 0x1 - kUpdateDirection = 0x2 - kUpdateTime = 0x4 - kUpdateStartHue = 0x8 + class ColorCapabilitiesBitmap(IntFlag): + kHueSaturation = 0x1 + kEnhancedHue = 0x2 + kColorLoop = 0x4 + kXy = 0x8 + kColorTemperature = 0x10 class Feature(IntFlag): kHueAndSaturation = 0x1 @@ -35127,6 +35125,15 @@ class Feature(IntFlag): kXy = 0x8 kColorTemperature = 0x10 + class OptionsBitmap(IntFlag): + kExecuteIfOff = 0x1 + + class UpdateFlagsBitmap(IntFlag): + kUpdateAction = 0x1 + kUpdateDirection = 0x2 + kUpdateTime = 0x4 + kUpdateStartHue = 0x8 + class Commands: @dataclass class MoveToHue(ClusterCommand): @@ -35140,14 +35147,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="hue", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="direction", Tag=1, Type=ColorControl.Enums.HueDirection), + ClusterObjectFieldDescriptor(Label="direction", Tag=1, Type=ColorControl.Enums.DirectionEnum), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=4, Type=uint), ]) hue: 'uint' = 0 - direction: 'ColorControl.Enums.HueDirection' = 0 + direction: 'ColorControl.Enums.DirectionEnum' = 0 transitionTime: 'uint' = 0 optionsMask: 'uint' = 0 optionsOverride: 'uint' = 0 @@ -35163,13 +35170,13 @@ class MoveHue(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.HueMoveMode), + ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.MoveModeEnum), ClusterObjectFieldDescriptor(Label="rate", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=3, Type=uint), ]) - moveMode: 'ColorControl.Enums.HueMoveMode' = 0 + moveMode: 'ColorControl.Enums.MoveModeEnum' = 0 rate: 'uint' = 0 optionsMask: 'uint' = 0 optionsOverride: 'uint' = 0 @@ -35185,14 +35192,14 @@ class StepHue(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.HueStepMode), + ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.StepModeEnum), ClusterObjectFieldDescriptor(Label="stepSize", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=4, Type=uint), ]) - stepMode: 'ColorControl.Enums.HueStepMode' = 0 + stepMode: 'ColorControl.Enums.StepModeEnum' = 0 stepSize: 'uint' = 0 transitionTime: 'uint' = 0 optionsMask: 'uint' = 0 @@ -35231,13 +35238,13 @@ class MoveSaturation(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.SaturationMoveMode), + ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.MoveModeEnum), ClusterObjectFieldDescriptor(Label="rate", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=3, Type=uint), ]) - moveMode: 'ColorControl.Enums.SaturationMoveMode' = 0 + moveMode: 'ColorControl.Enums.MoveModeEnum' = 0 rate: 'uint' = 0 optionsMask: 'uint' = 0 optionsOverride: 'uint' = 0 @@ -35253,14 +35260,14 @@ class StepSaturation(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.SaturationStepMode), + ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.StepModeEnum), ClusterObjectFieldDescriptor(Label="stepSize", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=4, Type=uint), ]) - stepMode: 'ColorControl.Enums.SaturationStepMode' = 0 + stepMode: 'ColorControl.Enums.StepModeEnum' = 0 stepSize: 'uint' = 0 transitionTime: 'uint' = 0 optionsMask: 'uint' = 0 @@ -35394,14 +35401,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="enhancedHue", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="direction", Tag=1, Type=ColorControl.Enums.HueDirection), + ClusterObjectFieldDescriptor(Label="direction", Tag=1, Type=ColorControl.Enums.DirectionEnum), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=4, Type=uint), ]) enhancedHue: 'uint' = 0 - direction: 'ColorControl.Enums.HueDirection' = 0 + direction: 'ColorControl.Enums.DirectionEnum' = 0 transitionTime: 'uint' = 0 optionsMask: 'uint' = 0 optionsOverride: 'uint' = 0 @@ -35417,13 +35424,13 @@ class EnhancedMoveHue(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.HueMoveMode), + ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.MoveModeEnum), ClusterObjectFieldDescriptor(Label="rate", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=3, Type=uint), ]) - moveMode: 'ColorControl.Enums.HueMoveMode' = 0 + moveMode: 'ColorControl.Enums.MoveModeEnum' = 0 rate: 'uint' = 0 optionsMask: 'uint' = 0 optionsOverride: 'uint' = 0 @@ -35439,14 +35446,14 @@ class EnhancedStepHue(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.HueStepMode), + ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.StepModeEnum), ClusterObjectFieldDescriptor(Label="stepSize", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=4, Type=uint), ]) - stepMode: 'ColorControl.Enums.HueStepMode' = 0 + stepMode: 'ColorControl.Enums.StepModeEnum' = 0 stepSize: 'uint' = 0 transitionTime: 'uint' = 0 optionsMask: 'uint' = 0 @@ -35488,8 +35495,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="updateFlags", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="action", Tag=1, Type=ColorControl.Enums.ColorLoopAction), - ClusterObjectFieldDescriptor(Label="direction", Tag=2, Type=ColorControl.Enums.ColorLoopDirection), + ClusterObjectFieldDescriptor(Label="action", Tag=1, Type=ColorControl.Enums.ColorLoopActionEnum), + ClusterObjectFieldDescriptor(Label="direction", Tag=2, Type=ColorControl.Enums.ColorLoopDirectionEnum), ClusterObjectFieldDescriptor(Label="time", Tag=3, Type=uint), ClusterObjectFieldDescriptor(Label="startHue", Tag=4, Type=uint), ClusterObjectFieldDescriptor(Label="optionsMask", Tag=5, Type=uint), @@ -35497,8 +35504,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) updateFlags: 'uint' = 0 - action: 'ColorControl.Enums.ColorLoopAction' = 0 - direction: 'ColorControl.Enums.ColorLoopDirection' = 0 + action: 'ColorControl.Enums.ColorLoopActionEnum' = 0 + direction: 'ColorControl.Enums.ColorLoopDirectionEnum' = 0 time: 'uint' = 0 startHue: 'uint' = 0 optionsMask: 'uint' = 0 @@ -35533,7 +35540,7 @@ class MoveColorTemperature(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.HueMoveMode), + ClusterObjectFieldDescriptor(Label="moveMode", Tag=0, Type=ColorControl.Enums.MoveModeEnum), ClusterObjectFieldDescriptor(Label="rate", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="colorTemperatureMinimumMireds", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="colorTemperatureMaximumMireds", Tag=3, Type=uint), @@ -35541,7 +35548,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=5, Type=uint), ]) - moveMode: 'ColorControl.Enums.HueMoveMode' = 0 + moveMode: 'ColorControl.Enums.MoveModeEnum' = 0 rate: 'uint' = 0 colorTemperatureMinimumMireds: 'uint' = 0 colorTemperatureMaximumMireds: 'uint' = 0 @@ -35559,7 +35566,7 @@ class StepColorTemperature(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.HueStepMode), + ClusterObjectFieldDescriptor(Label="stepMode", Tag=0, Type=ColorControl.Enums.StepModeEnum), ClusterObjectFieldDescriptor(Label="stepSize", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="transitionTime", Tag=2, Type=uint), ClusterObjectFieldDescriptor(Label="colorTemperatureMinimumMireds", Tag=3, Type=uint), @@ -35568,7 +35575,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="optionsOverride", Tag=6, Type=uint), ]) - stepMode: 'ColorControl.Enums.HueStepMode' = 0 + stepMode: 'ColorControl.Enums.StepModeEnum' = 0 stepSize: 'uint' = 0 transitionTime: 'uint' = 0 colorTemperatureMinimumMireds: 'uint' = 0 @@ -35669,9 +35676,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[ColorControl.Enums.DriftCompensationEnum]) - value: 'typing.Optional[uint]' = None + value: 'typing.Optional[ColorControl.Enums.DriftCompensationEnum]' = None @dataclass class CompensationText(ClusterAttributeDescriptor): @@ -35717,9 +35724,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=ColorControl.Enums.ColorModeEnum) - value: 'uint' = 0 + value: 'ColorControl.Enums.ColorModeEnum' = 0 @dataclass class Options(ClusterAttributeDescriptor): @@ -36245,9 +36252,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=ColorControl.Enums.EnhancedColorModeEnum) - value: 'uint' = 0 + value: 'ColorControl.Enums.EnhancedColorModeEnum' = 0 @dataclass class ColorLoopActive(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index f899dba1fafe44..472a630d93df68 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -12882,7 +12882,7 @@ static id _Nullable DecodeAttributeValueForColorControlCluster(AttributeId aAttr return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } case Attributes::CompensationText::Id: { @@ -12920,7 +12920,7 @@ static id _Nullable DecodeAttributeValueForColorControlCluster(AttributeId aAttr return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } case Attributes::Options::Id: { @@ -12931,7 +12931,7 @@ static id _Nullable DecodeAttributeValueForColorControlCluster(AttributeId aAttr return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::NumberOfPrimaries::Id: { @@ -13323,7 +13323,7 @@ static id _Nullable DecodeAttributeValueForColorControlCluster(AttributeId aAttr return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } case Attributes::ColorLoopActive::Id: { @@ -13389,7 +13389,7 @@ static id _Nullable DecodeAttributeValueForColorControlCluster(AttributeId aAttr return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; return value; } case Attributes::ColorTempPhysicalMinMireds::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index fab6862dd96a67..efb5fca9547fab 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -20203,65 +20203,62 @@ typedef NS_ENUM(uint8_t, MTRThermostatUserInterfaceConfigurationTemperatureDispl } MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)); typedef NS_ENUM(uint8_t, MTRColorControlColorLoopAction) { - MTRColorControlColorLoopActionDeactivate MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlColorLoopActionActivateFromColorLoopStartEnhancedHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlColorLoopActionActivateFromEnhancedCurrentHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x02, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); + MTRColorControlColorLoopActionDeactivate MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlColorLoopActionActivateFromColorLoopStartEnhancedHue MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlColorLoopActionActivateFromEnhancedCurrentHue MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRColorControlColorLoopDirection) { - MTRColorControlColorLoopDirectionDecrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlColorLoopDirectionIncrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); + MTRColorControlColorLoopDirectionDecrement MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlColorLoopDirectionIncrement MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRColorControlColorMode) { - MTRColorControlColorModeCurrentHueAndCurrentSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlColorModeCurrentXAndCurrentY MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlColorModeColorTemperature MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x02, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); - -typedef NS_ENUM(uint8_t, MTRColorControlHueDirection) { - MTRColorControlHueDirectionShortestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlHueDirectionLongestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlHueDirectionUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x02, - MTRColorControlHueDirectionDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); + MTRColorControlColorModeCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlColorModeCurrentXAndCurrentY MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlColorModeColorTemperatureMireds MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_ENUM(uint8_t, MTRColorControlHueMoveMode) { - MTRColorControlHueMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlHueMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlHueMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRColorControlDirection) { + MTRColorControlDirectionShortest MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlDirectionLongest MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlDirectionUp MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRColorControlDirectionDown MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_ENUM(uint8_t, MTRColorControlHueStepMode) { - MTRColorControlHueStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlHueStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRColorControlDriftCompensation) { + MTRColorControlDriftCompensationNone MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlDriftCompensationOtherOrUnknown MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlDriftCompensationTemperatureMonitoring MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRColorControlDriftCompensationOpticalLuminanceMonitoringAndFeedback MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRColorControlDriftCompensationOpticalColorMonitoringAndFeedback MTR_PROVISIONALLY_AVAILABLE = 0x04, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_ENUM(uint8_t, MTRColorControlSaturationMoveMode) { - MTRColorControlSaturationMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, - MTRColorControlSaturationMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlSaturationMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRColorControlEnhancedColorMode) { + MTRColorControlEnhancedColorModeCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlEnhancedColorModeCurrentXAndCurrentY MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlEnhancedColorModeColorTemperatureMireds MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRColorControlEnhancedColorModeEnhancedCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_ENUM(uint8_t, MTRColorControlSaturationStepMode) { - MTRColorControlSaturationStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, - MTRColorControlSaturationStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x03, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRColorControlMoveMode) { + MTRColorControlMoveModeStop MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRColorControlMoveModeUp MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlMoveModeDown MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilities) { - MTRColorControlColorCapabilitiesHueSaturationSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x1, - MTRColorControlColorCapabilitiesEnhancedHueSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x2, - MTRColorControlColorCapabilitiesColorLoopSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x4, - MTRColorControlColorCapabilitiesXYAttributesSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x8, - MTRColorControlColorCapabilitiesColorTemperatureSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x10, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_ENUM(uint8_t, MTRColorControlStepMode) { + MTRColorControlStepModeUp MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRColorControlStepModeDown MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; -typedef NS_OPTIONS(uint8_t, MTRColorControlColorLoopUpdateFlags) { - MTRColorControlColorLoopUpdateFlagsUpdateAction MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x1, - MTRColorControlColorLoopUpdateFlagsUpdateDirection MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x2, - MTRColorControlColorLoopUpdateFlagsUpdateTime MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x4, - MTRColorControlColorLoopUpdateFlagsUpdateStartHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x8, -} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilitiesBitmap) { + MTRColorControlColorCapabilitiesBitmapHueSaturation MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRColorControlColorCapabilitiesBitmapEnhancedHue MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRColorControlColorCapabilitiesBitmapColorLoop MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRColorControlColorCapabilitiesBitmapXY MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRColorControlColorCapabilitiesBitmapColorTemperature MTR_PROVISIONALLY_AVAILABLE = 0x10, +} MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { MTRColorControlFeatureHueAndSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x1, @@ -20271,6 +20268,17 @@ typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { MTRColorControlFeatureColorTemperature MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x10, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_OPTIONS(uint8_t, MTRColorControlOptionsBitmap) { + MTRColorControlOptionsBitmapExecuteIfOff MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRColorControlUpdateFlagsBitmap) { + MTRColorControlUpdateFlagsBitmapUpdateAction MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRColorControlUpdateFlagsBitmapUpdateDirection MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRColorControlUpdateFlagsBitmapUpdateTime MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRColorControlUpdateFlagsBitmapUpdateStartHue MTR_PROVISIONALLY_AVAILABLE = 0x8, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint8_t, MTRBallastConfigurationBallastStatusBitmap) { MTRBallastConfigurationBallastStatusBitmapBallastNonOperational MTR_PROVISIONALLY_AVAILABLE = 0x1, MTRBallastConfigurationBallastStatusBitmapLampFailure MTR_PROVISIONALLY_AVAILABLE = 0x2, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 756425bba1b764..2c81423cfbb46a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -76739,7 +76739,7 @@ - (void)writeAttributeOptionsWithValue:(NSNumber * _Nonnull)value params:(MTRWri ListFreer listFreer; using TypeInfo = ColorControl::Attributes::Options::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 976d5a0ef241be..1334d8beba2654 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -23153,10 +23153,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23250,10 +23250,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.rate = self.rate.unsignedCharValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23353,10 +23353,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedCharValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23450,10 +23450,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23547,10 +23547,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.rate = self.rate.unsignedCharValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23650,10 +23650,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedCharValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23753,10 +23753,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23856,10 +23856,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -23953,10 +23953,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.rateY = self.rateY.shortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24056,10 +24056,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24153,10 +24153,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24268,10 +24268,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24365,10 +24365,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.rate = self.rate.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24468,10 +24468,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24571,10 +24571,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24686,10 +24686,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.startHue = self.startHue.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24771,10 +24771,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type encodableStruct; ListFreer listFreer; { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24880,10 +24880,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -24995,10 +24995,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.colorTemperatureMaximumMireds = self.colorTemperatureMaximumMireds.unsignedShortValue; } { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + encodableStruct.optionsMask = static_cast>(self.optionsMask.unsignedCharValue); } { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; + encodableStruct.optionsOverride = static_cast>(self.optionsOverride.unsignedCharValue); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); diff --git a/src/python_testing/TC_CC_2_2.py b/src/python_testing/TC_CC_2_2.py index 4f6a21b1ba2771..86080efd358456 100644 --- a/src/python_testing/TC_CC_2_2.py +++ b/src/python_testing/TC_CC_2_2.py @@ -137,14 +137,14 @@ async def test_TC_CC_2_2(self): self.step(6) if supports_hs: - cmd = cc.Commands.MoveHue(moveMode=cc.Enums.HueMoveMode.kDown, rate=225) + cmd = cc.Commands.MoveHue(moveMode=cc.Enums.MoveModeEnum.kDown, rate=225) await self.send_single_cmd(cmd) else: self.mark_current_step_skipped() self.step(7) if supports_hs: - cmd = cc.Commands.MoveSaturation(moveMode=cc.Enums.SaturationMoveMode.kDown, rate=225) + cmd = cc.Commands.MoveSaturation(moveMode=cc.Enums.MoveModeEnum.kDown, rate=225) await self.send_single_cmd(cmd) else: self.mark_current_step_skipped() @@ -173,7 +173,7 @@ def check_report_counts(attr: ClusterObjects.ClusterAttributeDescriptor): self.skip_step(15) else: self.step(10) - cmd = cc.Commands.MoveToHue(hue=254, transitionTime=100, direction=cc.Enums.HueDirection.kShortestDistance) + cmd = cc.Commands.MoveToHue(hue=254, transitionTime=100, direction=cc.Enums.DirectionEnum.kShortest) await self.send_single_cmd(cmd) self.step(11) @@ -228,7 +228,7 @@ def check_report_counts(attr: ClusterObjects.ClusterAttributeDescriptor): else: self.step(23) cmd = cc.Commands.EnhancedMoveToHue(enhancedHue=0, transitionTime=100, - direction=cc.Enums.HueDirection.kShortestDistance) + direction=cc.Enums.DirectionEnum.kShortest) await self.send_single_cmd(cmd) self.step(24) 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 c5768be8b71f3d..a8fc013fa0ce19 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 @@ -27161,9 +27161,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace DriftCompensation { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::DriftCompensationEnum * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -27177,9 +27177,10 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::DriftCompensationEnum value, + MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -27190,9 +27191,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::ColorControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::DriftCompensationEnum value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -27299,9 +27300,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace ColorMode { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::ColorModeEnum * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -27315,9 +27316,10 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::ColorModeEnum value, + MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -27328,9 +27330,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::ColorControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::ColorModeEnum value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -27345,9 +27347,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value namespace Options { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -27361,9 +27364,10 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -27374,9 +27378,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::ColorControl::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -29237,9 +29242,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace EnhancedColorMode { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -29253,9 +29258,10 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum value, + MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -29266,9 +29272,9 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::ColorControl::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -29513,9 +29519,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace ColorCapabilities { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -29529,9 +29536,11 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * va return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value, + MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -29542,9 +29551,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu return emberAfWriteAttribute(endpoint, Clusters::ColorControl::Id, Id, writable, ZCL_BITMAP16_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; 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 41422b72ca596d..cab9691ebbf4ed 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 @@ -4267,9 +4267,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace CurrentY namespace DriftCompensation { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // enum8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::app::Clusters::ColorControl::DriftCompensationEnum * value); // DriftCompensationEnum +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::DriftCompensationEnum value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::DriftCompensationEnum value, + MarkAttributeDirty markDirty); } // namespace DriftCompensation namespace CompensationText { @@ -4285,15 +4287,20 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace ColorTemperatureMireds namespace ColorMode { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // enum8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::app::Clusters::ColorControl::ColorModeEnum * value); // ColorModeEnum +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::ColorModeEnum value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::ColorModeEnum value, + MarkAttributeDirty markDirty); } // namespace ColorMode namespace Options { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value); // OptionsBitmap +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value, MarkAttributeDirty markDirty); } // namespace Options namespace NumberOfPrimaries { @@ -4533,9 +4540,11 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace EnhancedCurrentHue namespace EnhancedColorMode { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // enum8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::app::Clusters::ColorControl::EnhancedColorModeEnum * value); // EnhancedColorModeEnum +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum value, + MarkAttributeDirty markDirty); } // namespace EnhancedColorMode namespace ColorLoopActive { @@ -4569,9 +4578,14 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace ColorLoopStoredEnhancedHue namespace ColorCapabilities { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // bitmap16 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + chip::BitMask * value); // ColorCapabilitiesBitmap +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value, + MarkAttributeDirty markDirty); } // namespace ColorCapabilities namespace ColorTempPhysicalMinMireds { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index da2047e745d586..f63782c221d827 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2942,9 +2942,9 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ThermostatUserInterface } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorLoopAction val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorLoopActionEnum val) { - using EnumType = ColorControl::ColorLoopAction; + using EnumType = ColorControl::ColorLoopActionEnum; switch (val) { case EnumType::kDeactivate: @@ -2955,38 +2955,38 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorLoop return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorLoopDirection val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorLoopDirectionEnum val) { - using EnumType = ColorControl::ColorLoopDirection; + using EnumType = ColorControl::ColorLoopDirectionEnum; switch (val) { - case EnumType::kDecrementHue: - case EnumType::kIncrementHue: + case EnumType::kDecrement: + case EnumType::kIncrement: return val; default: return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorMode val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::ColorModeEnum val) { - using EnumType = ColorControl::ColorMode; + using EnumType = ColorControl::ColorModeEnum; switch (val) { case EnumType::kCurrentHueAndCurrentSaturation: case EnumType::kCurrentXAndCurrentY: - case EnumType::kColorTemperature: + case EnumType::kColorTemperatureMireds: return val; default: return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::HueDirection val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::DirectionEnum val) { - using EnumType = ColorControl::HueDirection; + using EnumType = ColorControl::DirectionEnum; switch (val) { - case EnumType::kShortestDistance: - case EnumType::kLongestDistance: + case EnumType::kShortest: + case EnumType::kLongest: case EnumType::kUp: case EnumType::kDown: return val; @@ -2994,34 +2994,38 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::HueDirect return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::HueMoveMode val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::DriftCompensationEnum val) { - using EnumType = ColorControl::HueMoveMode; + using EnumType = ColorControl::DriftCompensationEnum; switch (val) { - case EnumType::kStop: - case EnumType::kUp: - case EnumType::kDown: + case EnumType::kNone: + case EnumType::kOtherOrUnknown: + case EnumType::kTemperatureMonitoring: + case EnumType::kOpticalLuminanceMonitoringAndFeedback: + case EnumType::kOpticalColorMonitoringAndFeedback: return val; default: return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::HueStepMode val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::EnhancedColorModeEnum val) { - using EnumType = ColorControl::HueStepMode; + using EnumType = ColorControl::EnhancedColorModeEnum; switch (val) { - case EnumType::kUp: - case EnumType::kDown: + case EnumType::kCurrentHueAndCurrentSaturation: + case EnumType::kCurrentXAndCurrentY: + case EnumType::kColorTemperatureMireds: + case EnumType::kEnhancedCurrentHueAndCurrentSaturation: return val; default: return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::SaturationMoveMode val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::MoveModeEnum val) { - using EnumType = ColorControl::SaturationMoveMode; + using EnumType = ColorControl::MoveModeEnum; switch (val) { case EnumType::kStop: @@ -3032,9 +3036,9 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::Saturatio return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::SaturationStepMode val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ColorControl::StepModeEnum val) { - using EnumType = ColorControl::SaturationStepMode; + using EnumType = ColorControl::StepModeEnum; switch (val) { case EnumType::kUp: diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 571439625e121a..e78f8f4d064648 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -4343,8 +4343,8 @@ enum class TemperatureDisplayModeEnum : uint8_t namespace ColorControl { -// Enum for ColorLoopAction -enum class ColorLoopAction : uint8_t +// Enum for ColorLoopActionEnum +enum class ColorLoopActionEnum : uint8_t { kDeactivate = 0x00, kActivateFromColorLoopStartEnhancedHue = 0x01, @@ -4356,11 +4356,11 @@ enum class ColorLoopAction : uint8_t kUnknownEnumValue = 3, }; -// Enum for ColorLoopDirection -enum class ColorLoopDirection : uint8_t +// Enum for ColorLoopDirectionEnum +enum class ColorLoopDirectionEnum : uint8_t { - kDecrementHue = 0x00, - kIncrementHue = 0x01, + kDecrement = 0x00, + kIncrement = 0x01, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown @@ -4368,12 +4368,12 @@ enum class ColorLoopDirection : uint8_t kUnknownEnumValue = 2, }; -// Enum for ColorMode -enum class ColorMode : uint8_t +// Enum for ColorModeEnum +enum class ColorModeEnum : uint8_t { kCurrentHueAndCurrentSaturation = 0x00, kCurrentXAndCurrentY = 0x01, - kColorTemperature = 0x02, + kColorTemperatureMireds = 0x02, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown @@ -4381,13 +4381,13 @@ enum class ColorMode : uint8_t kUnknownEnumValue = 3, }; -// Enum for HueDirection -enum class HueDirection : uint8_t +// Enum for DirectionEnum +enum class DirectionEnum : uint8_t { - kShortestDistance = 0x00, - kLongestDistance = 0x01, - kUp = 0x02, - kDown = 0x03, + kShortest = 0x00, + kLongest = 0x01, + kUp = 0x02, + kDown = 0x03, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown @@ -4395,33 +4395,37 @@ enum class HueDirection : uint8_t kUnknownEnumValue = 4, }; -// Enum for HueMoveMode -enum class HueMoveMode : uint8_t +// Enum for DriftCompensationEnum +enum class DriftCompensationEnum : uint8_t { - kStop = 0x00, - kUp = 0x01, - kDown = 0x03, + kNone = 0x00, + kOtherOrUnknown = 0x01, + kTemperatureMonitoring = 0x02, + kOpticalLuminanceMonitoringAndFeedback = 0x03, + kOpticalColorMonitoringAndFeedback = 0x04, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 2, + kUnknownEnumValue = 5, }; -// Enum for HueStepMode -enum class HueStepMode : uint8_t +// Enum for EnhancedColorModeEnum +enum class EnhancedColorModeEnum : uint8_t { - kUp = 0x01, - kDown = 0x03, + kCurrentHueAndCurrentSaturation = 0x00, + kCurrentXAndCurrentY = 0x01, + kColorTemperatureMireds = 0x02, + kEnhancedCurrentHueAndCurrentSaturation = 0x03, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 0, + kUnknownEnumValue = 4, }; -// Enum for SaturationMoveMode -enum class SaturationMoveMode : uint8_t +// Enum for MoveModeEnum +enum class MoveModeEnum : uint8_t { kStop = 0x00, kUp = 0x01, @@ -4433,8 +4437,8 @@ enum class SaturationMoveMode : uint8_t kUnknownEnumValue = 2, }; -// Enum for SaturationStepMode -enum class SaturationStepMode : uint8_t +// Enum for StepModeEnum +enum class StepModeEnum : uint8_t { kUp = 0x01, kDown = 0x03, @@ -4445,23 +4449,14 @@ enum class SaturationStepMode : uint8_t kUnknownEnumValue = 0, }; -// Bitmap for ColorCapabilities -enum class ColorCapabilities : uint16_t +// Bitmap for ColorCapabilitiesBitmap +enum class ColorCapabilitiesBitmap : uint16_t { - kHueSaturationSupported = 0x1, - kEnhancedHueSupported = 0x2, - kColorLoopSupported = 0x4, - kXYAttributesSupported = 0x8, - kColorTemperatureSupported = 0x10, -}; - -// Bitmap for ColorLoopUpdateFlags -enum class ColorLoopUpdateFlags : uint8_t -{ - kUpdateAction = 0x1, - kUpdateDirection = 0x2, - kUpdateTime = 0x4, - kUpdateStartHue = 0x8, + kHueSaturation = 0x1, + kEnhancedHue = 0x2, + kColorLoop = 0x4, + kXy = 0x8, + kColorTemperature = 0x10, }; // Bitmap for Feature @@ -4473,6 +4468,21 @@ enum class Feature : uint32_t kXy = 0x8, kColorTemperature = 0x10, }; + +// Bitmap for OptionsBitmap +enum class OptionsBitmap : uint8_t +{ + kExecuteIfOff = 0x1, +}; + +// Bitmap for UpdateFlagsBitmap +enum class UpdateFlagsBitmap : uint8_t +{ + kUpdateAction = 0x1, + kUpdateDirection = 0x2, + kUpdateTime = 0x4, + kUpdateStartHue = 0x8, +}; } // namespace ColorControl namespace BallastConfiguration { 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 f0f1dea1de536d..e18b64797bb595 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 @@ -31602,11 +31602,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveToHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t hue = static_cast(0); - HueDirection direction = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t hue = static_cast(0); + DirectionEnum direction = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31621,11 +31621,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveToHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t hue = static_cast(0); - HueDirection direction = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t hue = static_cast(0); + DirectionEnum direction = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveToHue @@ -31645,10 +31645,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint8_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint8_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31663,10 +31663,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint8_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint8_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveHue @@ -31687,11 +31687,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::StepHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint8_t stepSize = static_cast(0); - uint8_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint8_t stepSize = static_cast(0); + uint8_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31706,11 +31706,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::StepHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint8_t stepSize = static_cast(0); - uint8_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint8_t stepSize = static_cast(0); + uint8_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StepHue @@ -31730,10 +31730,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveToSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31748,10 +31748,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveToSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveToSaturation @@ -31771,10 +31771,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - SaturationMoveMode moveMode = static_cast(0); - uint8_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint8_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31789,10 +31789,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - SaturationMoveMode moveMode = static_cast(0); - uint8_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint8_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveSaturation @@ -31813,11 +31813,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::StepSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - SaturationStepMode stepMode = static_cast(0); - uint8_t stepSize = static_cast(0); - uint8_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint8_t stepSize = static_cast(0); + uint8_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31832,11 +31832,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::StepSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - SaturationStepMode stepMode = static_cast(0); - uint8_t stepSize = static_cast(0); - uint8_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint8_t stepSize = static_cast(0); + uint8_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StepSaturation @@ -31857,11 +31857,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveToHueAndSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t hue = static_cast(0); - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t hue = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31876,11 +31876,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveToHueAndSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t hue = static_cast(0); - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint8_t hue = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveToHueAndSaturation @@ -31901,11 +31901,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveToColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t colorX = static_cast(0); - uint16_t colorY = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t colorX = static_cast(0); + uint16_t colorY = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31920,11 +31920,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveToColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t colorX = static_cast(0); - uint16_t colorY = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t colorX = static_cast(0); + uint16_t colorY = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveToColor @@ -31944,10 +31944,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - int16_t rateX = static_cast(0); - int16_t rateY = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + int16_t rateX = static_cast(0); + int16_t rateY = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -31962,10 +31962,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - int16_t rateX = static_cast(0); - int16_t rateY = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + int16_t rateX = static_cast(0); + int16_t rateY = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveColor @@ -31986,11 +31986,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::StepColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - int16_t stepX = static_cast(0); - int16_t stepY = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + int16_t stepX = static_cast(0); + int16_t stepY = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32005,11 +32005,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::StepColor::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - int16_t stepX = static_cast(0); - int16_t stepY = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + int16_t stepX = static_cast(0); + int16_t stepY = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StepColor @@ -32029,10 +32029,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveToColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t colorTemperatureMireds = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t colorTemperatureMireds = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32047,10 +32047,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveToColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t colorTemperatureMireds = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t colorTemperatureMireds = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveToColorTemperature @@ -32071,11 +32071,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveToHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t enhancedHue = static_cast(0); - HueDirection direction = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t enhancedHue = static_cast(0); + DirectionEnum direction = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32090,11 +32090,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveToHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t enhancedHue = static_cast(0); - HueDirection direction = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t enhancedHue = static_cast(0); + DirectionEnum direction = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace EnhancedMoveToHue @@ -32114,10 +32114,10 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint16_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint16_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32132,10 +32132,10 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint16_t rate = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint16_t rate = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace EnhancedMoveHue @@ -32156,11 +32156,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::EnhancedStepHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint16_t stepSize = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint16_t stepSize = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32175,11 +32175,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::EnhancedStepHue::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint16_t stepSize = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint16_t stepSize = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace EnhancedStepHue @@ -32200,11 +32200,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveToHueAndSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t enhancedHue = static_cast(0); - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t enhancedHue = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32219,11 +32219,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::EnhancedMoveToHueAndSaturation::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint16_t enhancedHue = static_cast(0); - uint8_t saturation = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + uint16_t enhancedHue = static_cast(0); + uint8_t saturation = static_cast(0); + uint16_t transitionTime = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace EnhancedMoveToHueAndSaturation @@ -32246,13 +32246,13 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::ColorLoopSet::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - chip::BitMask updateFlags = static_cast>(0); - ColorLoopAction action = static_cast(0); - ColorLoopDirection direction = static_cast(0); - uint16_t time = static_cast(0); - uint16_t startHue = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + chip::BitMask updateFlags = static_cast>(0); + ColorLoopActionEnum action = static_cast(0); + ColorLoopDirectionEnum direction = static_cast(0); + uint16_t time = static_cast(0); + uint16_t startHue = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32267,13 +32267,13 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::ColorLoopSet::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - chip::BitMask updateFlags = static_cast>(0); - ColorLoopAction action = static_cast(0); - ColorLoopDirection direction = static_cast(0); - uint16_t time = static_cast(0); - uint16_t startHue = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + chip::BitMask updateFlags = static_cast>(0); + ColorLoopActionEnum action = static_cast(0); + ColorLoopDirectionEnum direction = static_cast(0); + uint16_t time = static_cast(0); + uint16_t startHue = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace ColorLoopSet @@ -32291,8 +32291,8 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::StopMoveStep::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32307,8 +32307,8 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::StopMoveStep::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StopMoveStep @@ -32330,12 +32330,12 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::MoveColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint16_t rate = static_cast(0); - uint16_t colorTemperatureMinimumMireds = static_cast(0); - uint16_t colorTemperatureMaximumMireds = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint16_t rate = static_cast(0); + uint16_t colorTemperatureMinimumMireds = static_cast(0); + uint16_t colorTemperatureMaximumMireds = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32350,12 +32350,12 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::MoveColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueMoveMode moveMode = static_cast(0); - uint16_t rate = static_cast(0); - uint16_t colorTemperatureMinimumMireds = static_cast(0); - uint16_t colorTemperatureMaximumMireds = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + MoveModeEnum moveMode = static_cast(0); + uint16_t rate = static_cast(0); + uint16_t colorTemperatureMinimumMireds = static_cast(0); + uint16_t colorTemperatureMaximumMireds = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace MoveColorTemperature @@ -32378,13 +32378,13 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::StepColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint16_t stepSize = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint16_t colorTemperatureMinimumMireds = static_cast(0); - uint16_t colorTemperatureMaximumMireds = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint16_t stepSize = static_cast(0); + uint16_t transitionTime = static_cast(0); + uint16_t colorTemperatureMinimumMireds = static_cast(0); + uint16_t colorTemperatureMaximumMireds = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -32399,13 +32399,13 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::StepColorTemperature::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } - HueStepMode stepMode = static_cast(0); - uint16_t stepSize = static_cast(0); - uint16_t transitionTime = static_cast(0); - uint16_t colorTemperatureMinimumMireds = static_cast(0); - uint16_t colorTemperatureMaximumMireds = static_cast(0); - uint8_t optionsMask = static_cast(0); - uint8_t optionsOverride = static_cast(0); + StepModeEnum stepMode = static_cast(0); + uint16_t stepSize = static_cast(0); + uint16_t transitionTime = static_cast(0); + uint16_t colorTemperatureMinimumMireds = static_cast(0); + uint16_t colorTemperatureMaximumMireds = static_cast(0); + chip::BitMask optionsMask = static_cast>(0); + chip::BitMask optionsOverride = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StepColorTemperature @@ -32476,9 +32476,9 @@ struct TypeInfo namespace DriftCompensation { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::app::Clusters::ColorControl::DriftCompensationEnum; + using DecodableType = chip::app::Clusters::ColorControl::DriftCompensationEnum; + using DecodableArgType = chip::app::Clusters::ColorControl::DriftCompensationEnum; static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::DriftCompensation::Id; } @@ -32513,9 +32513,9 @@ struct TypeInfo namespace ColorMode { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::app::Clusters::ColorControl::ColorModeEnum; + using DecodableType = chip::app::Clusters::ColorControl::ColorModeEnum; + using DecodableArgType = chip::app::Clusters::ColorControl::ColorModeEnum; static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::ColorMode::Id; } @@ -32525,9 +32525,9 @@ struct TypeInfo namespace Options { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::Options::Id; } @@ -32909,9 +32909,9 @@ struct TypeInfo namespace EnhancedColorMode { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::app::Clusters::ColorControl::EnhancedColorModeEnum; + using DecodableType = chip::app::Clusters::ColorControl::EnhancedColorModeEnum; + using DecodableArgType = chip::app::Clusters::ColorControl::EnhancedColorModeEnum; static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::EnhancedColorMode::Id; } @@ -32981,9 +32981,9 @@ struct TypeInfo namespace ColorCapabilities { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::ColorControl::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::ColorCapabilities::Id; } @@ -33088,11 +33088,13 @@ struct TypeInfo Attributes::RemainingTime::TypeInfo::DecodableType remainingTime = static_cast(0); Attributes::CurrentX::TypeInfo::DecodableType currentX = static_cast(0); Attributes::CurrentY::TypeInfo::DecodableType currentY = static_cast(0); - Attributes::DriftCompensation::TypeInfo::DecodableType driftCompensation = static_cast(0); + Attributes::DriftCompensation::TypeInfo::DecodableType driftCompensation = + static_cast(0); Attributes::CompensationText::TypeInfo::DecodableType compensationText; Attributes::ColorTemperatureMireds::TypeInfo::DecodableType colorTemperatureMireds = static_cast(0); - Attributes::ColorMode::TypeInfo::DecodableType colorMode = static_cast(0); - Attributes::Options::TypeInfo::DecodableType options = static_cast(0); + Attributes::ColorMode::TypeInfo::DecodableType colorMode = static_cast(0); + Attributes::Options::TypeInfo::DecodableType options = + static_cast>(0); Attributes::NumberOfPrimaries::TypeInfo::DecodableType numberOfPrimaries; Attributes::Primary1X::TypeInfo::DecodableType primary1X = static_cast(0); Attributes::Primary1Y::TypeInfo::DecodableType primary1Y = static_cast(0); @@ -33123,14 +33125,16 @@ struct TypeInfo Attributes::ColorPointBX::TypeInfo::DecodableType colorPointBX = static_cast(0); Attributes::ColorPointBY::TypeInfo::DecodableType colorPointBY = static_cast(0); Attributes::ColorPointBIntensity::TypeInfo::DecodableType colorPointBIntensity; - Attributes::EnhancedCurrentHue::TypeInfo::DecodableType enhancedCurrentHue = static_cast(0); - Attributes::EnhancedColorMode::TypeInfo::DecodableType enhancedColorMode = static_cast(0); + Attributes::EnhancedCurrentHue::TypeInfo::DecodableType enhancedCurrentHue = static_cast(0); + Attributes::EnhancedColorMode::TypeInfo::DecodableType enhancedColorMode = + static_cast(0); Attributes::ColorLoopActive::TypeInfo::DecodableType colorLoopActive = static_cast(0); Attributes::ColorLoopDirection::TypeInfo::DecodableType colorLoopDirection = static_cast(0); Attributes::ColorLoopTime::TypeInfo::DecodableType colorLoopTime = static_cast(0); Attributes::ColorLoopStartEnhancedHue::TypeInfo::DecodableType colorLoopStartEnhancedHue = static_cast(0); Attributes::ColorLoopStoredEnhancedHue::TypeInfo::DecodableType colorLoopStoredEnhancedHue = static_cast(0); - Attributes::ColorCapabilities::TypeInfo::DecodableType colorCapabilities = static_cast(0); + Attributes::ColorCapabilities::TypeInfo::DecodableType colorCapabilities = + static_cast>(0); Attributes::ColorTempPhysicalMinMireds::TypeInfo::DecodableType colorTempPhysicalMinMireds = static_cast(0); Attributes::ColorTempPhysicalMaxMireds::TypeInfo::DecodableType colorTempPhysicalMaxMireds = static_cast(0); Attributes::CoupleColorTempToLevelMinMireds::TypeInfo::DecodableType coupleColorTempToLevelMinMireds = diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 57259e33d69d44..add8258f1e9db3 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -23695,16 +23695,17 @@ void registerClusterColorControl(Commands & commands, CredentialIssuerCommands * WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "current-y", 0, UINT16_MAX, Attributes::CurrentY::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "drift-compensation", 0, UINT8_MAX, Attributes::DriftCompensation::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>( + Id, "drift-compensation", 0, UINT8_MAX, Attributes::DriftCompensation::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // make_unique>(Id, "compensation-text", Attributes::CompensationText::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "color-temperature-mireds", 0, UINT16_MAX, Attributes::ColorTemperatureMireds::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "color-mode", 0, UINT8_MAX, Attributes::ColorMode::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "options", 0, UINT8_MAX, Attributes::Options::Id, WriteCommandType::kWrite, - credsIssuerConfig), // + make_unique>( + Id, "color-mode", 0, UINT8_MAX, Attributes::ColorMode::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "options", 0, UINT8_MAX, Attributes::Options::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>(Id, "number-of-primaries", 0, UINT8_MAX, Attributes::NumberOfPrimaries::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23777,8 +23778,9 @@ void registerClusterColorControl(Commands & commands, CredentialIssuerCommands * WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "enhanced-current-hue", 0, UINT16_MAX, Attributes::EnhancedCurrentHue::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "enhanced-color-mode", 0, UINT8_MAX, Attributes::EnhancedColorMode::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>( + Id, "enhanced-color-mode", 0, UINT8_MAX, Attributes::EnhancedColorMode::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // make_unique>(Id, "color-loop-active", 0, UINT8_MAX, Attributes::ColorLoopActive::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "color-loop-direction", 0, UINT8_MAX, Attributes::ColorLoopDirection::Id, @@ -23791,8 +23793,9 @@ void registerClusterColorControl(Commands & commands, CredentialIssuerCommands * make_unique>(Id, "color-loop-stored-enhanced-hue", 0, UINT16_MAX, Attributes::ColorLoopStoredEnhancedHue::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "color-capabilities", 0, UINT16_MAX, Attributes::ColorCapabilities::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "color-capabilities", 0, UINT16_MAX, Attributes::ColorCapabilities::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // make_unique>(Id, "color-temp-physical-min-mireds", 0, UINT16_MAX, Attributes::ColorTempPhysicalMinMireds::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index aa122cb62da046..12382e3cb41495 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -15550,7 +15550,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("CurrentY", 1, value); } case ColorControl::Attributes::DriftCompensation::Id: { - uint8_t value; + chip::app::Clusters::ColorControl::DriftCompensationEnum value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("DriftCompensation", 1, value); } @@ -15565,12 +15565,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("ColorTemperatureMireds", 1, value); } case ColorControl::Attributes::ColorMode::Id: { - uint8_t value; + chip::app::Clusters::ColorControl::ColorModeEnum value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ColorMode", 1, value); } case ColorControl::Attributes::Options::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Options", 1, value); } @@ -15730,7 +15730,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("EnhancedCurrentHue", 1, value); } case ColorControl::Attributes::EnhancedColorMode::Id: { - uint8_t value; + chip::app::Clusters::ColorControl::EnhancedColorModeEnum value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("EnhancedColorMode", 1, value); } @@ -15760,7 +15760,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("ColorLoopStoredEnhancedHue", 1, value); } case ColorControl::Attributes::ColorCapabilities::Id: { - uint16_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ColorCapabilities", 1, value); } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index a61f2a6fa6b27e..004bb29c546d1e 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -117680,8 +117680,8 @@ class ColorControlMoveToHue : public ClusterCommand { params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -117733,8 +117733,8 @@ class ColorControlMoveHue : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -117788,8 +117788,8 @@ class ColorControlStepHue : public ClusterCommand { params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -117841,8 +117841,8 @@ class ColorControlMoveToSaturation : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -117894,8 +117894,8 @@ class ColorControlMoveSaturation : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -117949,8 +117949,8 @@ class ColorControlStepSaturation : public ClusterCommand { params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118004,8 +118004,8 @@ class ColorControlMoveToHueAndSaturation : public ClusterCommand { params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118059,8 +118059,8 @@ class ColorControlMoveToColor : public ClusterCommand { params.colorX = [NSNumber numberWithUnsignedShort:mRequest.colorX]; params.colorY = [NSNumber numberWithUnsignedShort:mRequest.colorY]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118112,8 +118112,8 @@ class ColorControlMoveColor : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.rateX = [NSNumber numberWithShort:mRequest.rateX]; params.rateY = [NSNumber numberWithShort:mRequest.rateY]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118167,8 +118167,8 @@ class ColorControlStepColor : public ClusterCommand { params.stepX = [NSNumber numberWithShort:mRequest.stepX]; params.stepY = [NSNumber numberWithShort:mRequest.stepY]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118220,8 +118220,8 @@ class ColorControlMoveToColorTemperature : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.colorTemperatureMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMireds]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118275,8 +118275,8 @@ class ColorControlEnhancedMoveToHue : public ClusterCommand { params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118328,8 +118328,8 @@ class ColorControlEnhancedMoveHue : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118383,8 +118383,8 @@ class ColorControlEnhancedStepHue : public ClusterCommand { params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118438,8 +118438,8 @@ class ColorControlEnhancedMoveToHueAndSaturation : public ClusterCommand { params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118497,8 +118497,8 @@ class ColorControlColorLoopSet : public ClusterCommand { params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.time = [NSNumber numberWithUnsignedShort:mRequest.time]; params.startHue = [NSNumber numberWithUnsignedShort:mRequest.startHue]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118546,8 +118546,8 @@ class ColorControlStopMoveStep : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStopMoveStepParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118603,8 +118603,8 @@ class ColorControlMoveColorTemperature : public ClusterCommand { params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -118662,8 +118662,8 @@ class ColorControlStepColorTemperature : public ClusterCommand { params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; - params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride]; + params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { From 0c4dde5230d5b0e3eb349b5411ceb356ddf2622e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Aug 2024 14:03:08 -0400 Subject: [PATCH 08/53] Update Darwin availability annotations. (#35108) --- .../CHIP/templates/availability.yaml | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 507e19eae032d9..c1f1e1bd6f0e6c 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9694,6 +9694,13 @@ - WaterHeaterMode - WiFiNetworkManagement attributes: + AccessControl: + # Targeting 1.4 + - CommissioningARL + - ARL + BridgedDeviceBasicInformation: + # Targeting 1.4 + - ProductID GeneralCommissioning: # Targeting 1.4 - TCAcceptedVersion @@ -9712,6 +9719,10 @@ - NullableGlobalEnum - NullableGlobalStruct commands: + AccessControl: + # Targeting 1.4 + - ReviewFabricRestrictions + - ReviewFabricRestrictionsResponse BridgedDeviceBasicInformation: # Targeting 1.4 - KeepActive @@ -9719,6 +9730,10 @@ # Targeting 1.4 - SetTCAcknowledgements - SetTCAcknowledgementsResponse + Thermostat: + # Targeting 1.4 + - AtomicRequest + - AtomicResponse UnitTesting: # Ideally none of UnitTesting would be exposed as public API, but # for now just start doing that for new additions to it. @@ -9727,9 +9742,17 @@ - StringEchoRequest - StringEchoResponse structs: + AccessControl: + # Targeting 1.4 + - AccessRestrictionEntryStruct + - AccessRestrictionStruct + - CommissioningAccessRestrictionEntryStruct Globals: # Test-only value - TestGlobalStruct + # Targeting 1.4 + - AtomicAttributeStatusStruct + - LocationDescriptorStruct OccupancySensing: # Targeting 1.4 - HoldTimeLimitsStruct @@ -9742,21 +9765,44 @@ NestedStruct: - d events: + AccessControl: + # Targeting 1.4 + - AccessRestrictionEntryChanged + - FabricRestrictionReviewUpdate BridgedDeviceBasicInformation: # Targeting 1.4 - ActiveChanged enums: + AccessControl: + # Targeting 1.4 + - AccessRestrictionTypeEnum Globals: # Test-only value - TestGlobalEnum + # Targeting 1.4 + - AreaTypeTag + - AtomicRequestTypeEnum + - FloorSurfaceTag + - LandmarkTag + - PositionTag + - RelativePositionTag enum values: + ApplicationLauncher: + StatusEnum: + # Targeting 1.4 + - Downloading + - Installing + - PendingUserApproval GeneralCommissioning: - # Targeting 1.4 CommissioningErrorEnum: + # Targeting 1.4 - RequiredTCNotAccepted - TCAcknowledgementsNotReceived - TCMinVersionNotMet bitmaps: + AccessControl: + # Targeting 1.4 + - Feature BridgedDeviceBasicInformation: # Targeting 1.4 - Feature @@ -9766,6 +9812,9 @@ OccupancySensing: # Targeting 1.4 - Feature + Thermostat: + # Targeting 1.4 + - OccupancyBitmap bitmap values: Switch: Feature: From 229df0c9d8cf5d58ce20ba7411de6b4de68891af Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Aug 2024 14:04:16 -0400 Subject: [PATCH 09/53] Make descriptions for MTRDevice clearly say whether it's the XPC version. (#35112) This requires hoisting _nodeID and _deviceController ivars clearly into the MTRDevice superclass, so they can be accessed from subclasses. The XPC version does not have a bunch of the state the non-XPC one does, so for now it does not try to log that --- src/darwin/Framework/CHIP/MTRDevice.mm | 73 ------------------- .../Framework/CHIP/MTRDevice_Concrete.mm | 8 +- .../Framework/CHIP/MTRDevice_Internal.h | 8 ++ src/darwin/Framework/CHIP/MTRDevice_XPC.mm | 10 +++ 4 files changed, 19 insertions(+), 80 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 4fc30b90b3e433..f17e6d5c90f6eb 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -173,23 +173,6 @@ bool HaveSubscriptionEstablishedRightNow(MTRInternalDeviceState state) return state == MTRInternalDeviceStateInitialSubscriptionEstablished || state == MTRInternalDeviceStateLaterSubscriptionEstablished; } -NSString * InternalDeviceStateString(MTRInternalDeviceState state) -{ - switch (state) { - case MTRInternalDeviceStateUnsubscribed: - return @"Unsubscribed"; - case MTRInternalDeviceStateSubscribing: - return @"Subscribing"; - case MTRInternalDeviceStateInitialSubscriptionEstablished: - return @"InitialSubscriptionEstablished"; - case MTRInternalDeviceStateResubscribing: - return @"Resubscribing"; - case MTRInternalDeviceStateLaterSubscriptionEstablished: - return @"LaterSubscriptionEstablished"; - default: - return @"Unknown"; - } -} } // anonymous namespace typedef NS_ENUM(NSUInteger, MTRDeviceExpectedValueFieldIndex) { @@ -548,62 +531,6 @@ - (void)dealloc MTR_LOG("MTRDevice dealloc: %p", self); } -- (NSString *)description -{ - id _Nullable vid; - id _Nullable pid; - NSNumber * _Nullable networkFeatures; - MTRInternalDeviceState internalDeviceState; - uint32_t lastSubscriptionAttemptWait; - NSDate * _Nullable mostRecentReportTime; - NSDate * _Nullable lastSubscriptionFailureTime; - { - std::lock_guard lock(_descriptionLock); - vid = _vid; - pid = _pid; - networkFeatures = _allNetworkFeatures; - internalDeviceState = _internalDeviceStateForDescription; - lastSubscriptionAttemptWait = _lastSubscriptionAttemptWaitForDescription; - mostRecentReportTime = _mostRecentReportTimeForDescription; - lastSubscriptionFailureTime = _lastSubscriptionFailureTimeForDescription; - } - - if (vid == nil) { - vid = @"Unknown"; - } - - if (pid == nil) { - pid = @"Unknown"; - } - - NSString * wifi; - NSString * thread; - if (networkFeatures == nil) { - wifi = @"NO"; - thread = @"NO"; - } else { - wifi = YES_NO(networkFeatures.unsignedLongLongValue & MTRNetworkCommissioningFeatureWiFiNetworkInterface); - thread = YES_NO(networkFeatures.unsignedLongLongValue & MTRNetworkCommissioningFeatureThreadNetworkInterface); - } - - NSString * reportAge; - if (mostRecentReportTime) { - reportAge = [NSString stringWithFormat:@" (%.0lfs ago)", -[mostRecentReportTime timeIntervalSinceNow]]; - } else { - reportAge = @""; - } - - NSString * subscriptionFailureAge; - if (lastSubscriptionFailureTime) { - subscriptionFailureAge = [NSString stringWithFormat:@" (%.0lfs ago)", -[lastSubscriptionFailureTime timeIntervalSinceNow]]; - } else { - subscriptionFailureAge = @""; - } - - return [NSString - stringWithFormat:@"", self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, vid, pid, wifi, thread, InternalDeviceStateString(internalDeviceState), static_cast(lastSubscriptionAttemptWait), static_cast(_asyncWorkQueue.itemCount), mostRecentReportTime, reportAge, lastSubscriptionFailureTime, subscriptionFailureAge, _deviceController.uniqueIdentifier]; -} - + (MTRDevice *)deviceWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller { return [controller deviceForNodeID:nodeID]; diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index c9f4b7f07d295e..120d29aff122d4 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -58,8 +58,6 @@ // allow readwrite access to superclass properties @interface MTRDevice_Concrete () -@property (nonatomic, readwrite, copy) NSNumber * nodeID; -@property (nonatomic, readwrite, nullable) MTRDeviceController * deviceController; @property (nonatomic, readwrite) MTRAsyncWorkQueue * asyncWorkQueue; @property (nonatomic, readwrite) MTRDeviceState state; @property (nonatomic, readwrite, nullable) NSDate * estimatedStartTime; @@ -356,8 +354,6 @@ @implementation MTRDevice_Concrete { } // synthesize superclass property readwrite accessors -@synthesize nodeID = _nodeID; -@synthesize deviceController = _deviceController; @synthesize queue = _queue; @synthesize asyncWorkQueue = _asyncWorkQueue; @synthesize state = _state; @@ -372,9 +368,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle if (self = [super initForSubclassesWithNodeID:nodeID controller:controller]) { _timeSyncLock = OS_UNFAIR_LOCK_INIT; _descriptionLock = OS_UNFAIR_LOCK_INIT; - _nodeID = [nodeID copy]; _fabricIndex = controller.fabricIndex; - _deviceController = controller; _queue = dispatch_queue_create("org.csa-iot.matter.framework.device.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); _expectedValueCache = [NSMutableDictionary dictionary]; @@ -467,7 +461,7 @@ - (NSString *)description } return [NSString - stringWithFormat:@"", self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, vid, pid, wifi, thread, InternalDeviceStateString(internalDeviceState), static_cast(lastSubscriptionAttemptWait), static_cast(_asyncWorkQueue.itemCount), mostRecentReportTime, reportAge, lastSubscriptionFailureTime, subscriptionFailureAge, _deviceController.uniqueIdentifier]; + stringWithFormat:@"", self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, vid, pid, wifi, thread, InternalDeviceStateString(internalDeviceState), static_cast(lastSubscriptionAttemptWait), static_cast(_asyncWorkQueue.itemCount), mostRecentReportTime, reportAge, lastSubscriptionFailureTime, subscriptionFailureAge, _deviceController.uniqueIdentifier]; } + (MTRDevice *)deviceWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index bce5abfdfed75d..b6a59ac9321d42 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -112,6 +112,14 @@ MTR_DIRECT_MEMBERS // Lock that protects overall device state, including delegate storage. os_unfair_lock _lock; NSMutableSet * _delegates; + + // Our node ID, with the ivar declared explicitly so it's accessible to + // subclasses. + NSNumber * _nodeID; + + // Our controller. Declared nullable because our property is, though in + // practice it does not look like we ever set it to nil. + MTRDeviceController * _Nullable _deviceController; } - (instancetype)initForSubclassesWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller; diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index 7dfb8da370823e..03f318d83517d7 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -93,6 +93,16 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle return self; } +- (NSString *)description +{ + // TODO: Figure out whether, and if so how, to log: VID, PID, WiFi, Thread, + // internalDeviceState (do we even have such a thing here?), last + // subscription attempt wait (does that apply to us?) queued work (do we + // have any?), last report, last subscription failure (does that apply to us?). + return [NSString + stringWithFormat:@"", self, _deviceController.compressedFabricID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, _nodeID.unsignedLongLongValue, _deviceController.uniqueIdentifier]; +} + #pragma mark - Client Callbacks (MTRDeviceDelegate) // required methods for MTRDeviceDelegates From 329c965cc41ed39399a123587efb72639174571a Mon Sep 17 00:00:00 2001 From: sarthak shaha <130495524+Sarthak-Shaha@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:15:25 -0400 Subject: [PATCH 10/53] removed invalid symlinks (#35129) --- .../esp32/external_platform/ESP32_custom/WiFiDnssdImpl.cpp | 1 - .../esp32/external_platform/ESP32_custom/WiFiDnssdImpl.h | 1 - 2 files changed, 2 deletions(-) delete mode 120000 examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.cpp delete mode 120000 examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.h diff --git a/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.cpp b/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.cpp deleted file mode 120000 index 6ca9fce6a3730d..00000000000000 --- a/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.cpp +++ /dev/null @@ -1 +0,0 @@ -../../../../../src/platform/ESP32/WiFiDnssdImpl.cpp \ No newline at end of file diff --git a/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.h b/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.h deleted file mode 120000 index 213e49958733a8..00000000000000 --- a/examples/platform/esp32/external_platform/ESP32_custom/WiFiDnssdImpl.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../src/platform/ESP32/WiFiDnssdImpl.h \ No newline at end of file From 68f0407592806c00b84ac3045c591e7287f3173e Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 21 Aug 2024 14:18:43 -0400 Subject: [PATCH 11/53] Update MCORE_FS_1_2 to latest testplan (#35097) --- src/python_testing/TC_MCORE_FS_1_2.py | 253 +++++++++++++++++--------- 1 file changed, 163 insertions(+), 90 deletions(-) diff --git a/src/python_testing/TC_MCORE_FS_1_2.py b/src/python_testing/TC_MCORE_FS_1_2.py index 1085b0fac0a07c..c199225b33f99c 100644 --- a/src/python_testing/TC_MCORE_FS_1_2.py +++ b/src/python_testing/TC_MCORE_FS_1_2.py @@ -19,27 +19,102 @@ # for details about the block below. # -import base64 +import hashlib import logging +import os import queue +import secrets +import signal +import struct +import subprocess import time +import uuid +from dataclasses import dataclass import chip.clusters as Clusters from chip import ChipDeviceCtrl -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from ecdsa.curves import NIST256p +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches from mobly import asserts from TC_SC_3_6 import AttributeChangeAccumulator +# Length of `w0s` and `w1s` elements +WS_LENGTH = NIST256p.baselen + 8 + + +def _generate_verifier(passcode: int, salt: bytes, iterations: int) -> bytes: + ws = hashlib.pbkdf2_hmac('sha256', struct.pack('>> pairing onnetwork 111 {setup_params.passcode}") + def steps_TC_MCORE_FS_1_2(self) -> list[TestStep]: - steps = [TestStep(1, "TH_FSA subscribes to all the Bridged Device Basic Information clusters provided by DUT_FSA to identify the presence of a Bridged Node endpoint with a UniqueID matching the UniqueID provided by the BasicInformationCluster of the TH_SED_DUT."), - TestStep(2, "TH_FSA initiates commissioning of TH_SED_DUT by sending the OpenCommissioningWindow command to the Administrator Commissioning Cluster on the endpoint with the uniqueID matching that of TH_SED_DUT."), - TestStep(3, "TH_FSA completes commissioning of TH_SED_DUT using the Enhanced Commissioning Method."), - TestStep(4, "Commission TH_SED_L onto DUT_FSA’s fabric using the manufacturer specified mechanism."), - TestStep(5, "TH_FSA waits for subscription report from a the Bridged Device Basic Information clusters provided by DUT_FSA to identify the presence of a Bridged Node endpoint with a UniqueID matching the UniqueID provided by the BasicInformationCluster of the TH_SED_L."), - TestStep(6, "TH_FSA initiates commissions of TH_SED_L by sending the OpenCommissioningWindow command to the Administrator Commissioning Cluster on the endpoint with the uniqueID matching that of TH_SED_L."), - TestStep(7, "TH_FSA completes commissioning of TH_SED_L using the Enhanced Commissioning Method.")] + steps = [TestStep(1, "TH subscribes to PartsList attribute of the Descriptor cluster of DUT_FSA endpoint 0."), + TestStep(2, "Follow manufacturer provided instructions to have DUT_FSA commission TH_SERVER"), + TestStep(3, "TH waits up to 30 seconds for subscription report from the PartsList attribute of the Descriptor to contain new endpoint"), + + TestStep(4, "TH uses DUT to open commissioning window to TH_SERVER"), + TestStep(5, "TH commissions TH_SERVER"), + TestStep(6, "TH reads all attributes in Basic Information cluster from TH_SERVER directly"), + TestStep(7, "TH reads all attributes in the Bridged Device Basic Information cluster on new endpoint identified in step 3 from the DUT_FSA")] return steps @property @@ -49,16 +124,21 @@ def default_timeout(self) -> int: @async_test_body async def test_TC_MCORE_FS_1_2(self): self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') + min_report_interval_sec = self.user_params.get("min_report_interval_sec", 0) - max_report_interval_sec = self.user_params.get("max_report_interval_sec", 2) - report_waiting_timeout_delay_sec = self.user_params.get("report_waiting_timeout_delay_sec", 10) + max_report_interval_sec = self.user_params.get("max_report_interval_sec", 30) + th_server_port = self.user_params.get("th_server_port", 5543) + self._th_server_app_path = self.user_params.get("th_server_app_path", None) + if not self._th_server_app_path: + asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') + if not os.path.exists(self._th_server_app_path): + asserts.fail(f'The path {self._th_server_app_path} does not exist') self.step(1) - - # Subscribe to the UniqueIDs - unique_id_queue = queue.Queue() + # Subscribe to the PartsList + root_endpoint = 0 subscription_contents = [ - (Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID) # On all endpoints + (root_endpoint, Clusters.Descriptor.Attributes.PartsList) ] sub = await self.default_controller.ReadAttribute( nodeid=self.dut_node_id, @@ -66,82 +146,38 @@ async def test_TC_MCORE_FS_1_2(self): reportInterval=(min_report_interval_sec, max_report_interval_sec), keepSubscriptions=False ) + + parts_list_queue = queue.Queue() attribute_handler = AttributeChangeAccumulator( - name=self.default_controller.name, expected_attribute=Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID, output=unique_id_queue) + name=self.default_controller.name, expected_attribute=Clusters.Descriptor.Attributes.PartsList, output=parts_list_queue) sub.SetAttributeUpdateCallback(attribute_handler) + cached_attributes = sub.GetAttributes() + step_1_dut_parts_list = cached_attributes[root_endpoint][Clusters.Descriptor][Clusters.Descriptor.Attributes.PartsList] - logging.info("Waiting for First BridgedDeviceBasicInformation.") - start_time = time.time() - elapsed = 0 - time_remaining = report_waiting_timeout_delay_sec - - th_sed_dut_bdbi_endpoint = -1 - th_sed_dut_unique_id = -1 - - while time_remaining > 0 and th_sed_dut_bdbi_endpoint < 0: - try: - item = unique_id_queue.get(block=True, timeout=time_remaining) - endpoint, attribute, value = item['endpoint'], item['attribute'], item['value'] - - # Record arrival of an expected subscription change when seen - if attribute == Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID: - th_sed_dut_bdbi_endpoint = endpoint - th_sed_dut_unique_id = value - - except queue.Empty: - # No error, we update timeouts and keep going - pass - - elapsed = time.time() - start_time - time_remaining = report_waiting_timeout_delay_sec - elapsed - - asserts.assert_greater(th_sed_dut_bdbi_endpoint, 0, "Failed to find any BDBI instances with UniqueID present.") - logging.info("Found BDBI with UniqueID (%d) on endpoint %d." % th_sed_dut_unique_id, th_sed_dut_bdbi_endpoint) + asserts.assert_true(type_matches(step_1_dut_parts_list, list), "PartsList is expected to be a list") self.step(2) - - self.sync_passcode = 20202024 - self.th_sed_dut_discriminator = 2222 - cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, - PAKEPasscodeVerifier=b"+w1qZQR05Zn0bc2LDyNaDAhsrhDS5iRHPTN10+EmNx8E2OpIPC4SjWRDQVOgqcbnXdYMlpiZ168xLBqn1fx9659gGK/7f9Yc6GxpoJH8kwAUYAYyLGsYeEBt1kL6kpXjgA==", - discriminator=self.th_sed_dut_discriminator, - iterations=10000, salt=base64.b64encode(bytes('SaltyMcSalterson', 'utf-8'))) - await self.send_single_cmd(cmd, endpoint=th_sed_dut_bdbi_endpoint, timedRequestTimeoutMs=5000) - - logging.info("Commissioning Window open for TH_SED_DUT.") + setup_params = await self._create_th_server(th_server_port) + self._ask_for_vendor_commissioning_ux_operation(setup_params) self.step(3) - - self.th_sed_dut_nodeid = 1111 - await self.TH_server_controller.CommissionOnNetwork(nodeId=self.th_sed_dut_nodeid, setupPinCode=self.sync_passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.th_sed_dut_discriminator) - logging.info("Commissioning TH_SED_DUT complete") - - self.step(4) - if not self.is_ci: - self.wait_for_user_input( - "Commission TH_SED_DUT onto DUT_FSA’s fabric using the manufacturer specified mechanism. (ensure Synchronization is enabled.)") - else: - logging.info("Stopping after step 3 while running in CI to avoid manual steps.") - return - - self.step(5) - - th_sed_later_bdbi_endpoint = -1 - th_sed_later_unique_id = -1 - logging.info("Waiting for Second BridgedDeviceBasicInformation.") + report_waiting_timeout_delay_sec = 30 + logging.info("Waiting for update to PartsList.") start_time = time.time() elapsed = 0 time_remaining = report_waiting_timeout_delay_sec - while time_remaining > 0 and th_sed_later_bdbi_endpoint < 0: + parts_list_endpoint_count_from_step_1 = len(step_1_dut_parts_list) + step_3_dut_parts_list = None + while time_remaining > 0: try: - item = unique_id_queue.get(block=True, timeout=time_remaining) + item = parts_list_queue.get(block=True, timeout=time_remaining) endpoint, attribute, value = item['endpoint'], item['attribute'], item['value'] # Record arrival of an expected subscription change when seen - if attribute == Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID and endpoint != th_sed_dut_bdbi_endpoint and th_sed_later_unique_id != th_sed_dut_unique_id: - th_sed_later_bdbi_endpoint = endpoint - th_sed_later_unique_id = value + if endpoint == root_endpoint and attribute == Clusters.Descriptor.Attributes.PartsList and len(value) > parts_list_endpoint_count_from_step_1: + step_3_dut_parts_list = value + break except queue.Empty: # No error, we update timeouts and keep going @@ -150,26 +186,63 @@ async def test_TC_MCORE_FS_1_2(self): elapsed = time.time() - start_time time_remaining = report_waiting_timeout_delay_sec - elapsed - asserts.assert_greater(th_sed_later_bdbi_endpoint, 0, "Failed to find any BDBI instances with UniqueID present.") - logging.info("Found another BDBI with UniqueID (%d) on endpoint %d." % th_sed_later_unique_id, th_sed_later_bdbi_endpoint) + asserts.assert_not_equal(step_3_dut_parts_list, None, "Timed out getting updated PartsList with new endpoint") + set_of_step_1_parts_list_endpoint = set(step_1_dut_parts_list) + set_of_step_3_parts_list_endpoint = set(step_3_dut_parts_list) + unique_endpoints_set = set_of_step_3_parts_list_endpoint - set_of_step_1_parts_list_endpoint + asserts.assert_equal(len(unique_endpoints_set), 1, "Expected only one new endpoint") + newly_added_endpoint = list(unique_endpoints_set)[0] - self.step(6) + self.step(4) - self.th_sed_later_discriminator = 3333 - # min commissioning timeout is 3*60 seconds, so use that even though the command said 30. + discriminator = 3840 + passcode = 20202021 + salt = secrets.token_bytes(16) + iterations = 2000 + verifier = _generate_verifier(passcode, salt, iterations) + + # min commissioning timeout is 3*60 seconds cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, - PAKEPasscodeVerifier=b"+w1qZQR05Zn0bc2LDyNaDAhsrhDS5iRHPTN10+EmNx8E2OpIPC4SjWRDQVOgqcbnXdYMlpiZ168xLBqn1fx9659gGK/7f9Yc6GxpoJH8kwAUYAYyLGsYeEBt1kL6kpXjgA==", - discriminator=self.th_sed_later_discriminator, - iterations=10000, salt=base64.b64encode(bytes('SaltyMcSalterson', 'utf-8'))) - await self.send_single_cmd(cmd, endpoint=th_sed_later_bdbi_endpoint, timedRequestTimeoutMs=5000) + PAKEPasscodeVerifier=verifier, + discriminator=discriminator, + iterations=iterations, + salt=salt) + await self.send_single_cmd(cmd, dev_ctrl=self.default_controller, node_id=self.dut_node_id, endpoint=newly_added_endpoint, timedRequestTimeoutMs=5000) - logging.info("Commissioning Window open for TH_SED_L.") + self.step(5) + self.th_server_local_nodeid = 1111 + await self.default_controller.CommissionOnNetwork(nodeId=self.th_server_local_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) - self.step(7) + self.step(6) + th_server_directly_read_result = await self.default_controller.ReadAttribute(self.th_server_local_nodeid, [(root_endpoint, Clusters.BasicInformation)]) + th_server_basic_info = th_server_directly_read_result[root_endpoint][Clusters.BasicInformation] - self.th_sed_later_nodeid = 2222 - await self.TH_server_controller.CommissionOnNetwork(nodeId=self.th_sed_later_nodeid, setupPinCode=self.sync_passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.th_sed_later_discriminator) - logging.info("Commissioning TH_SED_L complete") + self.step(7) + dut_read = await self.default_controller.ReadAttribute(self.dut_node_id, [(newly_added_endpoint, Clusters.BridgedDeviceBasicInformation)]) + bridged_info_for_th_server = dut_read[newly_added_endpoint][Clusters.BridgedDeviceBasicInformation] + basic_info_attr = Clusters.BasicInformation.Attributes + bridged_device_info_attr = Clusters.BridgedDeviceBasicInformation.Attributes + Clusters.BasicInformation.Attributes + asserts.assert_equal(th_server_basic_info[basic_info_attr.VendorName], + bridged_info_for_th_server[bridged_device_info_attr.VendorName], "VendorName incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.VendorID], + bridged_info_for_th_server[bridged_device_info_attr.VendorID], "VendorID incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.ProductName], + bridged_info_for_th_server[bridged_device_info_attr.ProductName], "ProductName incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.ProductID], + bridged_info_for_th_server[bridged_device_info_attr.ProductID], "ProductID incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.NodeLabel], + bridged_info_for_th_server[bridged_device_info_attr.NodeLabel], "NodeLabel incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.HardwareVersion], + bridged_info_for_th_server[bridged_device_info_attr.HardwareVersion], "HardwareVersion incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.HardwareVersionString], + bridged_info_for_th_server[bridged_device_info_attr.HardwareVersionString], "HardwareVersionString incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.SoftwareVersion], + bridged_info_for_th_server[bridged_device_info_attr.SoftwareVersion], "SoftwareVersion incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.SoftwareVersionString], + bridged_info_for_th_server[bridged_device_info_attr.SoftwareVersionString], "SoftwareVersionString incorrectly reported by DUT") + asserts.assert_equal(th_server_basic_info[basic_info_attr.UniqueID], + bridged_info_for_th_server[bridged_device_info_attr.UniqueID], "UniqueID incorrectly reported by DUT") if __name__ == "__main__": From fe20d1901a4991627ead3df3868ae5cce53358f8 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:32:51 -0400 Subject: [PATCH 12/53] Removed Arithmetics operations relying on Unit test cluster from TC_S_2_2 and TC_S_2_3 (#35130) --- .../suites/certification/Test_TC_S_2_2.yaml | 33 ++----------------- .../suites/certification/Test_TC_S_2_3.yaml | 33 ++----------------- 2 files changed, 4 insertions(+), 62 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml index bdb3d2b8ad90db..7e5121680ceffd 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml @@ -50,36 +50,6 @@ tests: - name: "SceneTableSize" saveAs: maxScenes - - label: "Arithmetic operation to get the maxScenes - 1" - cluster: "Unit Testing" - command: "TestAddArguments" - arguments: - values: - - name: "arg1" - value: maxScenes - 1 - - name: "arg2" - value: 0 - response: - values: - - name: "returnValue" - saveAs: maxScenesMinusOne - value: maxScenes - 1 - - - label: "Arithmetic operation to get the fabric Capacity" - cluster: "Unit Testing" - command: "TestAddArguments" - arguments: - values: - - name: "arg1" - value: maxScenesMinusOne / 2 - - name: "arg2" - value: 0 - response: - values: - - name: "returnValue" - saveAs: fabricCapacity - value: maxScenesMinusOne / 2 - - label: "Step 0a :TH reads attribute {ServerList} from the Descriptor cluster of the endpoint that implements the Scenes Management server on the @@ -202,7 +172,8 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: fabricCapacity + value: (maxScenes - 1) / 2 + saveAs: fabricCapacity - name: "GroupID" value: G1 diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index 5a76916edb39b7..817ab532bad66c 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -50,36 +50,6 @@ tests: - name: "SceneTableSize" saveAs: maxScenes - - label: "Arithmetic operation to get the maxScenes - 1" - cluster: "Unit Testing" - command: "TestAddArguments" - arguments: - values: - - name: "arg1" - value: maxScenes - 1 - - name: "arg2" - value: 0 - response: - values: - - name: "returnValue" - saveAs: maxScenesMinusOne - value: maxScenes - 1 - - - label: "Arithmetic operation to get the fabric Capacity" - cluster: "Unit Testing" - command: "TestAddArguments" - arguments: - values: - - name: "arg1" - value: maxScenesMinusOne / 2 - - name: "arg2" - value: 0 - response: - values: - - name: "returnValue" - saveAs: fabricCapacity - value: maxScenesMinusOne / 2 - - label: "Step 0a: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT using a key that is pre-installed on the TH. @@ -259,7 +229,8 @@ tests: - name: "Status" value: 0x00 - name: "Capacity" - value: fabricCapacity + value: (maxScenes - 1) / 2 + saveAs: fabricCapacity - name: "GroupID" value: G1 - name: "SceneList" From 85bdb2e05f3d9e48070710b064525b002f874725 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 21 Aug 2024 14:37:32 -0400 Subject: [PATCH 13/53] Add expiry to KeepActive as per spec into fabric-admin example (#35099) * Add expiry to KeepActive as per spec into fabric-admin example * Restyled by clang-format * Self Review fix * Restyled by clang-format * Name fix * Address PR comments * Address PR comments * Restyled by clang-format * Address PR comments --------- Co-authored-by: Restyled.io --- examples/fabric-admin/rpc/RpcServer.cpp | 52 +++++++++++++++++++------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index d56399514ad96f..fca25c25a1301a 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -47,20 +47,32 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate public: void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) override { - chip::NodeId nodeId = clientInfo.peer_node.GetNodeId(); - auto it = mPendingKeepActiveTimesMs.find(nodeId); - VerifyOrReturn(it != mPendingKeepActiveTimesMs.end()); - // TODO(#33221): We also need a mechanism here to drop KeepActive - // request if they were recieved over 60 mins ago. - uint32_t stayActiveDurationMs = it->second; + // Needs for accessing mPendingCheckIn + assertChipStackLockedByCurrentThread(); + NodeId nodeId = clientInfo.peer_node.GetNodeId(); + auto it = mPendingCheckIn.find(nodeId); + VerifyOrReturn(it != mPendingCheckIn.end()); + + KeepActiveDataForCheckIn checkInData = it->second; + // Removed from pending map as check-in from this node has occured and we will handle the pending KeepActive + // request. + mPendingCheckIn.erase(nodeId); + + auto timeNow = System::SystemClock().GetMonotonicTimestamp(); + if (timeNow > checkInData.mRequestExpiryTimestamp) + { + ChipLogError( + NotSpecified, + "ICD check-in for device we have been waiting, came after KeepActive expiry. Reqeust dropped for Node ID: 0x%lx", + nodeId); + return; + } // TODO(#33221): If there is a failure in sending the message this request just gets dropped. // Work to see if there should be update to spec on whether some sort of failure later on // Should be indicated in some manner, or identify a better recovery mechanism here. - mPendingKeepActiveTimesMs.erase(nodeId); - auto onDone = [=](uint32_t promisedActiveDuration) { ActiveChanged(nodeId, promisedActiveDuration); }; - CHIP_ERROR err = StayActiveSender::SendStayActiveCommand(stayActiveDurationMs, clientInfo.peer_node, + CHIP_ERROR err = StayActiveSender::SendStayActiveCommand(checkInData.mStayActiveDurationMs, clientInfo.peer_node, chip::app::InteractionModelEngine::GetInstance(), onDone); if (err != CHIP_NO_ERROR) { @@ -147,10 +159,24 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate void ScheduleSendingKeepActiveOnCheckIn(chip::NodeId nodeId, uint32_t stayActiveDurationMs) { - mPendingKeepActiveTimesMs[nodeId] = stayActiveDurationMs; + // Needs for accessing mPendingCheckIn + assertChipStackLockedByCurrentThread(); + + auto timeNow = System::SystemClock().GetMonotonicTimestamp(); + // Spec says we should expire the request 60 mins after we get it + System::Clock::Timestamp expiryTimestamp = timeNow + System::Clock::Seconds64(60 * 60); + KeepActiveDataForCheckIn checkInData = { .mStayActiveDurationMs = stayActiveDurationMs, + .mRequestExpiryTimestamp = expiryTimestamp }; + mPendingCheckIn[nodeId] = checkInData; } private: + struct KeepActiveDataForCheckIn + { + uint32_t mStayActiveDurationMs = 0; + System::Clock::Timestamp mRequestExpiryTimestamp; + }; + struct KeepActiveWorkData { KeepActiveWorkData(FabricAdmin * fabricAdmin, chip::NodeId nodeId, uint32_t stayActiveDurationMs) : @@ -169,8 +195,10 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate chip::Platform::Delete(data); } - // Modifications to mPendingKeepActiveTimesMs should be done on the MatterEventLoop thread - std::map mPendingKeepActiveTimesMs; + // Modifications to mPendingCheckIn should be done on the MatterEventLoop thread + // otherwise we would need a mutex protecting this data to prevent race as this + // data is accessible by both RPC thread and Matter eventloop. + std::unordered_map mPendingCheckIn; }; FabricAdmin fabric_admin_service; From 6f22db05ca340fb001cc9a9ee58bf5fd37a5e5a1 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 21 Aug 2024 15:15:25 -0400 Subject: [PATCH 14/53] Move TC_BR_5 to the right directory (#35128) --- scripts/tests/chiptest/__init__.py | 2 +- .../Test_TC_BR_5.yaml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/app/tests/suites/{TestFabricSyncBridgedNode.yaml => certification/Test_TC_BR_5.yaml} (96%) diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index d85e82fec6fa6c..aef22e030eae8d 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -157,7 +157,7 @@ def _GetInDevelopmentTests() -> Set[str]: # TestEventTriggersEnabled is true, which it's not in CI. "Test_TC_SMOKECO_2_6.yaml", # chip-repl does not support local timeout (07/20/2023) and test assumes # TestEventTriggersEnabled is true, which it's not in CI. - "TestFabricSyncBridgedNode.yaml", # [TODO] fabric-bridge-app lacks some feature so this test currently fails + "Test_TC_BR_5.yaml", # [TODO] Fabric Sync example app has not been integrated into CI yet. } diff --git a/src/app/tests/suites/TestFabricSyncBridgedNode.yaml b/src/app/tests/suites/certification/Test_TC_BR_5.yaml similarity index 96% rename from src/app/tests/suites/TestFabricSyncBridgedNode.yaml rename to src/app/tests/suites/certification/Test_TC_BR_5.yaml index 6624e710127442..958f98d076884f 100644 --- a/src/app/tests/suites/TestFabricSyncBridgedNode.yaml +++ b/src/app/tests/suites/certification/Test_TC_BR_5.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Test Fabric Synchronization condition on Bridged Node Device Type +name: 3.1.5. [TC-BR-5] Conditions for Fabric Synchronization (DUT server) PICS: - MCORE.FS From 4d5beae7ecf5e4e1aa5423139e632e43228e91d5 Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:03:36 -0700 Subject: [PATCH 15/53] =?UTF-8?q?Update=20the=20preset=20handle=20field=20?= =?UTF-8?q?in=20the=20SetActivePresetRequest=20c=E2=80=A6=20(#35105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update the preset handle field in the SetActivePresetRequestRequest command to be nullable - Update the deleagte API for getting the active preset handle to return a nullable handle * Return error if CopySpanToMutableSpan fails * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Boris Zbarsky --------- Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- .../air-purifier-app.matter | 2 +- .../all-clusters-app.matter | 2 +- .../all-clusters-minimal-app.matter | 2 +- ...umiditysensor_thermostat_56de3d5f45.matter | 2 +- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 2 +- ...tnode_roomairconditioner_9cf3607804.matter | 2 +- .../rootnode_thermostat_bm3fb8dhYi.matter | 2 +- .../placeholder/linux/apps/app1/config.matter | 4 +-- .../placeholder/linux/apps/app2/config.matter | 4 +-- .../linux/include/thermostat-delegate-impl.h | 2 +- .../linux/thermostat-delegate-impl.cpp | 14 +++++++++-- .../nxp/zap/thermostat_matter_thread.matter | 2 +- .../nxp/zap/thermostat_matter_wifi.matter | 2 +- .../qpg/zap/thermostaticRadiatorValve.matter | 2 +- .../thermostat-common/thermostat.matter | 2 +- .../thermostat-server/thermostat-delegate.h | 7 +++--- .../thermostat-server/thermostat-server.cpp | 25 ++++++++----------- .../data-model/chip/thermostat-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipClusters.java | 6 ++--- .../cluster/clusters/ThermostatCluster.kt | 4 +-- .../python/chip/clusters/Objects.py | 4 +-- .../zap-generated/MTRCommandPayloadsObjc.h | 2 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 9 +++++-- .../zap-generated/cluster-objects.h | 4 +-- .../zap-generated/cluster/Commands.h | 6 ++++- 26 files changed, 65 insertions(+), 52 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index cb1c102b239f3e..c35b8b62e24ee6 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1856,7 +1856,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index c18c6164c5c717..4180b1eef78e26 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -5696,7 +5696,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 16f170c1379591..363da41015d0b0 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -4130,7 +4130,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index ed130f29318062..d47b3a90922d57 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1779,7 +1779,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index ec62d4504f8601..84b5d949b6eeba 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -2136,7 +2136,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 95e0ba20d4adcb..20b7d6b80d35f5 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1719,7 +1719,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 6c27235c7d3ade..ae6441c2eaebea 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1939,7 +1939,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 8befb87daa5f9a..33521a7a93fa75 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -5414,7 +5414,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { @@ -5769,7 +5769,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 6cfcc1ab7ea6cf..86d20b24a4f629 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -5371,7 +5371,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { @@ -5726,7 +5726,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index 8252f2274f9d79..6bf9d02cea462f 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -54,7 +54,7 @@ class ThermostatDelegate : public Delegate CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; - CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; + CHIP_ERROR GetActivePresetHandle(DataModel::Nullable & activePresetHandle) override; CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index c39a757a8b0644..b931db20b7c4f7 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -117,9 +117,19 @@ CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOw return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; } -CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) +CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(DataModel::Nullable & activePresetHandle) { - return CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); + if (mActivePresetHandleDataSize != 0) + { + ReturnErrorOnFailure( + CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle.Value())); + activePresetHandle.Value().reduce_size(mActivePresetHandleDataSize); + } + else + { + activePresetHandle.SetNull(); + } + return CHIP_NO_ERROR; } CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 001e1b43ace09d..cbe6a6280d8ec4 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -2530,7 +2530,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 066afc85509947..cd9ddc362e36ce 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -2441,7 +2441,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 31e5775d88148f..548db02c520b9a 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -2138,7 +2138,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index c53651c537894e..a66c2dfdad68ba 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -2318,7 +2318,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index c8c21d898af167..0f89f69468099b 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -78,11 +78,10 @@ class Delegate /** * @brief Get the ActivePresetHandle attribute value. * - * @param[out] activePresetHandle The MutableByteSpan to copy the active preset handle into. On success, - * the callee must update the length to the length of the copied data. If the value of - * the attribute is null, the callee must set the MutableByteSpan to empty. + * @param[out] activePresetHandle The nullable MutableByteSpan to copy the active preset handle into. On success, + * the size of the activePresetHandle is updated to the length of the copied data. */ - virtual CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) = 0; + virtual CHIP_ERROR GetActivePresetHandle(DataModel::Nullable & activePresetHandle) = 0; /** * @brief Set the ActivePresetHandle attribute value. diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 91c045c5ff540e..8fe70211eeda1a 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -761,19 +761,13 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); uint8_t buffer[kPresetHandleSize]; - MutableByteSpan activePresetHandle(buffer); + MutableByteSpan activePresetHandleSpan(buffer); + auto activePresetHandle = DataModel::MakeNullable(activePresetHandleSpan); CHIP_ERROR err = delegate->GetActivePresetHandle(activePresetHandle); ReturnErrorOnFailure(err); - if (activePresetHandle.empty()) - { - ReturnErrorOnFailure(aEncoder.EncodeNull()); - } - else - { - ReturnErrorOnFailure(aEncoder.Encode(activePresetHandle)); - } + ReturnErrorOnFailure(aEncoder.Encode(activePresetHandle)); } break; case ScheduleTypes::Id: { @@ -1299,16 +1293,16 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( return true; } - ByteSpan newPresetHandle = commandData.presetHandle; + DataModel::Nullable newPresetHandle = commandData.presetHandle; // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. - if (!IsPresetHandlePresentInPresets(delegate, newPresetHandle)) + if (!newPresetHandle.IsNull() && !IsPresetHandlePresentInPresets(delegate, newPresetHandle.Value())) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; } - CHIP_ERROR err = delegate->SetActivePresetHandle(DataModel::MakeNullable(newPresetHandle)); + CHIP_ERROR err = delegate->SetActivePresetHandle(newPresetHandle); if (err != CHIP_NO_ERROR) { @@ -1470,7 +1464,8 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle // attribute set, continue with other checks. uint8_t buffer[kPresetHandleSize]; - MutableByteSpan activePresetHandle(buffer); + MutableByteSpan activePresetHandleSpan(buffer); + auto activePresetHandle = DataModel::MakeNullable(activePresetHandleSpan); err = delegate->GetActivePresetHandle(activePresetHandle); @@ -1479,9 +1474,9 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) return imcode::InvalidInState; } - if (!activePresetHandle.empty()) + if (!activePresetHandle.IsNull()) { - uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle); + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle.Value()); if (count == 0) { return imcode::InvalidInState; diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 546692b1a42030..6f75aa45e985f6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -481,7 +481,7 @@ limitations under the License. ID - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index bfb1354849c9c4..52f43c048aed14 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6994,7 +6994,7 @@ cluster Thermostat = 513 { } request struct SetActivePresetRequestRequest { - octet_string<16> presetHandle = 0; + nullable octet_string<16> presetHandle = 0; } response struct AtomicResponse = 253 { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 6f3e6f62d340e7..cf344db593f46a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -40637,16 +40637,16 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle) { + public void setActivePresetRequest(DefaultClusterCallback callback, @Nullable byte[] presetHandle) { setActivePresetRequest(callback, presetHandle, 0); } - public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle, int timedInvokeTimeoutMs) { + public void setActivePresetRequest(DefaultClusterCallback callback, @Nullable byte[] presetHandle, int timedInvokeTimeoutMs) { final long commandId = 6L; ArrayList elements = new ArrayList<>(); final long presetHandleFieldID = 0L; - BaseTLVType presetHandletlvValue = new ByteArrayType(presetHandle); + BaseTLVType presetHandletlvValue = presetHandle != null ? new ByteArrayType(presetHandle) : new NullType(); elements.add(new StructElement(presetHandleFieldID, presetHandletlvValue)); StructType commandArgs = new StructType(elements); diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt index b9166c12e937a1..6f193e694ef34f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt @@ -504,7 +504,7 @@ class ThermostatCluster(private val controller: MatterController, private val en } suspend fun setActivePresetRequest( - presetHandle: ByteArray, + presetHandle: ByteArray?, timedInvokeTimeout: Duration? = null, ) { val commandId: UInt = 6u @@ -513,7 +513,7 @@ class ThermostatCluster(private val controller: MatterController, private val en tlvWriter.startStructure(AnonymousTag) val TAG_PRESET_HANDLE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_PRESET_HANDLE_REQ), presetHandle) + presetHandle?.let { tlvWriter.put(ContextSpecificTag(TAG_PRESET_HANDLE_REQ), presetHandle) } tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 6b8ecd1c82b577..624f42c8e80088 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -33168,10 +33168,10 @@ class SetActivePresetRequest(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="presetHandle", Tag=0, Type=bytes), + ClusterObjectFieldDescriptor(Label="presetHandle", Tag=0, Type=typing.Union[Nullable, bytes]), ]) - presetHandle: 'bytes' = b"" + presetHandle: 'typing.Union[Nullable, bytes]' = NullValue @dataclass class AtomicResponse(ClusterCommand): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 5c869616268ecc..a5934b16975260 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7929,7 +7929,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRThermostatClusterSetActivePresetRequestParams : NSObject -@property (nonatomic, copy) NSData * _Nonnull presetHandle MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nullable presetHandle MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 1334d8beba2654..5ae975508e9b75 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -22697,7 +22697,7 @@ - (instancetype)init { if (self = [super init]) { - _presetHandle = [NSData data]; + _presetHandle = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -22730,7 +22730,12 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::Type encodableStruct; ListFreer listFreer; { - encodableStruct.presetHandle = AsByteSpan(self.presetHandle); + if (self.presetHandle == nil) { + encodableStruct.presetHandle.SetNull(); + } else { + auto & nonNullValue_0 = encodableStruct.presetHandle.SetNonNull(); + nonNullValue_0 = AsByteSpan(self.presetHandle); + } } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); 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 e18b64797bb595..c2c1697ce271f3 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 @@ -30149,7 +30149,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::SetActivePresetRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - chip::ByteSpan presetHandle; + DataModel::Nullable presetHandle; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -30164,7 +30164,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::SetActivePresetRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - chip::ByteSpan presetHandle; + DataModel::Nullable presetHandle; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetActivePresetRequest diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 004bb29c546d1e..dc438df840c885 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -107995,7 +107995,11 @@ class ThermostatSetActivePresetRequest : public ClusterCommand { __auto_type * params = [[MTRThermostatClusterSetActivePresetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL - params.presetHandle = [NSData dataWithBytes:mRequest.presetHandle.data() length:mRequest.presetHandle.size()]; + if (mRequest.presetHandle.IsNull()) { + params.presetHandle = nil; + } else { + params.presetHandle = [NSData dataWithBytes:mRequest.presetHandle.Value().data() length:mRequest.presetHandle.Value().size()]; + } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; From 2302c57932101f880df969cd7907d905ef33f467 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 21 Aug 2024 13:05:25 -0700 Subject: [PATCH 16/53] Fix fabric-bridge is accidentally added into sync list (#35132) --- .../commands/pairing/DeviceSynchronization.cpp | 6 +++++- examples/fabric-admin/device_manager/DeviceManager.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/fabric-admin/commands/pairing/DeviceSynchronization.cpp b/examples/fabric-admin/commands/pairing/DeviceSynchronization.cpp index 3974761fdc4bc2..69ca9cdb722b23 100644 --- a/examples/fabric-admin/commands/pairing/DeviceSynchronization.cpp +++ b/examples/fabric-admin/commands/pairing/DeviceSynchronization.cpp @@ -24,6 +24,7 @@ #include #include +#include using namespace ::chip; using namespace ::chip::app; @@ -120,7 +121,10 @@ void DeviceSynchronizer::OnReportEnd() { // Report end is at the end of all attributes (success) #if defined(PW_RPC_ENABLED) - AddSynchronizedDevice(mCurrentDeviceData); + if (!DeviceMgr().IsCurrentBridgeDevice(mCurrentDeviceData.node_id)) + { + AddSynchronizedDevice(mCurrentDeviceData); + } #else ChipLogError(NotSpecified, "Cannot synchronize device with fabric bridge: RPC not enabled"); #endif diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index 1fb2ad52249938..fa94f3d09d18cf 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -75,6 +75,15 @@ class DeviceManager : public PairingDelegate void RemoveSyncedDevice(chip::NodeId nodeId); + /** + * @brief Determines whether a given nodeId corresponds to the "current bridge device," either local or remote. + * + * @param nodeId The ID of the node being checked. + * + * @return true if the nodeId matches either the local or remote bridge device; otherwise, false. + */ + bool IsCurrentBridgeDevice(chip::NodeId nodeId) const { return nodeId == mLocalBridgeNodeId || nodeId == mRemoteBridgeNodeId; } + /** * @brief Open the commissioning window for a specific device within its own fabric. * From 3cdef41e1d548bb0eeccc647a5c4ff64874936cd Mon Sep 17 00:00:00 2001 From: Harshith-GRL <145322529+Harshith-GRL@users.noreply.github.com> Date: Thu, 22 Aug 2024 02:21:57 +0530 Subject: [PATCH 17/53] Yaml scripts update (#35093) * Removed scripts Test_TC_SC_4_10.yaml and Test_TC_SC_4_5.yaml as Test plan have removed them * step numbers corrected in Test_TC_CC_7_3.yaml and action id is updated in Test_TC_ACT_3_2.yaml * Removed scripts Test_TC_SC_4_10.yaml and Test_TC_SC_4_5.yaml as Test plan have removed them * step numbers corrected in Test_TC_CC_7_3.yaml and action id is updated in Test_TC_ACT_3_2.yaml * Reverted Action of Test_TC_ACT_3_2.yaml --- .../suites/certification/Test_TC_ACT_3_2.yaml | 6 +- .../suites/certification/Test_TC_CC_7_3.yaml | 20 ++-- .../suites/certification/Test_TC_SC_4_10.yaml | 60 ------------ .../suites/certification/Test_TC_SC_4_5.yaml | 92 ------------------- 4 files changed, 13 insertions(+), 165 deletions(-) delete mode 100644 src/app/tests/suites/certification/Test_TC_SC_4_10.yaml delete mode 100644 src/app/tests/suites/certification/Test_TC_SC_4_5.yaml diff --git a/src/app/tests/suites/certification/Test_TC_ACT_3_2.yaml b/src/app/tests/suites/certification/Test_TC_ACT_3_2.yaml index 914718896d97ca..cc409a67c6611d 100644 --- a/src/app/tests/suites/certification/Test_TC_ACT_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_ACT_3_2.yaml @@ -33,7 +33,7 @@ tests: "Step 0: Preparation: TH as server exposes an Actions server cluster on EP 1, with one action (supporting all possible commands) and corresponding ActionLists and EndpointLists attributes: ActionList: - contains one list element (ActionListStruct): ActionIO = 0x1001 Name + contains one list element (ActionListStruct): ActionIO = 0xA001 Name = 'some test' Type = other EndpointListID = 0xE001 SupportedCommands = 0x0fff // suppports all commands State = Inactive EndpointLists: contains one list element @@ -92,13 +92,13 @@ tests: 2. Use the above obtained ActionID to verify the following commands - ./chip-tool actions instant-action 4097 1 1 + ./chip-tool actions instant-action 40961 1 1 disabled: true - label: "Step 1: DUT issues an InstantAction command to TH" PICS: ACT.C.C00.Tx verification: | - ./chip-tool actions instant-action 4097 1 1 + ./chip-tool actions instant-action 40961 1 1 Via the TH (bridge-app), verify the InstantAction response that contains ActionID . diff --git a/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml index bfdfd26ed3ca1a..4aae05d10fd1cd 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml @@ -162,7 +162,7 @@ tests: maxValue: 13800 - label: - "Step 5a: TH sends EnhancedMoveToHue command to DUT with + "Step 3a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=12000, Direction=0x00 (shortest distance) and TransitionTime=0 (immediately)." PICS: CC.S.F01 && CC.S.C40.Rsp @@ -190,7 +190,7 @@ tests: value: 100 - label: - "Step 5b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 + "Step 3b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 (down), StepSize=6000 and TransitionTime=300 (30s)" PICS: CC.S.F01 && CC.S.C42.Rsp command: "EnhancedStepHue" @@ -216,7 +216,7 @@ tests: - name: "ms" value: 10000 - - label: "Step 5c: TH reads EnhancedCurrentHue attribute from DUT" + - label: "Step 3c: TH reads EnhancedCurrentHue attribute from DUT" command: "readAttribute" PICS: CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp attribute: "EnhancedCurrentHue" @@ -234,7 +234,7 @@ tests: - name: "ms" value: 10000 - - label: "Step 2d: TH reads EnhancedCurrentHue attribute from DUT" + - label: "Step 3d: TH reads EnhancedCurrentHue attribute from DUT" command: "readAttribute" PICS: CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp attribute: "EnhancedCurrentHue" @@ -252,7 +252,7 @@ tests: - name: "ms" value: 10000 - - label: "Step 2e: TH reads EnhancedCurrentHue attribute from DUT" + - label: "Step 3e: TH reads EnhancedCurrentHue attribute from DUT" command: "readAttribute" PICS: CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp attribute: "EnhancedCurrentHue" @@ -270,7 +270,7 @@ tests: - name: "ms" value: 5000 - - label: "Step 2f: TH reads EnhancedCurrentHue attribute from DUT" + - label: "Step 3f: TH reads EnhancedCurrentHue attribute from DUT" command: "readAttribute" PICS: CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp attribute: "EnhancedCurrentHue" @@ -279,7 +279,7 @@ tests: minValue: 5100 maxValue: 6900 - - label: "Step 6a: TH reads ColorMode attribute from DUT" + - label: "Step 4a: TH reads ColorMode attribute from DUT" PICS: CC.S.F01 && CC.S.A0008 command: "readAttribute" attribute: "ColorMode" @@ -289,7 +289,7 @@ tests: minValue: 0 maxValue: 2 - - label: "Step 6b: TH reads EnhancedColorMode attribute from DUT" + - label: "Step 4b: TH reads EnhancedColorMode attribute from DUT" PICS: CC.S.F01 && CC.S.A4001 command: "readAttribute" attribute: "EnhancedColorMode" @@ -300,7 +300,7 @@ tests: maxValue: 3 - label: - "Step 7a: TH sends EnhancedStepHue command to DUT with StepMode=0x01 + "Step 5a: TH sends EnhancedStepHue command to DUT with StepMode=0x01 (up), StepSize=0" PICS: CC.S.F01 && CC.S.C42.Rsp command: "EnhancedStepHue" @@ -320,7 +320,7 @@ tests: error: INVALID_COMMAND - label: - "Step 7b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 + "Step 5b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 (down), StepSize=0" PICS: CC.S.F01 && CC.S.C42.Rsp command: "EnhancedStepHue" diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml deleted file mode 100644 index 987bc6279093a8..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_SC_4_10.yaml +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: - 15.4.10. [TC-SC-4.10] Operational Discovery - SIT ICD Node - [{DUT_Commissionee}] - -PICS: - - MCORE.ROLE.COMMISSIONEE - - MCORE.SC.SED - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: "Precondition" - verification: | - 1. Nodes are joined in the same Fabric - 2. DUT is a sleepy device (MCORE.SC.SED) - disabled: true - - - label: "Step 1: DUT is instructed to advertise its service" - verification: | - 1. Provision the DUT by TH (Chip-tool) - disabled: true - - - label: "Step 2: TH scans for DNS-SD advertising" - verification: | - avahi-browse -rt _matter._tcp - On the TH(Chip-tool) Log: Verify the DUT is advertising for: - - SII key is higher than the SESSION_IDLE_INTERVAL default value (> 500 milliseconds) - - SII key and SAI key is less than 3600000 (1hour in milliseconds) - - + eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - + eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - = eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=0" "SAI=300" "SII=5000" "SAT=4000"] - = eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=0" "SAI=300" "SII=5000"] - disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml deleted file mode 100644 index a3ba4b4f41ab1d..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default - -name: 15.4.5. [TC-SC-4.5] Discovery [DUT as Commissionee][Thread] - -PICS: - - MCORE.ROLE.COMMISSIONEE - -config: - nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 - -tests: - - label: - "Step 1: TH is instructed to start advertising two or more services - using DNS-SD" - verification: | - 1. On the raspi controller, publish matter service, using below command - - $avahi-publish-service 87E1B004E235A130-8FC7772401CD0696 _matter._tcp 22222 SII=3000 SAI=4000 T=0 - disabled: true - - - label: - "Step 2: By any means, DUT is instructed to perform an unicast UDP - query to the DNS-SD Discovery Proxy on TH for services" - PICS: - MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.SAI_OP_DISCOVERY_KEY && - MCORE.SC.T_KEY - verification: | - avahi-browse -rt _matter._tcp - - Verify advertisement on the TH Log: - - + eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - + eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - = eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=0" "SAI=300" "SII=5000"] - = eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=0" "SAI=300" "SII=5000"] - disabled: true - - - label: - "Step 3: TH performs a change in one of the services configured at - step 1" - verification: | - 1. On the raspi controller, publish matter service chanding the T value 1, using below command - - $avahi-publish-service 87E1B004E235A130-8FC7772401CD0696 _matter._tcp 22222 SII=3000 SAI=4000 T=1 - disabled: true - - - label: "Step 4: DUT must receive a notification with new data" - PICS: - MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.SAI_OP_DISCOVERY_KEY && - MCORE.SC.T_KEY - verification: | - avahi-browse -rt _matter._tcp - - - Verify advertisement on the TH Log: - - + eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - + eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - = eth0 IPv4 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=1" "SAI=300" "SII=5000"] - = eth0 IPv6 3A235FF3FA2DAC10-0000000000000055 _matter._tcp local - hostname = [D21165B5F440B033.local] - address = [fd11:22::4b31:9932:cffe:b41a] - port = [5540] - txt = ["T=1" "SAI=300" "SII=5000"] - disabled: true From 03a14efa717c6ce729245ed227daf88de7d97e2a Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:24:06 -0700 Subject: [PATCH 18/53] [Darwin] XPC interface for invoke needs to take into account the reply may contain non-property-list objects (#35131) --- .../Framework/CHIP/MTRDeviceController_XPC.mm | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 31acadcce576d3..7111aa4eb7f2bd 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -43,6 +43,21 @@ @implementation MTRDeviceController_XPC @synthesize uniqueIdentifier = _uniqueIdentifier; +- (NSXPCInterface *)_interfaceForServerProtocol +{ + NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)]; + + NSSet * allowedClasses = [NSSet setWithArray:@[ + [NSString class], [NSNumber class], [NSData class], [NSArray class], [NSDictionary class], [NSError class], [MTRCommandPath class], [MTRAttributePath class] + ]]; + + [interface setClasses:allowedClasses + forSelector:@selector(deviceController:nodeID:invokeCommandWithEndpointID:clusterID:commandID:commandFields:expectedValues:expectedValueInterval:timedInvokeTimeout:completion:) + argumentIndex:0 + ofReply:YES]; + return interface; +} + - (NSXPCInterface *)_interfaceForClientProtocol { NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)]; @@ -84,7 +99,7 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection MTR_LOG("Set up XPC Connection: %@", self.xpcConnection); if (self.xpcConnection) { - self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)]; + self.xpcConnection.remoteObjectInterface = [self _interfaceForServerProtocol]; self.xpcConnection.exportedInterface = [self _interfaceForClientProtocol]; self.xpcConnection.exportedObject = self; @@ -118,9 +133,9 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID machServiceName:(NSString *)machSe MTR_LOG("Set up XPC Connection: %@", self.xpcConnection); if (self.xpcConnection) { - self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)]; + self.xpcConnection.remoteObjectInterface = [self _interfaceForServerProtocol]; - self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)]; + self.xpcConnection.exportedInterface = [self _interfaceForClientProtocol]; self.xpcConnection.exportedObject = self; MTR_LOG("%s: resuming new XPC connection"); From 62bf76b142208dd8b8b5bfb15a6daacd930415b1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Aug 2024 19:41:16 -0400 Subject: [PATCH 19/53] Fix Darwin to handle renames of Color Control data types. (#35135) https://github.com/project-chip/connectedhomeip/pull/33612 made the following changes to the Color Control cluster: 1) Renamed HueDirection to DirectionEnum 2) Renamed the ShortestDistance and LongestDistance values of DirectionEnum to Shortest and Longest, respectively. 3) Renamed HueMoveMode to MoveModeEnum. 4) Renamed HueStepMode to StepModeEnum. 5) Removed SaturationMoveMode in favor of MoveModeEnum. 6) Removed SaturationStepMode in favor of StepModeEnum. 7) Renamed ColorMode to ColorModeEnum. 8) Renamed the ColorTemperature value to ColorTemperatureMireds 8) Renamed ColorCapabilities to ColorCapabilitiesBitmap. 9) Renamed various fields of ColorCapabilitiesBitmap. 10) Renamed ColorLoopUpdateFlags to UpdateFlagsBitmap. 11) Renamed ColorLoopAction to ColorLoopActionEnum. 12) Added OptionsBitmap, EnhancedColorModeEnum, DriftCompensationEnum. 13) Renamed ColorLoopDirection to ColorLoopDirectionEnum. 14) Renamed the DecrementHue and IncrementHue values of ColorLoopDirectionEnum to Decrement and Increment, respectively. This change adds the right renamed/introduced/deprecated annotations for the above changes, and adds manual shims for the enums that got removed. --- .../Framework/CHIP/MTRBackwardsCompatShims.h | 29 +++ .../CHIP/templates/availability.yaml | 143 +++++++++++++- .../CHIP/zap-generated/MTRBaseClusters.h | 177 +++++++++++++----- 3 files changed, 296 insertions(+), 53 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h b/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h index 8903957414fc36..1a183c83def9b5 100644 --- a/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h +++ b/src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h @@ -159,4 +159,33 @@ typedef NS_ENUM(uint8_t, MTROTASoftwareUpdateRequestorOTAUpdateState) { = 0x08, } MTR_DEPRECATED("Please use MTROTASoftwareUpdateRequestorUpdateState", ios(16.4, 17.2), macos(13.3, 14.2), watchos(9.4, 10.2), tvos(16.4, 17.2)); +/** + * ColorControl used to have HueMoveMode/SaturationMoveMode and HueStepMode/SaturationStepMode that had + * identical values. Those got replaced with MoveModeEnum and StepModeEnum respectively. We codegen + * HueMoveMode and HueStepMode as aliases of MoveModeEnum and StepModeEnum, but we need manual shims for + * SaturationMoveMode and SaturationStepMode. + */ +typedef NS_ENUM(uint8_t, MTRColorControlSaturationMoveMode) { + MTRColorControlSaturationMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeStop") + = 0x00, + MTRColorControlSaturationMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeUp") + = 0x01, + MTRColorControlSaturationMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeDown") + = 0x03, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveMode"); + +typedef NS_ENUM(uint8_t, MTRColorControlSaturationStepMode) { + MTRColorControlSaturationStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeUp") + = 0x01, + MTRColorControlSaturationStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeDown") + = 0x03, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepMode"); + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index c1f1e1bd6f0e6c..2272d5256d934e 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -3237,9 +3237,15 @@ - FanModeSequenceType - FanModeType ColorControl: - - ColorLoopAction - - ColorLoopDirection - - ColorMode + # ColorLoopActionEnum, ColorLoopDirectionEnum and ColorModeEnum + # were originally named ColorLoopAction, ColorLoopDirection, and + # ColorMode, but we generate the same API for the names + # with/without "Enum" at the end and the cluster name + # present/absent at the beginning, so the names can just change + # here. + - ColorLoopActionEnum + - ColorLoopDirectionEnum + - ColorModeEnum - HueDirection - HueMoveMode - HueStepMode @@ -3980,14 +3986,20 @@ - Auto - Smart ColorControl: - ColorLoopAction: + # ColorLoopActionEnum, ColorLoopDirectionEnum and ColorModeEnum + # were originally named ColorLoopAction, ColorLoopDirection, and + # ColorMode, but we generate the same API for the names + # with/without "Enum" at the end and the cluster name + # present/absent at the beginning, so the names can just change + # here. + ColorLoopActionEnum: - Deactivate - ActivateFromColorLoopStartEnhancedHue - ActivateFromEnhancedCurrentHue - ColorLoopDirection: + ColorLoopDirectionEnum: - DecrementHue - IncrementHue - ColorMode: + ColorModeEnum: - CurrentHueAndCurrentSaturation - CurrentXAndCurrentY - ColorTemperature @@ -9682,6 +9694,64 @@ - release: "Future" versions: "future" + introduced: + enums: + ColorControl: + - DirectionEnum + - DriftCompensationEnum + - EnhancedColorModeEnum + - MoveModeEnum + - StepModeEnum + enum values: + ColorControl: + ColorLoopDirectionEnum: + - Decrement + - Increment + ColorModeEnum: + - ColorTemperatureMireds + DirectionEnum: + - Shortest + - Longest + - Up + - Down + DriftCompensationEnum: + - None + - OtherOrUnknown + - TemperatureMonitoring + - OpticalLuminanceMonitoringAndFeedback + - OpticalColorMonitoringAndFeedback + EnhancedColorModeEnum: + - CurrentHueAndCurrentSaturation + - CurrentXAndCurrentY + - ColorTemperatureMireds + - EnhancedCurrentHueAndCurrentSaturation + MoveModeEnum: + - Stop + - Up + - Down + StepModeEnum: + - Up + - Down + bitmaps: + ColorControl: + - ColorCapabilitiesBitmap + - OptionsBitmap + - UpdateFlagsBitmap + bitmap values: + ColorControl: + ColorCapabilitiesBitmap: + - HueSaturation + - EnhancedHue + - ColorLoop + - XY + - ColorTemperature + OptionsBitmap: + - ExecuteIfOff + UpdateFlagsBitmap: + - UpdateAction + - UpdateDirection + - UpdateTime + - UpdateStartHue provisional: clusters: # Targeting 1.4 @@ -9820,3 +9890,64 @@ Feature: # Targeting 1.4 - ActionSwitch + renames: + enums: + ColorControl: + DirectionEnum: HueDirection + MoveModeEnum: HueMoveMode + StepModeEnum: HueStepMode + enum values: + ColorControl: + ColorLoopDirectionEnum: + Decrement: DecrementHue + Increment: IncrementHue + ColorModeEnum: + ColorTemperatureMireds: ColorTemperature + HueDirection: + Shortest: ShortestDistance + Longest: LongestDistance + bitmaps: + ColorControl: + ColorCapabilitiesBitmap: ColorCapabilities + UpdateFlagsBitmap: ColorLoopUpdateFlags + bitmap values: + ColorControl: + ColorCapabilities: + HueSaturation: HueSaturationSupported + EnhancedHue: EnhancedHueSupported + ColorLoop: ColorLoopSupported + XY: XYAttributesSupported + ColorTemperature: ColorTemperatureSupported + deprecated: + enums: + ColorControl: + - HueDirection + - HueMoveMode + - HueStepMode + enum values: + ColorControl: + ColorLoopDirectionEnum: + - DecrementHue + - IncrementHue + ColorModeEnum: + - ColorTemperature + bitmaps: + ColorControl: + - ColorCapabilities + - ColorLoopUpdateFlags + removed: + enum values: + ColorControl: + # Don't expose the new value names on the old enum names + HueDirection: + - Shortest + - Longest + bitmap values: + ColorControl: + # Don't expose the new field names on the old bitmap names + ColorCapabilities: + - HueSaturation + - EnhancedHue + - ColorLoop + - XY + - ColorTemperature diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index efb5fca9547fab..c00233470f81d6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -20203,62 +20203,129 @@ typedef NS_ENUM(uint8_t, MTRThermostatUserInterfaceConfigurationTemperatureDispl } MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)); typedef NS_ENUM(uint8_t, MTRColorControlColorLoopAction) { - MTRColorControlColorLoopActionDeactivate MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlColorLoopActionActivateFromColorLoopStartEnhancedHue MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlColorLoopActionActivateFromEnhancedCurrentHue MTR_PROVISIONALLY_AVAILABLE = 0x02, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlColorLoopActionDeactivate MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, + MTRColorControlColorLoopActionActivateFromColorLoopStartEnhancedHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, + MTRColorControlColorLoopActionActivateFromEnhancedCurrentHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x02, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlColorLoopDirection) { - MTRColorControlColorLoopDirectionDecrement MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlColorLoopDirectionIncrement MTR_PROVISIONALLY_AVAILABLE = 0x01, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlColorLoopDirectionDecrement MTR_NEWLY_AVAILABLE = 0x00, + MTRColorControlColorLoopDirectionDecrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorLoopDirectionDecrement") + = 0x00, + MTRColorControlColorLoopDirectionIncrement MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlColorLoopDirectionIncrementHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorLoopDirectionIncrement") + = 0x01, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlColorMode) { - MTRColorControlColorModeCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlColorModeCurrentXAndCurrentY MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlColorModeColorTemperatureMireds MTR_PROVISIONALLY_AVAILABLE = 0x02, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlColorModeCurrentHueAndCurrentSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, + MTRColorControlColorModeCurrentXAndCurrentY MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, + MTRColorControlColorModeColorTemperatureMireds MTR_NEWLY_AVAILABLE = 0x02, + MTRColorControlColorModeColorTemperature MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorModeColorTemperatureMireds") + = 0x02, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_ENUM(uint8_t, MTRColorControlDirection) { - MTRColorControlDirectionShortest MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlDirectionLongest MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlDirectionUp MTR_PROVISIONALLY_AVAILABLE = 0x02, - MTRColorControlDirectionDown MTR_PROVISIONALLY_AVAILABLE = 0x03, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlDirectionShortest MTR_NEWLY_AVAILABLE = 0x00, + MTRColorControlDirectionLongest MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlDirectionUp MTR_NEWLY_AVAILABLE = 0x02, + MTRColorControlDirectionDown MTR_NEWLY_AVAILABLE = 0x03, +} MTR_NEWLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRColorControlHueDirection) { + MTRColorControlHueDirectionShortestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionShortest") + = 0x00, + MTRColorControlHueDirectionLongestDistance MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionLongest") + = 0x01, + MTRColorControlHueDirectionUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionUp") + = 0x02, + MTRColorControlHueDirectionDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirectionDown") + = 0x03, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlDirection"); typedef NS_ENUM(uint8_t, MTRColorControlDriftCompensation) { - MTRColorControlDriftCompensationNone MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlDriftCompensationOtherOrUnknown MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlDriftCompensationTemperatureMonitoring MTR_PROVISIONALLY_AVAILABLE = 0x02, - MTRColorControlDriftCompensationOpticalLuminanceMonitoringAndFeedback MTR_PROVISIONALLY_AVAILABLE = 0x03, - MTRColorControlDriftCompensationOpticalColorMonitoringAndFeedback MTR_PROVISIONALLY_AVAILABLE = 0x04, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlDriftCompensationNone MTR_NEWLY_AVAILABLE = 0x00, + MTRColorControlDriftCompensationOtherOrUnknown MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlDriftCompensationTemperatureMonitoring MTR_NEWLY_AVAILABLE = 0x02, + MTRColorControlDriftCompensationOpticalLuminanceMonitoringAndFeedback MTR_NEWLY_AVAILABLE = 0x03, + MTRColorControlDriftCompensationOpticalColorMonitoringAndFeedback MTR_NEWLY_AVAILABLE = 0x04, +} MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRColorControlEnhancedColorMode) { - MTRColorControlEnhancedColorModeCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlEnhancedColorModeCurrentXAndCurrentY MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlEnhancedColorModeColorTemperatureMireds MTR_PROVISIONALLY_AVAILABLE = 0x02, - MTRColorControlEnhancedColorModeEnhancedCurrentHueAndCurrentSaturation MTR_PROVISIONALLY_AVAILABLE = 0x03, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlEnhancedColorModeCurrentHueAndCurrentSaturation MTR_NEWLY_AVAILABLE = 0x00, + MTRColorControlEnhancedColorModeCurrentXAndCurrentY MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlEnhancedColorModeColorTemperatureMireds MTR_NEWLY_AVAILABLE = 0x02, + MTRColorControlEnhancedColorModeEnhancedCurrentHueAndCurrentSaturation MTR_NEWLY_AVAILABLE = 0x03, +} MTR_NEWLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRColorControlMoveMode) { - MTRColorControlMoveModeStop MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRColorControlMoveModeUp MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlMoveModeDown MTR_PROVISIONALLY_AVAILABLE = 0x03, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlMoveModeStop MTR_NEWLY_AVAILABLE = 0x00, + MTRColorControlMoveModeUp MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlMoveModeDown MTR_NEWLY_AVAILABLE = 0x03, +} MTR_NEWLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRColorControlHueMoveMode) { + MTRColorControlHueMoveModeStop MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeStop") + = 0x00, + MTRColorControlHueMoveModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeUp") + = 0x01, + MTRColorControlHueMoveModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveModeDown") + = 0x03, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlMoveMode"); typedef NS_ENUM(uint8_t, MTRColorControlStepMode) { - MTRColorControlStepModeUp MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRColorControlStepModeDown MTR_PROVISIONALLY_AVAILABLE = 0x03, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlStepModeUp MTR_NEWLY_AVAILABLE = 0x01, + MTRColorControlStepModeDown MTR_NEWLY_AVAILABLE = 0x03, +} MTR_NEWLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRColorControlHueStepMode) { + MTRColorControlHueStepModeUp MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeUp") + = 0x01, + MTRColorControlHueStepModeDown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepModeDown") + = 0x03, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlStepMode"); typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilitiesBitmap) { - MTRColorControlColorCapabilitiesBitmapHueSaturation MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRColorControlColorCapabilitiesBitmapEnhancedHue MTR_PROVISIONALLY_AVAILABLE = 0x2, - MTRColorControlColorCapabilitiesBitmapColorLoop MTR_PROVISIONALLY_AVAILABLE = 0x4, - MTRColorControlColorCapabilitiesBitmapXY MTR_PROVISIONALLY_AVAILABLE = 0x8, - MTRColorControlColorCapabilitiesBitmapColorTemperature MTR_PROVISIONALLY_AVAILABLE = 0x10, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlColorCapabilitiesBitmapHueSaturation MTR_NEWLY_AVAILABLE = 0x1, + MTRColorControlColorCapabilitiesBitmapEnhancedHue MTR_NEWLY_AVAILABLE = 0x2, + MTRColorControlColorCapabilitiesBitmapColorLoop MTR_NEWLY_AVAILABLE = 0x4, + MTRColorControlColorCapabilitiesBitmapXY MTR_NEWLY_AVAILABLE = 0x8, + MTRColorControlColorCapabilitiesBitmapColorTemperature MTR_NEWLY_AVAILABLE = 0x10, +} MTR_NEWLY_AVAILABLE; + +typedef NS_OPTIONS(uint16_t, MTRColorControlColorCapabilities) { + MTRColorControlColorCapabilitiesHueSaturationSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapHueSaturation") + = 0x1, + MTRColorControlColorCapabilitiesEnhancedHueSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapEnhancedHue") + = 0x2, + MTRColorControlColorCapabilitiesColorLoopSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorLoop") + = 0x4, + MTRColorControlColorCapabilitiesXYAttributesSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapXY") + = 0x8, + MTRColorControlColorCapabilitiesColorTemperatureSupported MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmapColorTemperature") + = 0x10, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlColorCapabilitiesBitmap"); typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { MTRColorControlFeatureHueAndSaturation MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x1, @@ -20269,15 +20336,31 @@ typedef NS_OPTIONS(uint32_t, MTRColorControlFeature) { } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_OPTIONS(uint8_t, MTRColorControlOptionsBitmap) { - MTRColorControlOptionsBitmapExecuteIfOff MTR_PROVISIONALLY_AVAILABLE = 0x1, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlOptionsBitmapExecuteIfOff MTR_NEWLY_AVAILABLE = 0x1, +} MTR_NEWLY_AVAILABLE; typedef NS_OPTIONS(uint8_t, MTRColorControlUpdateFlagsBitmap) { - MTRColorControlUpdateFlagsBitmapUpdateAction MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRColorControlUpdateFlagsBitmapUpdateDirection MTR_PROVISIONALLY_AVAILABLE = 0x2, - MTRColorControlUpdateFlagsBitmapUpdateTime MTR_PROVISIONALLY_AVAILABLE = 0x4, - MTRColorControlUpdateFlagsBitmapUpdateStartHue MTR_PROVISIONALLY_AVAILABLE = 0x8, -} MTR_PROVISIONALLY_AVAILABLE; + MTRColorControlUpdateFlagsBitmapUpdateAction MTR_NEWLY_AVAILABLE = 0x1, + MTRColorControlUpdateFlagsBitmapUpdateDirection MTR_NEWLY_AVAILABLE = 0x2, + MTRColorControlUpdateFlagsBitmapUpdateTime MTR_NEWLY_AVAILABLE = 0x4, + MTRColorControlUpdateFlagsBitmapUpdateStartHue MTR_NEWLY_AVAILABLE = 0x8, +} MTR_NEWLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRColorControlColorLoopUpdateFlags) { + MTRColorControlColorLoopUpdateFlagsUpdateAction MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateAction") + = 0x1, + MTRColorControlColorLoopUpdateFlagsUpdateDirection MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateDirection") + = 0x2, + MTRColorControlColorLoopUpdateFlagsUpdateTime MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateTime") + = 0x4, + MTRColorControlColorLoopUpdateFlagsUpdateStartHue MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmapUpdateStartHue") + = 0x8, +} MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) + MTR_NEWLY_DEPRECATED("Please use MTRColorControlUpdateFlagsBitmap"); typedef NS_OPTIONS(uint8_t, MTRBallastConfigurationBallastStatusBitmap) { MTRBallastConfigurationBallastStatusBitmapBallastNonOperational MTR_PROVISIONALLY_AVAILABLE = 0x1, From dd8b002e7e65d3f6b1f1a95ef8a740607202ea38 Mon Sep 17 00:00:00 2001 From: Sharad Binjola <31142146+sharadb-amazon@users.noreply.github.com> Date: Wed, 21 Aug 2024 17:01:20 -0700 Subject: [PATCH 20/53] Re-route deprecated android casting APIs to new ones (#35136) --- .../android/App/app/build.gradle | 4 +- .../com/chip/casting/app/CastingContext.java | 2 + .../chip/casting/app/CertTestFragment.java | 12 +- .../app/CommissionerDiscoveryFragment.java | 6 +- .../chip/casting/app/ConnectionFragment.java | 10 +- .../casting/app/ContentLauncherFragment.java | 6 +- .../casting/app/MediaPlaybackFragment.java | 6 +- .../casting/app/SelectClusterFragment.java | 6 +- .../chip/casting/util/DACProviderStub.java | 2 + .../casting/util/GlobalCastingConstants.java | 11 + .../jni/com/chip/casting/AppParameters.java | 2 + .../chip/casting/CommissioningCallbacks.java | 2 + .../jni/com/chip/casting/ContentApp.java | 37 + .../chip/casting/ContentLauncherTypes.java | 2 + .../jni/com/chip/casting/DACProvider.java | 2 + .../com/chip/casting/DiscoveredNodeData.java | 26 +- .../jni/com/chip/casting/FailureCallback.java | 6 +- .../chip/casting/MatterCallbackHandler.java | 6 +- .../jni/com/chip/casting/MatterError.java | 9 + .../com/chip/casting/MediaPlaybackTypes.java | 2 + .../SubscriptionEstablishedCallback.java | 2 + .../jni/com/chip/casting/SuccessCallback.java | 2 + .../chip/casting/TargetNavigatorTypes.java | 2 + .../jni/com/chip/casting/TvCastingApp.java | 1327 ++++++++++ .../jni/com/chip/casting/VideoPlayer.java | 62 +- .../App/app/src/main/AndroidManifest.xml | 4 +- .../casting/util/GlobalCastingConstants.java | 11 - .../casting}/ChipTvCastingApplication.java | 2 +- .../app => matter/casting}/MainActivity.java | 16 +- .../chip/casting/NsdDiscoveryListener.java | 128 - .../com/chip/casting/NsdResolveListener.java | 165 -- .../jni/com/chip/casting/TvCastingApp.java | 608 ----- .../matter/casting/support/DataProvider.java | 4 +- .../App/app/src/main/jni/cpp/Constants.h | 74 - .../app/src/main/jni/cpp/ConversionUtils.cpp | 410 ---- .../app/src/main/jni/cpp/ConversionUtils.h | 36 - .../jni/cpp/MatterCallbackHandler-JNI.cpp | 419 ---- .../main/jni/cpp/MatterCallbackHandler-JNI.h | 293 --- .../app/src/main/jni/cpp/TvCastingApp-JNI.cpp | 2129 ----------------- .../app/src/main/jni/cpp/TvCastingApp-JNI.h | 162 -- .../src/main/jni/cpp/core/CastingApp-JNI.cpp | 15 +- .../cpp/core/CastingPlayerDiscovery-JNI.cpp | 1 - .../jni/cpp/core/MatterCastingPlayer-JNI.cpp | 1 - .../main/jni/cpp/core/MatterEndpoint-JNI.cpp | 1 - .../jni/cpp/{ => support}/JNIDACProvider.cpp | 8 + .../jni/cpp/{ => support}/JNIDACProvider.h | 8 + .../app/src/main/res/layout/activity_main.xml | 2 +- .../CommissionerDiscoveryListenerTest.java | 68 - examples/tv-casting-app/android/BUILD.gn | 46 +- .../tv-casting-common/core/CastingApp.cpp | 2 - 50 files changed, 1566 insertions(+), 4601 deletions(-) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/CastingContext.java (87%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/CertTestFragment.java (97%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/CommissionerDiscoveryFragment.java (98%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/ConnectionFragment.java (96%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/ContentLauncherFragment.java (94%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/MediaPlaybackFragment.java (97%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/app/SelectClusterFragment.java (95%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/java/com/chip/casting/util/DACProviderStub.java (98%) create mode 100644 examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/GlobalCastingConstants.java rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/AppParameters.java (97%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/CommissioningCallbacks.java (97%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/ContentApp.java (51%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/ContentLauncherTypes.java (96%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/DACProvider.java (92%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/DiscoveredNodeData.java (88%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/FailureCallback.java (85%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/MatterCallbackHandler.java (85%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/MatterError.java (84%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/MediaPlaybackTypes.java (93%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/SubscriptionEstablishedCallback.java (91%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/SuccessCallback.java (91%) rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/TargetNavigatorTypes.java (93%) create mode 100644 examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TvCastingApp.java rename examples/tv-casting-app/android/App/app/src/{main => compat}/jni/com/chip/casting/VideoPlayer.java (81%) delete mode 100644 examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java rename examples/tv-casting-app/android/App/app/src/main/java/com/{chip/casting/app => matter/casting}/ChipTvCastingApplication.java (84%) rename examples/tv-casting-app/android/App/app/src/main/java/com/{chip/casting/app => matter/casting}/MainActivity.java (92%) delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdResolveListener.java delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp delete mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h rename examples/tv-casting-app/android/App/app/src/main/jni/cpp/{ => support}/JNIDACProvider.cpp (98%) rename examples/tv-casting-app/android/App/app/src/main/jni/cpp/{ => support}/JNIDACProvider.h (94%) delete mode 100644 examples/tv-casting-app/android/App/app/src/test/java/com/chip/casting/dnssd/CommissionerDiscoveryListenerTest.java diff --git a/examples/tv-casting-app/android/App/app/build.gradle b/examples/tv-casting-app/android/App/app/build.gradle index 3dcdad715e6393..757e6a6522f5da 100644 --- a/examples/tv-casting-app/android/App/app/build.gradle +++ b/examples/tv-casting-app/android/App/app/build.gradle @@ -7,7 +7,7 @@ android { defaultConfig { applicationId "com.chip.casting" - minSdk 24 + minSdk 26 targetSdk 30 versionCode 1 versionName "1.0" @@ -47,6 +47,8 @@ android { java.srcDirs = [ 'src/main/java', 'src/main/jni', + 'src/compat/java', + 'src/compat/jni', ] // uncomment this code to debug diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CastingContext.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CastingContext.java similarity index 87% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CastingContext.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CastingContext.java index acab829034bd56..b089e92b8faf0f 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CastingContext.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CastingContext.java @@ -5,6 +5,8 @@ import androidx.fragment.app.FragmentActivity; import com.R; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class CastingContext { private FragmentActivity fragmentActivity; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CertTestFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CertTestFragment.java similarity index 97% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CertTestFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CertTestFragment.java index 7ee9fa3c46a0ae..27f00aab8e9325 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CertTestFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CertTestFragment.java @@ -313,7 +313,17 @@ private void runCertTests(Activity activity) { "messages_presentMessages", successFailureCallback, () -> { - tvCastingApp.messages_presentMessages(kTVApp, "CastingAppTestMessage", callback); + final byte[] messageID = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5}; + tvCastingApp.messages_presentMessages( + kTVApp, + messageID, + 0, + 0, + (long) 0, + (long) 60 * 1000, + "CastingAppTestMessage", + Optional.empty(), + callback); }); runAndWait( diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissionerDiscoveryFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CommissionerDiscoveryFragment.java similarity index 98% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissionerDiscoveryFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CommissionerDiscoveryFragment.java index 3a119940b64839..c7aa931d9f00a1 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissionerDiscoveryFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/CommissionerDiscoveryFragment.java @@ -28,7 +28,11 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -/** A {@link Fragment} to discover commissioners on the network */ +/** + * @deprecated Refer to com.matter.casting.DiscoveryExampleFragment. + *

A {@link Fragment} to discover commissioners on the network + */ +@Deprecated public class CommissionerDiscoveryFragment extends Fragment { private static final String TAG = CommissionerDiscoveryFragment.class.getSimpleName(); private static final long DISCOVERY_POLL_INTERVAL_MS = 15000; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ConnectionFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ConnectionFragment.java similarity index 96% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ConnectionFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ConnectionFragment.java index 09ba31b2c8776c..dcd681d7cbc70d 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ConnectionFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ConnectionFragment.java @@ -21,9 +21,14 @@ import com.chip.casting.util.GlobalCastingConstants; import java.util.concurrent.Executors; -/** A {@link Fragment} to get the TV Casting App commissioned / connected. */ +/** + * @deprecated Refer to com.matter.casting.ConnectionExampleFragment. + *

A {@link Fragment} to get the TV Casting App commissioned / connected + */ +@Deprecated public class ConnectionFragment extends Fragment { private static final String TAG = ConnectionFragment.class.getSimpleName(); + private static final Integer targetContentAppVendorId = 65521; private final TvCastingApp tvCastingApp; private final DiscoveredNodeData selectedCommissioner; @@ -189,7 +194,8 @@ public void handle(MatterError error) { + " port: " + selectedCommissioner.getPort()); - this.sendUdcSuccess = tvCastingApp.sendCommissioningRequest(selectedCommissioner); + this.sendUdcSuccess = + tvCastingApp.sendCommissioningRequest(selectedCommissioner, targetContentAppVendorId); updateUiOnConnectionSuccess(); } } else { diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ContentLauncherFragment.java similarity index 94% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ContentLauncherFragment.java index d1c3c9f957f394..14bcfcae1568f8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/ContentLauncherFragment.java @@ -15,7 +15,11 @@ import com.chip.casting.MatterError; import com.chip.casting.TvCastingApp; -/** A {@link Fragment} to send Content Launcher commands from the TV Casting App. */ +/** + * @deprecated Refer to com.matter.casting.ContentLauncherLaunchURLExampleFragment. + *

A {@link Fragment} to send Content Launcher commands from the TV Casting App. + */ +@Deprecated public class ContentLauncherFragment extends Fragment { private static final String TAG = ContentLauncherFragment.class.getSimpleName(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/MediaPlaybackFragment.java similarity index 97% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/MediaPlaybackFragment.java index a9c38443a7d91e..b48dcd277122a4 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/MediaPlaybackFragment.java @@ -18,7 +18,11 @@ import com.chip.casting.SuccessCallback; import com.chip.casting.TvCastingApp; -/** A {@link Fragment} for the Media Playback cluster */ +/** + * @deprecated Refer to com.matter.casting.MediaPlaybackSubscribeToCurrentStateExampleFragment. + *

A {@link Fragment} for the Media Playback cluster + */ +@Deprecated public class MediaPlaybackFragment extends Fragment { private static final String TAG = MediaPlaybackFragment.class.getSimpleName(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/SelectClusterFragment.java similarity index 95% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/SelectClusterFragment.java index f89fc36009e404..47cc4728f96cfb 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/app/SelectClusterFragment.java @@ -10,7 +10,11 @@ import com.R; import com.chip.casting.TvCastingApp; -/** An interstitial {@link Fragment} to select one of the supported media actions to perform */ +/** + * @deprecated Refer to com.matter.casting.ActionSelectorFragment. + *

An interstitial {@link Fragment} to select one of the supported media actions to perform + */ +@Deprecated public class SelectClusterFragment extends Fragment { private static final String TAG = SelectClusterFragment.class.getSimpleName(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/DACProviderStub.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/DACProviderStub.java similarity index 98% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/DACProviderStub.java rename to examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/DACProviderStub.java index 9dbae27c6e5982..2a91c055dcb47a 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/DACProviderStub.java +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/DACProviderStub.java @@ -11,6 +11,8 @@ import java.security.spec.ECParameterSpec; import java.security.spec.ECPrivateKeySpec; +/** @deprecated Refer to com.matter.casting.DACProviderStub. */ +@Deprecated public class DACProviderStub implements DACProvider { private String kDevelopmentDAC_Cert_FFF1_8001 = diff --git a/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/GlobalCastingConstants.java b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/GlobalCastingConstants.java new file mode 100644 index 00000000000000..526bbb07401845 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/compat/java/com/chip/casting/util/GlobalCastingConstants.java @@ -0,0 +1,11 @@ +package com.chip.casting.util; + +public class GlobalCastingConstants { + public static final int CommissioningWindowDurationSecs = 3 * 60; + public static final int SetupPasscode = 20202021; + public static final int Discriminator = 0xF00; + + // set to true, to demo the simplified casting APIs. + // Otherwise, the deprecated casting APIs are invoked + public static final boolean ChipCastingSimplified = true; +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/AppParameters.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/AppParameters.java similarity index 97% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/AppParameters.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/AppParameters.java index 18c9a351f0e41a..3d72b38f72eb84 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/AppParameters.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/AppParameters.java @@ -22,6 +22,8 @@ import java.math.BigInteger; import java.util.Arrays; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class AppParameters { private static final String TAG = AppParameters.class.getSimpleName(); public static final int MIN_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH = 16; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/CommissioningCallbacks.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/CommissioningCallbacks.java similarity index 97% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/CommissioningCallbacks.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/CommissioningCallbacks.java index 9a44aba792f18b..20599a4f07352a 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/CommissioningCallbacks.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/CommissioningCallbacks.java @@ -17,6 +17,8 @@ */ package com.chip.casting; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class CommissioningCallbacks { /** * This is called when the PBKDFParamRequest is received and indicates the start of the session diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentApp.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentApp.java similarity index 51% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentApp.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentApp.java index 80efc22ef52024..1c20a40b66251a 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentApp.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentApp.java @@ -17,10 +17,16 @@ */ package com.chip.casting; +import chip.devicecontroller.ChipClusters; +import com.matter.casting.core.Endpoint; +import java.util.ArrayList; import java.util.List; import java.util.Objects; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class ContentApp { + private Endpoint endpoint; private short endpointId; private List clusterIds; @@ -32,6 +38,33 @@ public ContentApp(short endpointId, List clusterIds) { this.isInitialized = true; } + ContentApp(Endpoint endpoint) { + this.endpoint = endpoint; + this.endpointId = (short) endpoint.getId(); + this.clusterIds = new ArrayList<>(); + if (endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.ApplicationBasicCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.ApplicationLauncherCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.ApplicationLauncherCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.ContentLauncherCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.ContentLauncherCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.KeypadInputCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.KeypadInputCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.MediaPlaybackCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.OnOffCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.OnOffCluster.CLUSTER_ID); + } + if (endpoint.getCluster(ChipClusters.TargetNavigatorCluster.class) != null) { + this.clusterIds.add((int) ChipClusters.TargetNavigatorCluster.CLUSTER_ID); + } + } + public boolean equals(Object object) { if (this == object) return true; if (object == null || getClass() != object.getClass()) return false; @@ -49,6 +82,10 @@ public java.lang.String toString() { return "endpointId=" + endpointId; } + Endpoint getEndpoint() { + return endpoint; + } + public short getEndpointId() { return endpointId; } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentLauncherTypes.java similarity index 96% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentLauncherTypes.java index bc4ee6a6a24bdf..b6d7c3402989d9 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/ContentLauncherTypes.java @@ -20,6 +20,8 @@ import java.util.ArrayList; import java.util.Optional; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class ContentLauncherTypes { public static class AdditionalInfo { public String name; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DACProvider.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DACProvider.java similarity index 92% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DACProvider.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DACProvider.java index c49d73ab98c86e..7c6ac281e61568 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DACProvider.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DACProvider.java @@ -17,6 +17,8 @@ */ package com.chip.casting; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public interface DACProvider { byte[] GetCertificationDeclaration(); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DiscoveredNodeData.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DiscoveredNodeData.java similarity index 88% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DiscoveredNodeData.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DiscoveredNodeData.java index a66d48a57c0e2a..39b9113c94a836 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/DiscoveredNodeData.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/DiscoveredNodeData.java @@ -19,6 +19,7 @@ import android.net.nsd.NsdServiceInfo; import android.util.Log; +import com.matter.casting.core.CastingPlayer; import java.net.InetAddress; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -26,15 +27,18 @@ import java.util.Map; import java.util.Objects; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class DiscoveredNodeData { private static final String TAG = DiscoveredNodeData.class.getSimpleName(); - private static final int MAX_IP_ADDRESSES = 5; private static final int MAX_ROTATING_ID_LEN = 50; private static final String KEY_DEVICE_NAME = "DN"; private static final String KEY_DEVICE_TYPE = "DT"; private static final String KEY_VENDOR_PRODUCT = "VP"; + private CastingPlayer castingPlayer; + private String hostName; private String instanceName; private long longDiscriminator; @@ -119,10 +123,30 @@ public DiscoveredNodeData(VideoPlayer player) { this.port = player.getPort(); } + DiscoveredNodeData(CastingPlayer castingPlayer) { + this.castingPlayer = castingPlayer; + this.deviceName = castingPlayer.getDeviceName(); + this.ipAddresses = castingPlayer.getIpAddresses(); + this.numIPs = + castingPlayer.getIpAddresses() != null ? castingPlayer.getIpAddresses().size() : 0; + this.deviceType = castingPlayer.getDeviceType(); + this.hostName = castingPlayer.getHostName(); + this.vendorId = castingPlayer.getVendorId(); + this.productId = castingPlayer.getProductId(); + this.instanceName = castingPlayer.getInstanceName(); + if (castingPlayer.isConnected()) { + this.connectableVideoPlayer = new VideoPlayer(castingPlayer); + } + } + void setConnectableVideoPlayer(VideoPlayer videoPlayer) { this.connectableVideoPlayer = videoPlayer; } + CastingPlayer getCastingPlayer() { + return castingPlayer; + } + public boolean isPreCommissioned() { return connectableVideoPlayer != null; } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/FailureCallback.java similarity index 85% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/FailureCallback.java index 2ad3b9fc7222fe..5e07e9d526b1c4 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/FailureCallback.java @@ -19,14 +19,16 @@ import android.util.Log; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public abstract class FailureCallback { private static final String TAG = FailureCallback.class.getSimpleName(); public abstract void handle(MatterError err); - protected final void handleInternal(int errorCode, String errorMessage) { + protected final void handleInternal(MatterError err) { try { - handle(new MatterError(errorCode, errorMessage)); + handle(err); } catch (Throwable t) { Log.e(TAG, "FailureCallback::Caught an unhandled Throwable from the client: " + t); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterCallbackHandler.java similarity index 85% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterCallbackHandler.java index 493635beb692f1..7f1efd056e2e23 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterCallbackHandler.java @@ -19,14 +19,16 @@ import android.util.Log; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public abstract class MatterCallbackHandler { private static final String TAG = MatterCallbackHandler.class.getSimpleName(); public abstract void handle(MatterError err); - protected final void handleInternal(int errorCode, String errorMessage) { + protected final void handleInternal(MatterError err) { try { - handle(new MatterError(errorCode, errorMessage)); + handle(err); } catch (Throwable t) { Log.e(TAG, "MatterCallbackHandler::Caught an unhandled Throwable from the client: " + t); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterError.java similarity index 84% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterError.java index ac12eaccd28977..e281bdd8b63735 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MatterError.java @@ -19,6 +19,8 @@ import java.util.Objects; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class MatterError { private long errorCode; private String errorMessage; @@ -26,8 +28,15 @@ public class MatterError { public static final MatterError DISCOVERY_SERVICE_LOST = new MatterError(4L, "Discovery service was lost."); + public static final MatterError MATTER_INTERNAL_ERROR = new MatterError(0xac, "Internal error."); + public static final MatterError NO_ERROR = new MatterError(0, null); + MatterError(com.matter.casting.support.MatterError err) { + this.errorCode = err.getErrorCode(); + this.errorMessage = err.getErrorMessage(); + } + public MatterError(long errorCode, String errorMessage) { this.errorCode = errorCode; this.errorMessage = errorMessage; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MediaPlaybackTypes.java similarity index 93% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MediaPlaybackTypes.java index 7bf37b5d1cd8e4..fc01b02dea23da 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/MediaPlaybackTypes.java @@ -17,6 +17,8 @@ */ package com.chip.casting; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class MediaPlaybackTypes { public enum PlaybackStateEnum { Playing, diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SubscriptionEstablishedCallback.java similarity index 91% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SubscriptionEstablishedCallback.java index aab9dcd9306fd7..dd5eab2ec66556 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SubscriptionEstablishedCallback.java @@ -19,6 +19,8 @@ import android.util.Log; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public abstract class SubscriptionEstablishedCallback { private static final String TAG = SubscriptionEstablishedCallback.class.getSimpleName(); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SuccessCallback.java similarity index 91% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SuccessCallback.java index b82845567d8276..d1194d46f3eef0 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/SuccessCallback.java @@ -19,6 +19,8 @@ import android.util.Log; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public abstract class SuccessCallback { private static final String TAG = SuccessCallback.class.getSimpleName(); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TargetNavigatorTypes.java similarity index 93% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TargetNavigatorTypes.java index 88f71bb796ceaf..832101c9564fe7 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TargetNavigatorTypes.java @@ -17,6 +17,8 @@ */ package com.chip.casting; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class TargetNavigatorTypes { public static class TargetInfo { public Integer identifier; diff --git a/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TvCastingApp.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TvCastingApp.java new file mode 100644 index 00000000000000..cd965905065bee --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/TvCastingApp.java @@ -0,0 +1,1327 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * 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. + * + */ +package com.chip.casting; + +import android.content.Context; +import android.util.Log; +import androidx.annotation.Nullable; +import chip.devicecontroller.ChipClusters; +import chip.devicecontroller.ChipStructs; +import com.matter.casting.core.CastingApp; +import com.matter.casting.core.CastingPlayer; +import com.matter.casting.core.CastingPlayerDiscovery; +import com.matter.casting.core.Endpoint; +import com.matter.casting.core.MatterCastingPlayerDiscovery; +import com.matter.casting.support.AppParameters; +import com.matter.casting.support.CommissionableData; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.DACProvider; +import com.matter.casting.support.IdentificationDeclarationOptions; +import com.matter.casting.support.MatterCallback; +import com.matter.casting.support.MatterError; +import com.matter.casting.support.TargetAppInfo; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated +public class TvCastingApp { + private static final String TAG = TvCastingApp.class.getSimpleName(); + + private com.chip.casting.AppParameters appParametersCompat; + private int commissioningWindowTimeout; + private CommissioningCallbacks commissioningCallbacks; + private SuccessCallback onConnectionSuccess; + private FailureCallback onConnectionFailure; + private SuccessCallback onNewOrUpdatedEndpointCallback; + private CastingPlayer targetCastingPlayer; + + private abstract class CastingPlayerChangeListenerAdapter + extends CastingPlayerDiscovery.CastingPlayerChangeListener { + public abstract void initialize(SuccessCallback discoverySuccessCallback); + } + + private CastingPlayerChangeListenerAdapter castingPlayerDiscoveryChangeListener = + new CastingPlayerChangeListenerAdapter() { + private SuccessCallback discoverySuccessCallbackCompat; + + @Override + public void initialize(SuccessCallback discoverySuccessCallback) { + this.discoverySuccessCallbackCompat = discoverySuccessCallback; + } + + @Override + public void onAdded(CastingPlayer castingPlayer) { + if (discoverySuccessCallbackCompat == null) { + Log.e(TAG, "discoverySuccessCallbackCompat not set"); + return; + } + discoverySuccessCallbackCompat.handleInternal(new DiscoveredNodeData((castingPlayer))); + } + + @Override + public void onChanged(CastingPlayer castingPlayer) { + if (discoverySuccessCallbackCompat == null) { + Log.e(TAG, "discoverySuccessCallbackCompat not set"); + return; + } + discoverySuccessCallbackCompat.handleInternal(new DiscoveredNodeData((castingPlayer))); + } + + @Override + public void onRemoved(CastingPlayer castingPlayer) { + Log.e(TAG, "CastingPlayerChangeListener.onRemoved() not implemented"); + } + }; + + private interface DACProviderAdapter extends DACProvider { + void initialize(com.chip.casting.DACProvider dacProviderCompat); + } + + private DACProviderAdapter dacProvider = + new DACProviderAdapter() { + private com.chip.casting.DACProvider dacProviderCompat; + + public void initialize(com.chip.casting.DACProvider dacProviderCompat) { + this.dacProviderCompat = dacProviderCompat; + } + + @Override + public byte[] GetCertificationDeclaration() { + if (dacProviderCompat == null) { + Log.e(TAG, "dacProviderCompat not set"); + return null; + } + return dacProviderCompat.GetCertificationDeclaration(); + } + + @Override + public byte[] GetFirmwareInformation() { + if (dacProviderCompat == null) { + Log.e(TAG, "dacProviderCompat not set"); + return null; + } + return dacProviderCompat.GetFirmwareInformation(); + } + + @Override + public byte[] GetDeviceAttestationCert() { + if (dacProviderCompat == null) { + Log.e(TAG, "dacProviderCompat not set"); + return null; + } + return dacProviderCompat.GetDeviceAttestationCert(); + } + + @Override + public byte[] GetProductAttestationIntermediateCert() { + if (dacProviderCompat == null) { + Log.e(TAG, "dacProviderCompat not set"); + return null; + } + return dacProviderCompat.GetProductAttestationIntermediateCert(); + } + + @Override + public byte[] SignWithDeviceAttestationKey(byte[] message) { + if (dacProviderCompat == null) { + Log.e(TAG, "dacProviderCompat not set"); + return null; + } + return dacProviderCompat.SignWithDeviceAttestationKey(message); + } + }; + + private static final List DISCOVERY_TARGET_DEVICE_TYPE_FILTER = + Arrays.asList(35L); // Matter Casting Video player = 35; + + private static TvCastingApp sInstance; + + private TvCastingApp() {} + + public static TvCastingApp getInstance() { + if (sInstance == null) { + sInstance = new TvCastingApp(); + } + return sInstance; + } + + public boolean initApp( + Context applicationContext, com.chip.casting.AppParameters appParametersCompat) { + if (applicationContext == null + || appParametersCompat == null + || appParametersCompat.getConfigurationManager() == null) { + return false; + } + + this.appParametersCompat = appParametersCompat; + + AppParameters appParameters = + new AppParameters( + applicationContext, + () -> appParametersCompat.getConfigurationManager(), + () -> appParametersCompat.getRotatingDeviceIdUniqueId(), + () -> { + CommissionableData commissionableData = + new CommissionableData( + appParametersCompat.getSetupPasscode(), + appParametersCompat.getDiscriminator()); + commissionableData.setSpake2pIterationCount( + appParametersCompat.getSpake2pIterationCount()); + commissionableData.setSpake2pSaltBase64(appParametersCompat.getSpake2pSaltBase64()); + commissionableData.setSpake2pVerifierBase64( + appParametersCompat.getSpake2pVerifierBase64()); + return commissionableData; + }, + this.dacProvider); + + // Initialize the SDK using the appParameters and check if it returns successfully + MatterError err = CastingApp.getInstance().initialize(appParameters); + if (err.hasError()) { + Log.e(TAG, "Failed to initialize Matter CastingApp. Err: " + err); + return false; + } + + err = CastingApp.getInstance().start(); + if (err.hasError()) { + Log.e(TAG, "Failed to start Matter CastingApp. Err: " + err); + return false; + } + return true; + } + + public void setDACProvider(com.chip.casting.DACProvider dacProviderCompat) { + this.dacProvider.initialize(dacProviderCompat); + } + + public void discoverVideoPlayerCommissioners( + SuccessCallback discoverySuccessCallback, + FailureCallback discoveryFailureCallback) { + + // stop before starting another discovery session + stopVideoPlayerDiscovery(); + + castingPlayerDiscoveryChangeListener.initialize(discoverySuccessCallback); + MatterError err = + MatterCastingPlayerDiscovery.getInstance() + .addCastingPlayerChangeListener(castingPlayerDiscoveryChangeListener); + if (err.hasError()) { + Log.e(TAG, "addCastingPlayerChangeListener before starting discovery failed. Err: " + err); + discoveryFailureCallback.handleInternal(new com.chip.casting.MatterError(err)); + return; + } + + err = + MatterCastingPlayerDiscovery.getInstance() + .startDiscovery(DISCOVERY_TARGET_DEVICE_TYPE_FILTER.get(0)); + if (err.hasError()) { + Log.e(TAG, "startDiscovery failed. Err: " + err); + discoveryFailureCallback.handleInternal(new com.chip.casting.MatterError(err)); + } + } + + public void stopVideoPlayerDiscovery() { + MatterError err = MatterCastingPlayerDiscovery.getInstance().stopDiscovery(); + if (err.hasError()) { + Log.e(TAG, "stopDiscovery failed. Err: " + err); + return; + } + + err = + MatterCastingPlayerDiscovery.getInstance() + .removeCastingPlayerChangeListener(castingPlayerDiscoveryChangeListener); + if (err.hasError()) { + Log.e(TAG, "removeCastingPlayerChangeListener failed. Err: " + err); + } + } + + public boolean openBasicCommissioningWindow( + int commissioningWindowTimeout, + CommissioningCallbacks commissioningCallbacks, + SuccessCallback onConnectionSuccess, + FailureCallback onConnectionFailure, + SuccessCallback onNewOrUpdatedEndpointCallback) { + this.commissioningWindowTimeout = commissioningWindowTimeout; + this.commissioningCallbacks = commissioningCallbacks; + this.onConnectionSuccess = onConnectionSuccess; + this.onConnectionFailure = onConnectionFailure; + this.onNewOrUpdatedEndpointCallback = onNewOrUpdatedEndpointCallback; + return true; + } + + public boolean sendCommissioningRequest(DiscoveredNodeData commissioner, Integer vendorId) { + if (commissioningCallbacks == null + || onConnectionSuccess == null + || onConnectionFailure == null + || onNewOrUpdatedEndpointCallback == null) { + Log.e(TAG, "Commissioning/connection callbacks not set"); + return false; + } + + this.targetCastingPlayer = commissioner.getCastingPlayer(); + + IdentificationDeclarationOptions idOptions = new IdentificationDeclarationOptions(); + idOptions.addTargetAppInfo(new TargetAppInfo(vendorId, null)); + + MatterError err = + targetCastingPlayer.verifyOrEstablishConnection( + new ConnectionCallbacks( + new MatterCallback() { + @Override + public void handle(Void response) { + ((MatterCallbackHandler) commissioningCallbacks.getCommissioningComplete()) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + onConnectionSuccess.handleInternal(new VideoPlayer(targetCastingPlayer)); + + List endpoints = targetCastingPlayer.getEndpoints(); + if (endpoints != null) { + for (Endpoint endpoint : endpoints) { + onNewOrUpdatedEndpointCallback.handleInternal(new ContentApp(endpoint)); + } + } + } + }, + new MatterCallback() { + @Override + public void handle(MatterError err) { + onConnectionFailure.handleInternal(new com.chip.casting.MatterError(err)); + } + }, + null), + (short) this.commissioningWindowTimeout, + idOptions); + + if (err.hasError()) { + Log.e( + TAG, "sendCommissioningRequest failed to call verifyOrEstablishConnection. Err: " + err); + return false; + } + + return true; + } + + public boolean verifyOrEstablishConnection( + VideoPlayer targetVideoPlayer, + SuccessCallback onConnectionSuccess, + FailureCallback onConnectionFailure, + SuccessCallback onNewOrUpdatedEndpointCallback) { + Log.e(TAG, "verifyOrEstablishConnection is unsupported"); + return false; + } + + public void shutdownAllSubscriptions() { + MatterError err = CastingApp.getInstance().shutdownAllSubscriptions(); + if (err.hasError()) { + Log.e(TAG, "shutdownAllSubscriptions failed. Err: " + err); + } + } + + public void disconnect() { + if (targetCastingPlayer != null) { + targetCastingPlayer.disconnect(); + } + } + + public boolean purgeCache() { + MatterError err = CastingApp.getInstance().clearCache(); + if (err.hasError()) { + Log.e(TAG, "purgeCache failed. Err: " + err); + return false; + } + return true; + } + + private Endpoint getTargetEndpoint(ContentApp contentApp) { + if (targetCastingPlayer == null || targetCastingPlayer.getEndpoints() == null) { + return null; + } + + for (Endpoint endpoint : targetCastingPlayer.getEndpoints()) { + if (endpoint.getId() == contentApp.getEndpointId()) { + return endpoint; + } + } + + return null; + } + + public boolean contentLauncherLaunchURL( + ContentApp contentApp, String contentUrl, String contentDisplayStr, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ContentLauncherCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ContentLauncherCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.launchURL( + new ChipClusters.ContentLauncherCluster.LauncherResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + contentUrl, + Optional.of(contentDisplayStr), + Optional.empty()); + + return true; + } + + public boolean contentLauncher_launchContent( + ContentApp contentApp, + ContentLauncherTypes.ContentSearch searchCompat, + boolean autoPlay, + String data, + Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ContentLauncherCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ContentLauncherCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + // translate searchCompat + ArrayList parameterList = null; + if (searchCompat.parameterList != null) { + parameterList = new ArrayList<>(); + for (ContentLauncherTypes.Parameter parameterCompat : searchCompat.parameterList) { + ArrayList externalIDList = null; + if (parameterCompat.externalIDList != null && parameterCompat.externalIDList.isPresent()) { + externalIDList = new ArrayList<>(); + for (ContentLauncherTypes.AdditionalInfo additionalInfoCompat : + parameterCompat.externalIDList.get()) { + externalIDList.add( + new ChipStructs.ContentLauncherClusterAdditionalInfoStruct( + additionalInfoCompat.name, additionalInfoCompat.value)); + } + } + parameterList.add( + new ChipStructs.ContentLauncherClusterParameterStruct( + parameterCompat.type, + parameterCompat.value, + externalIDList != null ? Optional.of(externalIDList) : Optional.empty())); + } + } + ChipStructs.ContentLauncherClusterContentSearchStruct search = + new ChipStructs.ContentLauncherClusterContentSearchStruct(parameterList); + + cluster.launchContent( + new ChipClusters.ContentLauncherCluster.LauncherResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + search, + autoPlay, + data != null ? Optional.of(data) : Optional.empty(), + Optional.empty(), + Optional.empty()); + return true; + } + + public boolean mediaPlayback_play(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.play( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_pause(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.pause( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_stopPlayback(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.stop( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_next(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.next( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_previous(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.previous( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_rewind(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.rewind( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + Optional.empty()); + return true; + } + + public boolean mediaPlayback_fastForward(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.fastForward( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + Optional.empty()); + return true; + } + + public boolean mediaPlayback_startOver(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.startOver( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean mediaPlayback_seek(ContentApp contentApp, long position, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.seek( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + position); + return true; + } + + public boolean mediaPlayback_skipForward( + ContentApp contentApp, long deltaPositionMilliseconds, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.skipForward( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + deltaPositionMilliseconds); + return true; + } + + public boolean mediaPlayback_skipBackward( + ContentApp contentApp, long deltaPositionMilliseconds, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.skipBackward( + new ChipClusters.MediaPlaybackCluster.PlaybackResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "PlaybackResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + deltaPositionMilliseconds); + return true; + } + + public boolean mediaPlayback_subscribeToCurrentState( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MediaPlaybackCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MediaPlaybackCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.subscribeCurrentStateAttribute( + new ChipClusters.IntegerAttributeCallback() { + @Override + public void onSuccess(int value) { + readSuccessHandler.handleInternal(MediaPlaybackTypes.PlaybackStateEnum.values()[value]); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "IntegerAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + + @Override + public void onSubscriptionEstablished(long subscriptionId) { + subscriptionEstablishedHandler.handleInternal(); + } + }, + minInterval, + maxInterval); + return true; + } + + public boolean applicationLauncher_launchApp( + ContentApp contentApp, + short catalogVendorId, + String applicationId, + byte[] data, + Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationLauncherCluster cluster = + endpoint != null + ? endpoint.getCluster(ChipClusters.ApplicationLauncherCluster.class) + : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + // translate to application + Optional application = + Optional.empty(); + if (applicationId != null) { + application = + Optional.of( + new ChipStructs.ApplicationLauncherClusterApplicationStruct( + (int) catalogVendorId, applicationId)); + } + + cluster.launchApp( + new ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + application, + data != null ? Optional.of(data) : Optional.empty()); + return true; + } + + public boolean applicationLauncher_stopApp( + ContentApp contentApp, short catalogVendorId, String applicationId, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationLauncherCluster cluster = + endpoint != null + ? endpoint.getCluster(ChipClusters.ApplicationLauncherCluster.class) + : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + // translate to application + Optional application = + Optional.empty(); + if (applicationId != null) { + application = + Optional.of( + new ChipStructs.ApplicationLauncherClusterApplicationStruct( + (int) catalogVendorId, applicationId)); + } + + cluster.stopApp( + new ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + application); + return true; + } + + public boolean applicationLauncher_hideApp( + ContentApp contentApp, short catalogVendorId, String applicationId, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationLauncherCluster cluster = + endpoint != null + ? endpoint.getCluster(ChipClusters.ApplicationLauncherCluster.class) + : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + // translate to application + Optional application = + Optional.empty(); + if (applicationId != null) { + application = + Optional.of( + new ChipStructs.ApplicationLauncherClusterApplicationStruct( + (int) catalogVendorId, applicationId)); + } + + cluster.hideApp( + new ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + application); + return true; + } + + public boolean targetNavigator_navigateTarget( + ContentApp contentApp, byte target, String data, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.TargetNavigatorCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.TargetNavigatorCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.navigateTarget( + new ChipClusters.TargetNavigatorCluster.NavigateTargetResponseCallback() { + @Override + public void onSuccess(Integer status, Optional data) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "NavigateTargetResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + (int) target, + data != null ? Optional.of(data) : Optional.empty()); + return true; + } + + public boolean targetNavigator_subscribeToTargetList( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.TargetNavigatorCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.TargetNavigatorCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.subscribeTargetListAttribute( + new ChipClusters.TargetNavigatorCluster.TargetListAttributeCallback() { + @Override + public void onSuccess( + List targetInfoList) { + List targetInfoListCompat = null; + if (targetInfoList != null) { + targetInfoListCompat = new ArrayList<>(); + for (ChipStructs.TargetNavigatorClusterTargetInfoStruct targetInfo : targetInfoList) { + targetInfoListCompat.add( + new TargetNavigatorTypes.TargetInfo(targetInfo.identifier, targetInfo.name)); + } + } + readSuccessHandler.handleInternal(targetInfoListCompat); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "TargetListAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + + @Override + public void onSubscriptionEstablished(long subscriptionId) { + subscriptionEstablishedHandler.handleInternal(); + } + }, + minInterval, + maxInterval); + return true; + } + + public boolean keypadInput_sendKey(ContentApp contentApp, byte keyCode, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.KeypadInputCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.KeypadInputCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.sendKey( + new ChipClusters.KeypadInputCluster.SendKeyResponseCallback() { + @Override + public void onSuccess(Integer status) { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "LauncherResponseCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + (int) keyCode); + return true; + } + + public boolean applicationBasic_readVendorName( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationBasicCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.readVendorNameAttribute( + new ChipClusters.CharStringAttributeCallback() { + @Override + public void onSuccess(String value) { + readSuccessHandler.handleInternal(value); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "CharStringAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean applicationBasic_readVendorID( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationBasicCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.readVendorIDAttribute( + new ChipClusters.IntegerAttributeCallback() { + @Override + public void onSuccess(int value) { + readSuccessHandler.handleInternal(value); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "IntegerAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean applicationBasic_readApplicationName( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationBasicCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.readApplicationNameAttribute( + new ChipClusters.CharStringAttributeCallback() { + @Override + public void onSuccess(String value) { + readSuccessHandler.handleInternal(value); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "CharStringAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean applicationBasic_readProductID( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationBasicCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.readProductIDAttribute( + new ChipClusters.IntegerAttributeCallback() { + @Override + public void onSuccess(int value) { + readSuccessHandler.handleInternal(value); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "IntegerAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean applicationBasic_readApplicationVersion( + ContentApp contentApp, + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.ApplicationBasicCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.ApplicationBasicCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.readApplicationVersionAttribute( + new ChipClusters.CharStringAttributeCallback() { + @Override + public void onSuccess(String value) { + readSuccessHandler.handleInternal(value); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "CharStringAttributeCallback.onError: " + error); + readFailureHandler.handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean onOff_on(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.OnOffCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.OnOffCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.on( + new ChipClusters.DefaultClusterCallback() { + @Override + public void onSuccess() { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "DefaultClusterCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean onOff_off(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.OnOffCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.OnOffCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.off( + new ChipClusters.DefaultClusterCallback() { + @Override + public void onSuccess() { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "DefaultClusterCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean onOff_toggle(ContentApp contentApp, Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.OnOffCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.OnOffCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.toggle( + new ChipClusters.DefaultClusterCallback() { + @Override + public void onSuccess() { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "DefaultClusterCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }); + return true; + } + + public boolean messages_presentMessages( + ContentApp contentApp, + byte[] messageID, + Integer priority, + Integer messageControl, + @Nullable Long startTime, + @Nullable Long duration, + String messageText, + Optional> responses, + Object responseHandler) { + + Endpoint endpoint = getTargetEndpoint(contentApp); + ChipClusters.MessagesCluster cluster = + endpoint != null ? endpoint.getCluster(ChipClusters.MessagesCluster.class) : null; + if (cluster == null) { + Log.e(TAG, "Cluster not found"); + return false; + } + + cluster.presentMessagesRequest( + new ChipClusters.DefaultClusterCallback() { + @Override + public void onSuccess() { + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.NO_ERROR); + } + + @Override + public void onError(Exception error) { + Log.e(TAG, "DefaultClusterCallback.onError: " + error); + ((MatterCallbackHandler) responseHandler) + .handleInternal(com.chip.casting.MatterError.MATTER_INTERNAL_ERROR); + } + }, + messageID, + priority, + messageControl, + startTime, + duration, + messageText, + responses); + return true; + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/VideoPlayer.java b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/VideoPlayer.java similarity index 81% rename from examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/VideoPlayer.java rename to examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/VideoPlayer.java index fab9b027a78cc4..1933e28979f8a6 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/VideoPlayer.java +++ b/examples/tv-casting-app/android/App/app/src/compat/jni/com/chip/casting/VideoPlayer.java @@ -17,15 +17,19 @@ */ package com.chip.casting; +import com.matter.casting.core.CastingPlayer; +import com.matter.casting.core.Endpoint; import java.net.InetAddress; -import java.util.HashSet; +import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.Set; +/** @deprecated Use the APIs described in /examples/tv-casting-app/APIs.md instead. */ +@Deprecated public class VideoPlayer { private static final String TAG = VideoPlayer.class.getSimpleName(); + private CastingPlayer castingPlayer; private long nodeId; private byte fabricIndex; private String deviceName; @@ -82,41 +86,25 @@ public VideoPlayer( this.isInitialized = true; } - public boolean isSameAs(DiscoveredNodeData discoveredNodeData) { - // return false because 'this' VideoPlayer is not null - if (discoveredNodeData == null) { - return false; - } - - // return true if hostNames match - if (Objects.equals(hostName, discoveredNodeData.getHostName())) { - return true; - } - - // return false because deviceNames are different - if (Objects.equals(deviceName, discoveredNodeData.getDeviceName()) == false) { - return false; - } - - // return false because not even a single IP Address matches - if (ipAddresses != null) { - boolean matchFound = false; - Set discoveredNodeDataIpAddressSet = - new HashSet(discoveredNodeData.getIpAddresses()); - for (InetAddress videoPlayerIpAddress : ipAddresses) { - if (discoveredNodeDataIpAddressSet.contains(videoPlayerIpAddress)) { - matchFound = true; - break; - } - } - - if (!matchFound) { - return false; + public VideoPlayer(CastingPlayer castingPlayer) { + this.castingPlayer = castingPlayer; + this.deviceType = (int) castingPlayer.getDeviceType(); + this.deviceName = castingPlayer.getDeviceName(); + this.hostName = castingPlayer.getHostName(); + this.ipAddresses = castingPlayer.getIpAddresses(); + this.numIPs = + castingPlayer.getIpAddresses() != null ? castingPlayer.getIpAddresses().size() : 0; + this.isConnected = castingPlayer.isConnected(); + this.productId = castingPlayer.getProductId(); + this.vendorId = castingPlayer.getVendorId(); + List endpoints = castingPlayer.getEndpoints(); + if (endpoints != null) { + this.contentApps = new ArrayList<>(); + for (Endpoint endpoint : endpoints) { + contentApps.add(new ContentApp(endpoint)); } } - - // otherwise, return true - return true; + this.isInitialized = true; } public boolean equals(Object object) { @@ -175,6 +163,10 @@ public String toString() { + '}'; } + CastingPlayer getCastingPlayer() { + return castingPlayer; + } + public long getNodeId() { return nodeId; } diff --git a/examples/tv-casting-app/android/App/app/src/main/AndroidManifest.xml b/examples/tv-casting-app/android/App/app/src/main/AndroidManifest.xml index e551de818eb5b0..b47ec80a86b0d9 100644 --- a/examples/tv-casting-app/android/App/app/src/main/AndroidManifest.xml +++ b/examples/tv-casting-app/android/App/app/src/main/AndroidManifest.xml @@ -18,9 +18,9 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:name=".chip.casting.app.ChipTvCastingApplication" + android:name=".matter.casting.ChipTvCastingApplication" android:theme="@style/Theme.CHIPTVCastingApp"> - diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java deleted file mode 100644 index 483f1efedb1b46..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/util/GlobalCastingConstants.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.chip.casting.util; - -public class GlobalCastingConstants { - public static final String CommissionerServiceType = "_matterd._udp."; - public static final int CommissioningWindowDurationSecs = 3 * 60; - public static final int SetupPasscode = 20202021; - public static final int Discriminator = 0xF00; - public static final boolean ChipCastingSimplified = - true; // set to true, to demo the simplified casting APIs. Otherwise, the older deprecated - // APIs are invoked -} diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ChipTvCastingApplication.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ChipTvCastingApplication.java similarity index 84% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ChipTvCastingApplication.java rename to examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ChipTvCastingApplication.java index 4986cc28e49c01..bea5b88a310158 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ChipTvCastingApplication.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ChipTvCastingApplication.java @@ -1,4 +1,4 @@ -package com.chip.casting.app; +package com.matter.casting; import android.app.Application; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MainActivity.java similarity index 92% rename from examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java rename to examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MainActivity.java index 685dbf2fb6426e..53908322d10155 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MainActivity.java @@ -1,4 +1,4 @@ -package com.chip.casting.app; +package com.matter.casting; import android.os.Bundle; import android.util.Log; @@ -9,15 +9,13 @@ import com.chip.casting.AppParameters; import com.chip.casting.DiscoveredNodeData; import com.chip.casting.TvCastingApp; +import com.chip.casting.app.CertTestFragment; +import com.chip.casting.app.CommissionerDiscoveryFragment; +import com.chip.casting.app.ConnectionFragment; +import com.chip.casting.app.ContentLauncherFragment; +import com.chip.casting.app.MediaPlaybackFragment; +import com.chip.casting.app.SelectClusterFragment; import com.chip.casting.util.GlobalCastingConstants; -import com.matter.casting.ActionSelectorFragment; -import com.matter.casting.ApplicationBasicReadVendorIDExampleFragment; -import com.matter.casting.ConnectionExampleFragment; -import com.matter.casting.ContentLauncherLaunchURLExampleFragment; -import com.matter.casting.DiscoveryExampleFragment; -import com.matter.casting.InitializationExample; -import com.matter.casting.MediaPlaybackSubscribeToCurrentStateExampleFragment; -import com.matter.casting.PreferencesConfigurationManager; import com.matter.casting.core.CastingPlayer; import java.util.Random; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java deleted file mode 100644 index 1a9556e5fdb6d2..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdDiscoveryListener.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - * - */ -package com.chip.casting; - -import android.net.nsd.NsdManager; -import android.net.nsd.NsdServiceInfo; -import android.util.Log; -import chip.platform.NsdManagerServiceResolver; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class NsdDiscoveryListener implements NsdManager.DiscoveryListener { - private static final String TAG = NsdDiscoveryListener.class.getSimpleName(); - - private final NsdManager nsdManager; - private final String targetServiceType; - private final List deviceTypeFilter; - private final List preCommissionedVideoPlayers; - private final SuccessCallback successCallback; - private final FailureCallback failureCallback; - private final NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; - private final ExecutorService resolutionExecutor; - - public NsdDiscoveryListener( - NsdManager nsdManager, - String targetServiceType, - List deviceTypeFilter, - List preCommissionedVideoPlayers, - SuccessCallback successCallback, - FailureCallback failureCallback, - NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState) { - this.nsdManager = nsdManager; - this.targetServiceType = targetServiceType; - this.deviceTypeFilter = deviceTypeFilter; - this.preCommissionedVideoPlayers = preCommissionedVideoPlayers; - this.successCallback = successCallback; - this.failureCallback = failureCallback; - this.nsdManagerResolverAvailState = nsdManagerResolverAvailState; - this.resolutionExecutor = Executors.newSingleThreadExecutor(); - } - - @Override - public void onDiscoveryStarted(String regType) { - Log.d(TAG, "Service discovery started. regType: " + regType); - } - - @Override - public void onServiceFound(NsdServiceInfo service) { - this.resolutionExecutor.execute( - new Runnable() { - @Override - public void run() { - Log.d(TAG, "Service discovery success. " + service); - if (service.getServiceType().equals(targetServiceType)) { - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.acquireResolver(); - } - - Log.d(TAG, "Calling NsdManager.resolveService for " + service); - nsdManager.resolveService( - service, - new NsdResolveListener( - nsdManager, - deviceTypeFilter, - preCommissionedVideoPlayers, - successCallback, - failureCallback, - nsdManagerResolverAvailState, - 1)); - } else { - Log.d(TAG, "Ignoring discovered service: " + service.toString()); - } - } - }); - } - - @Override - public void onServiceLost(NsdServiceInfo service) { - // When the network service is no longer available. - // Internal bookkeeping code goes here. - Log.e(TAG, "Service lost: " + service); - failureCallback.handle(MatterError.DISCOVERY_SERVICE_LOST); - } - - @Override - public void onDiscoveryStopped(String serviceType) { - Log.i(TAG, "Discovery stopped: " + serviceType); - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.signalFree(); - } - } - - @Override - public void onStartDiscoveryFailed(String serviceType, int errorCode) { - Log.e(TAG, "Discovery failed to start: Error code:" + errorCode); - TvCastingApp.getInstance().resetDiscoveryState(); - failureCallback.handle( - new MatterError( - 3, "NsdDiscoveryListener Discovery failed to start: Nsd Error code:" + errorCode)); - } - - @Override - public void onStopDiscoveryFailed(String serviceType, int errorCode) { - Log.e(TAG, "Discovery failed to stop: Error code:" + errorCode); - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.signalFree(); - } - failureCallback.handle( - new MatterError( - 3, "NsdDiscoveryListener Discovery failed to stop: Nsd Error code:" + errorCode)); - } -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdResolveListener.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdResolveListener.java deleted file mode 100644 index 638425675dc99b..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/NsdResolveListener.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - * - */ -package com.chip.casting; - -import android.net.nsd.NsdManager; -import android.net.nsd.NsdServiceInfo; -import android.util.Log; -import chip.platform.NsdManagerServiceResolver; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class NsdResolveListener implements NsdManager.ResolveListener { - - private static final String TAG = NsdResolveListener.class.getSimpleName(); - - private static final int MAX_RESOLUTION_ATTEMPTS = 5; - private static final int RESOLUTION_ATTEMPT_DELAY_SECS = 1; - - private final NsdManager nsdManager; - private final List deviceTypeFilter; - private final List preCommissionedVideoPlayers; - private final SuccessCallback successCallback; - private final FailureCallback failureCallback; - private final NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; - private final int resolutionAttemptNumber; - - public NsdResolveListener( - NsdManager nsdManager, - List deviceTypeFilter, - List preCommissionedVideoPlayers, - SuccessCallback successCallback, - FailureCallback failureCallback, - NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState, - int resolutionAttemptNumber) { - this.nsdManager = nsdManager; - this.deviceTypeFilter = deviceTypeFilter; - this.preCommissionedVideoPlayers = preCommissionedVideoPlayers; - if (preCommissionedVideoPlayers != null) { - for (VideoPlayer videoPlayer : preCommissionedVideoPlayers) { - Log.d(TAG, "Precommissioned video player: " + videoPlayer); - } - } - this.successCallback = successCallback; - this.failureCallback = failureCallback; - this.nsdManagerResolverAvailState = nsdManagerResolverAvailState; - this.resolutionAttemptNumber = resolutionAttemptNumber; - } - - @Override - public void onServiceResolved(NsdServiceInfo serviceInfo) { - DiscoveredNodeData discoveredNodeData = new DiscoveredNodeData(serviceInfo); - Log.d(TAG, "DiscoveredNodeData resolved: " + discoveredNodeData); - - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.signalFree(); - } - - if (isPassingDeviceTypeFilter(discoveredNodeData)) { - addCommissioningInfo(discoveredNodeData); - successCallback.handle(discoveredNodeData); - } else { - Log.d( - TAG, - "DiscoveredNodeData ignored because it did not pass the device type filter " - + discoveredNodeData); - } - } - - @Override - public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { - if (nsdManagerResolverAvailState != null) { - if (errorCode != NsdManager.FAILURE_ALREADY_ACTIVE - || resolutionAttemptNumber >= MAX_RESOLUTION_ATTEMPTS) { - nsdManagerResolverAvailState.signalFree(); - } - } - - switch (errorCode) { - case NsdManager.FAILURE_ALREADY_ACTIVE: - Log.e(TAG, "NsdResolveListener FAILURE_ALREADY_ACTIVE - Service: " + serviceInfo); - if (resolutionAttemptNumber < MAX_RESOLUTION_ATTEMPTS) { - Log.d(TAG, "NsdResolveListener Scheduling a retry to resolve service " + serviceInfo); - Executors.newSingleThreadScheduledExecutor() - .schedule( - new Runnable() { - @Override - public void run() { - nsdManager.resolveService( - serviceInfo, - new NsdResolveListener( - nsdManager, - deviceTypeFilter, - preCommissionedVideoPlayers, - successCallback, - failureCallback, - nsdManagerResolverAvailState, - resolutionAttemptNumber + 1)); - } - }, - RESOLUTION_ATTEMPT_DELAY_SECS, - TimeUnit.SECONDS); - } else { // giving up - failureCallback.handle( - new MatterError( - 3, "NsdResolveListener FAILURE_ALREADY_ACTIVE - Service: " + serviceInfo)); - } - break; - case NsdManager.FAILURE_INTERNAL_ERROR: - Log.e(TAG, "NsdResolveListener FAILURE_INTERNAL_ERROR - Service: " + serviceInfo); - failureCallback.handle( - new MatterError( - 3, "NsdResolveListener FAILURE_INTERNAL_ERROR - Service: " + serviceInfo)); - break; - case NsdManager.FAILURE_MAX_LIMIT: - Log.e(TAG, "NsdResolveListener FAILURE_MAX_LIMIT - Service: " + serviceInfo); - failureCallback.handle( - new MatterError(19, "NsdResolveListener FAILURE_MAX_LIMIT - Service: " + serviceInfo)); - break; - } - } - - private boolean isPassingDeviceTypeFilter(DiscoveredNodeData discoveredNodeData) { - return deviceTypeFilter == null - || deviceTypeFilter.isEmpty() - || deviceTypeFilter.contains(discoveredNodeData.getDeviceType()); - } - - private void addCommissioningInfo(DiscoveredNodeData discoveredNodeData) { - if (preCommissionedVideoPlayers != null) { - long currentUnixTimeMS = System.currentTimeMillis(); - for (VideoPlayer videoPlayer : preCommissionedVideoPlayers) { - if (videoPlayer.isSameAs(discoveredNodeData)) { - Log.d( - TAG, - "Matching Video Player with the following information found for DiscoveredNodeData" - + videoPlayer); - Log.d(TAG, "Updating discovery timestamp for VideoPlayer to " + currentUnixTimeMS); - videoPlayer.setLastDiscoveredMs(currentUnixTimeMS); - discoveredNodeData.setConnectableVideoPlayer(videoPlayer); - return; - } - } - } - Log.d( - TAG, - "No matching VideoPlayers found from the cache for new DiscoveredNodeData: " - + discoveredNodeData); - } -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java deleted file mode 100644 index 9dd0fa500d9e2b..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - * - */ -package com.chip.casting; - -import android.content.Context; -import android.net.nsd.NsdManager; -import android.net.wifi.WifiManager; -import android.util.Log; -import chip.appserver.ChipAppServer; -import chip.platform.AndroidBleManager; -import chip.platform.AndroidChipPlatform; -import chip.platform.ChipMdnsCallbackImpl; -import chip.platform.DiagnosticDataProviderImpl; -import chip.platform.NsdManagerServiceBrowser; -import chip.platform.NsdManagerServiceResolver; -import chip.platform.PreferencesKeyValueStoreManager; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.function.Predicate; - -public class TvCastingApp { - private static final String TAG = TvCastingApp.class.getSimpleName(); - private static final String DISCOVERY_TARGET_SERVICE_TYPE = "_matterd._udp."; - private static final List DISCOVERY_TARGET_DEVICE_TYPE_FILTER = - Arrays.asList(35L); // Video player = 35; - - // delay before which we assume undiscovered cached players may be in STR mode - private static final long CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC = 5; - - private static TvCastingApp sInstance; - private Context applicationContext; - private ChipAppServer chipAppServer; - private NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; - private boolean discoveryStarted = false; - private Object discoveryLock = new Object(); - - private List discoveredPlayers; - private ScheduledFuture reportSleepingVideoPlayerCommissionersFuture; - - private WifiManager.MulticastLock multicastLock; - private NsdManager nsdManager; - private NsdDiscoveryListener nsdDiscoveryListener; - - private TvCastingApp() {} - - public static TvCastingApp getInstance() { - if (sInstance == null) { - sInstance = new TvCastingApp(); - } - return sInstance; - } - - public boolean initApp(Context applicationContext, AppParameters appParameters) { - if (applicationContext == null - || appParameters == null - || appParameters.getConfigurationManager() == null) { - return false; - } - - this.applicationContext = applicationContext; - nsdManagerResolverAvailState = new NsdManagerServiceResolver.NsdManagerResolverAvailState(); - NsdManagerServiceResolver nsdManagerServiceResolver = - new NsdManagerServiceResolver(applicationContext, nsdManagerResolverAvailState); - - AndroidChipPlatform chipPlatform = - new AndroidChipPlatform( - new AndroidBleManager(), - new PreferencesKeyValueStoreManager(applicationContext), - appParameters.getConfigurationManager(), - nsdManagerServiceResolver, - new NsdManagerServiceBrowser(applicationContext), - new ChipMdnsCallbackImpl(), - new DiagnosticDataProviderImpl(applicationContext)); - - boolean ret = - chipPlatform.updateCommissionableDataProviderData( - appParameters.getSpake2pVerifierBase64(), - appParameters.getSpake2pSaltBase64(), - appParameters.getSpake2pIterationCount(), - appParameters.getSetupPasscode(), - appParameters.getDiscriminator()); - if (!ret) { - Log.e( - TAG, - "TvCastingApp.initApp failed to updateCommissionableDataProviderData on chipPlatform"); - return ret; - } - - ret = preInitJni(appParameters); - if (!ret) { - Log.e(TAG, "TvCastingApp.initApp failed in preInitJni"); - return ret; - } - - chipAppServer = new ChipAppServer(); - ret = chipAppServer.startApp(); - if (!ret) { - Log.e(TAG, "TvCastingApp.initApp failed in start chipAppServer"); - return ret; - } - - return initJni(appParameters); - } - - public native void setDACProvider(DACProvider provider); - - private native boolean preInitJni(AppParameters appParameters); - - private native boolean initJni(AppParameters appParameters); - - public void discoverVideoPlayerCommissioners( - SuccessCallback discoverySuccessCallback, - FailureCallback discoveryFailureCallback) { - synchronized (discoveryLock) { - Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners called"); - - if (this.discoveryStarted) { - Log.d(TAG, "Discovery already started, stopping before starting again"); - stopVideoPlayerDiscovery(); - } - - List preCommissionedVideoPlayers = readCachedVideoPlayers(); - - WifiManager wifiManager = - (WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE); - multicastLock = wifiManager.createMulticastLock("multicastLock"); - multicastLock.setReferenceCounted(true); - multicastLock.acquire(); - - nsdManager = (NsdManager) applicationContext.getSystemService(Context.NSD_SERVICE); - discoveredPlayers = new ArrayList<>(); - nsdDiscoveryListener = - new NsdDiscoveryListener( - nsdManager, - DISCOVERY_TARGET_SERVICE_TYPE, - DISCOVERY_TARGET_DEVICE_TYPE_FILTER, - preCommissionedVideoPlayers, - new SuccessCallback() { - @Override - public void handle(DiscoveredNodeData commissioner) { - Log.d(TAG, "Discovered commissioner added " + commissioner); - discoveredPlayers.add(commissioner); - discoverySuccessCallback.handle(commissioner); - } - }, - discoveryFailureCallback, - nsdManagerResolverAvailState); - - nsdManager.discoverServices( - DISCOVERY_TARGET_SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, nsdDiscoveryListener); - Log.d(TAG, "TvCastingApp.discoverVideoPlayerCommissioners started"); - - /** - * Surface players (as DiscoveredNodeData objects on discoverySuccessCallback) that we - * previously connected to and received their WakeOnLAN MACAddress, but could not discover - * over DNS-SD this time in CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC. This API will also - * ensure that the reported players were previously discoverable within - * CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS. - * - *

The DiscoveredNodeData object for such players will have the IsAsleep attribute set to - * true, which can optionally be used for any special UX treatment when displaying them. - * - *

Surfacing such players as discovered will allow displaying them to the user, who may - * want to cast to them. In such a case, the VerifyOrEstablishConnection API will turn them on - * over WakeOnLan. - */ - this.reportSleepingVideoPlayerCommissionersFuture = - Executors.newScheduledThreadPool(1) - .schedule( - () -> { - Log.d( - TAG, - "Scheduling reportSleepingCommissioners with commissioner count " - + (preCommissionedVideoPlayers != null - ? preCommissionedVideoPlayers.size() - : 0)); - reportSleepingVideoPlayerCommissioners( - preCommissionedVideoPlayers, discoverySuccessCallback); - }, - CHIP_DEVICE_CONFIG_STR_DISCOVERY_DELAY_SEC * 1000, - TimeUnit.MILLISECONDS); - - this.discoveryStarted = true; - } - } - - private void reportSleepingVideoPlayerCommissioners( - List cachedVideoPlayers, - SuccessCallback discoverySuccessCallback) { - Log.d( - TAG, - "TvCastingApp.reportSleepingVideoPlayerCommissioners called with commissioner count " - + (cachedVideoPlayers != null ? cachedVideoPlayers.size() : 0)); - if (cachedVideoPlayers == null) { - Log.d(TAG, "No cached video players available."); - return; - } - - for (VideoPlayer player : cachedVideoPlayers) { - Log.d(TAG, "Cached Video Player: " + player); - // do NOT surface this cached Player if we don't have its MACAddress - if (player.getMACAddress() == null) { - Log.d( - TAG, - "TvCastingApp.reportSleepingVideoPlayerCommissioners Skipping Player with hostName" - + player.getHostName() - + " but no MACAddress"); - continue; - } - - // do NOT surface this cached Player if it has not been discoverable recently (in - // CHIP_DEVICE_CONFIG_STR_CACHE_LAST_DISCOVERED_HOURS) - if (!WasRecentlyDiscoverable(player)) { - Log.d( - TAG, - "TvCastingApp.reportSleepingVideoPlayerCommissioners Skipping Player with hostName" - + player.getHostName() - + " that has not been discovered recently"); - continue; - } - - // do NOT surface this cached Player if it was just discovered right now (in this discovery - // call) - boolean justDiscovered = - discoveredPlayers - .stream() - .anyMatch( - new Predicate() { - @Override - public boolean test(DiscoveredNodeData discoveredNodeData) { - return player.getHostName().equals(discoveredNodeData.getHostName()); - } - }); - if (justDiscovered) { - Log.d( - TAG, - "TvCastingApp.reportSleepingVideoPlayerCommissioners Skipping Player with hostName" - + player.getHostName() - + " that was just discovered"); - continue; - } - - // DO surface this cached Player (as asleep) - Log.d(TAG, "Reporting sleeping player with hostName " + player.getHostName()); - player.setIsAsleep(true); - discoverySuccessCallback.handle(new DiscoveredNodeData(player)); - } - } - - private native boolean WasRecentlyDiscoverable(VideoPlayer player); - - public void stopVideoPlayerDiscovery() { - synchronized (discoveryLock) { - Log.d(TAG, "TvCastingApp trying to stop video player discovery"); - if (this.discoveryStarted - && nsdManager != null - && multicastLock != null - && nsdDiscoveryListener != null) { - Log.d(TAG, "TvCastingApp stopping Video Player commissioner discovery"); - try { - nsdManager.stopServiceDiscovery(nsdDiscoveryListener); - } catch (IllegalArgumentException e) { - Log.w( - TAG, - "TvCastingApp received exception on calling nsdManager.stopServiceDiscovery() " - + e.getMessage()); - } - - if (multicastLock.isHeld()) { - multicastLock.release(); - } - - if (reportSleepingVideoPlayerCommissionersFuture != null) { - reportSleepingVideoPlayerCommissionersFuture.cancel(false); - } - this.discoveryStarted = false; - } - } - } - - void resetDiscoveryState() { - synchronized (discoveryLock) { - Log.d(TAG, "TvCastingApp resetting discovery state"); - this.discoveryStarted = false; - this.nsdDiscoveryListener = null; - if (multicastLock != null && multicastLock.isHeld()) { - multicastLock.release(); - } - } - } - - public native boolean openBasicCommissioningWindow( - int duration, - CommissioningCallbacks commissioningCallbacks, - SuccessCallback onConnectionSuccess, - FailureCallback onConnectionFailure, - SuccessCallback onNewOrUpdatedEndpointCallback); - - public native boolean sendCommissioningRequest(DiscoveredNodeData commissioner); - - /** @Deprecated Use sendCommissioningRequest(DiscoveredNodeData) instead */ - private native boolean sendUserDirectedCommissioningRequest(String address, int port); - - public native List readCachedVideoPlayers(); - - public native boolean verifyOrEstablishConnection( - VideoPlayer targetVideoPlayer, - SuccessCallback onConnectionSuccess, - FailureCallback onConnectionFailure, - SuccessCallback onNewOrUpdatedEndpointCallback); - - public native void shutdownAllSubscriptions(); - - public native void disconnect(); - - public native List getActiveTargetVideoPlayers(); - - public native boolean purgeCache(); - - /* - * CONTENT LAUNCHER CLUSTER - * - * TODO: Add API to subscribe to AcceptHeader - */ - public native boolean contentLauncherLaunchURL( - ContentApp contentApp, String contentUrl, String contentDisplayStr, Object launchURLHandler); - - public native boolean contentLauncher_launchContent( - ContentApp contentApp, - ContentLauncherTypes.ContentSearch search, - boolean autoPlay, - String data, - Object responseHandler); - - public native boolean contentLauncher_subscribeToSupportedStreamingProtocols( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - /* - * LEVEL CONTROL CLUSTER - */ - public native boolean levelControl_step( - ContentApp contentApp, - byte stepMode, - byte stepSize, - short transitionTime, - byte optionMask, - byte optionOverridem, - Object responseHandler); - - public native boolean levelControl_moveToLevel( - ContentApp contentApp, - byte level, - short transitionTime, - byte optionMask, - byte optionOverridem, - Object responseHandler); - - public native boolean levelControl_subscribeToCurrentLevel( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean levelControl_subscribeToMinLevel( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean levelControl_subscribeToMaxLevel( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - /* - * MEDIA PLAYBACK CLUSTER - */ - public native boolean mediaPlayback_play(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_pause(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_stopPlayback(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_next(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_previous(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_rewind(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_fastForward(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_startOver(ContentApp contentApp, Object responseHandler); - - public native boolean mediaPlayback_seek( - ContentApp contentApp, long position, Object responseHandler); - - public native boolean mediaPlayback_skipForward( - ContentApp contentApp, long deltaPositionMilliseconds, Object responseHandler); - - public native boolean mediaPlayback_skipBackward( - ContentApp contentApp, long deltaPositionMilliseconds, Object responseHandler); - - public native boolean mediaPlayback_subscribeToCurrentState( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean mediaPlayback_subscribeToDuration( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean mediaPlayback_subscribeToSampledPosition( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean mediaPlayback_subscribeToPlaybackSpeed( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean mediaPlayback_subscribeToSeekRangeEnd( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean mediaPlayback_subscribeToSeekRangeStart( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - /* - * APPLICATION LAUNCHER CLUSTER - */ - public native boolean applicationLauncher_launchApp( - ContentApp contentApp, - short catalogVendorId, - String applicationId, - byte[] data, - Object responseHandler); - - public native boolean applicationLauncher_stopApp( - ContentApp contentApp, short catalogVendorId, String applicationId, Object responseHandler); - - public native boolean applicationLauncher_hideApp( - ContentApp contentApp, short catalogVendorId, String applicationId, Object responseHandler); - - /* - * TARGET NAVIGATOR CLUSTER - */ - public native boolean targetNavigator_navigateTarget( - ContentApp contentApp, byte target, String data, Object responseHandler); - - public native boolean targetNavigator_subscribeToCurrentTarget( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean targetNavigator_subscribeToTargetList( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - /* - * KEYPAD INPUT CLUSTER - */ - public native boolean keypadInput_sendKey( - ContentApp contentApp, byte keyCode, Object responseHandler); - - /** - * APPLICATION BASIC - * - *

TODO: Add APIs to subscribe to & read Application, Status and AllowedVendorList - */ - public native boolean applicationBasic_subscribeToVendorName( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean applicationBasic_subscribeToVendorID( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean applicationBasic_subscribeToApplicationName( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean applicationBasic_subscribeToProductID( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean applicationBasic_subscribeToApplicationVersion( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler, - int minInterval, - int maxInterval, - SubscriptionEstablishedCallback subscriptionEstablishedHandler); - - public native boolean applicationBasic_readVendorName( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler); - - public native boolean applicationBasic_readVendorID( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler); - - public native boolean applicationBasic_readApplicationName( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler); - - public native boolean applicationBasic_readProductID( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler); - - public native boolean applicationBasic_readApplicationVersion( - ContentApp contentApp, - SuccessCallback readSuccessHandler, - FailureCallback readFailureHandler); - - public native boolean onOff_on(ContentApp contentApp, Object responseHandler); - - public native boolean onOff_off(ContentApp contentApp, Object responseHandler); - - public native boolean onOff_toggle(ContentApp contentApp, Object responseHandler); - - public native boolean messages_presentMessages( - ContentApp contentApp, String messageText, Object responseHandler); - - static { - System.loadLibrary("TvCastingApp"); - } -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java index 854cf76ce8aca8..63e8da3d31b609 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java @@ -20,7 +20,7 @@ import android.util.Log; public interface DataProvider { - public static final String TAG = DataProvider.class.getSimpleName(); + String TAG = DataProvider.class.getSimpleName(); default T _get() { T val = null; @@ -32,5 +32,5 @@ default T _get() { return val; } - public abstract T get(); + T get(); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h deleted file mode 100644 index 735cabf2375f51..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - * - */ -#pragma once - -enum MediaCommandName -{ - ContentLauncher_LaunchURL, - ContentLauncher_LaunchContent, - LevelControl_Step, - LevelControl_MoveToLevel, - OnOff_On, - OnOff_Off, - OnOff_Toggle, - MediaPlayback_Play, - MediaPlayback_Pause, - MediaPlayback_StopPlayback, - MediaPlayback_Next, - MediaPlayback_Previous, - MediaPlayback_Rewind, - MediaPlayback_FastForward, - MediaPlayback_StartOver, - MediaPlayback_Seek, - MediaPlayback_SkipForward, - MediaPlayback_SkipBackward, - Messages_PresentMessagesRequest, - ApplicationLauncher_LaunchApp, - ApplicationLauncher_StopApp, - ApplicationLauncher_HideApp, - TargetNavigator_NavigateTarget, - KeypadInput_SendKey, - - MEDIA_COMMAND_COUNT -}; - -enum MediaAttributeName -{ - ContentLauncher_SupportedStreamingProtocols, - ContentLauncher_AcceptHeader, - LevelControl_CurrentLevel, - LevelControl_MinLevel, - LevelControl_MaxLevel, - MediaPlayback_CurrentState, - MediaPlayback_StartTime, - MediaPlayback_Duration, - MediaPlayback_SampledPosition, - MediaPlayback_PlaybackSpeed, - MediaPlayback_SeekRangeEnd, - MediaPlayback_SeekRangeStart, - ApplicationLauncher_CurrentApp, - TargetNavigator_TargetList, - TargetNavigator_CurrentTarget, - ApplicationBasic_VendorName, - ApplicationBasic_VendorID, - ApplicationBasic_ApplicationName, - ApplicationBasic_ProductID, - ApplicationBasic_ApplicationVersion, - - MEDIA_ATTRIBUTE_COUNT -}; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp deleted file mode 100644 index c8a38942e60234..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "ConversionUtils.h" - -#include -#include -#include -#include -#include -#include -#include - -CHIP_ERROR convertJAppParametersToCppAppParams(jobject appParameters, AppParams & outAppParams) -{ - ChipLogProgress(AppServer, "convertJAppParametersToCppAppParams called"); - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturnError(appParameters != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - jclass jAppParametersClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/AppParameters", jAppParametersClass)); - - jmethodID getRotatingDeviceIdUniqueIdMethod = env->GetMethodID(jAppParametersClass, "getRotatingDeviceIdUniqueId", "()[B"); - if (getRotatingDeviceIdUniqueIdMethod == nullptr) - { - ChipLogError(Zcl, "Failed to access AppParameters 'getRotatingDeviceIdUniqueId' method"); - env->ExceptionClear(); - } - - jobject jRotatingDeviceIdUniqueId = (jobject) env->CallObjectMethod(appParameters, getRotatingDeviceIdUniqueIdMethod); - if (env->ExceptionCheck()) - { - ChipLogError(Zcl, "Java exception in AppParameters::getRotatingDeviceIdUniqueId"); - env->ExceptionDescribe(); - env->ExceptionClear(); - return CHIP_ERROR_INCORRECT_STATE; - } - - if (jRotatingDeviceIdUniqueId != nullptr) - { - chip::JniByteArray * jniRotatingDeviceIdUniqueIdByteArray = - new chip::JniByteArray(env, static_cast(jRotatingDeviceIdUniqueId)); - outAppParams.SetRotatingDeviceIdUniqueId(MakeOptional(jniRotatingDeviceIdUniqueIdByteArray->byteSpan())); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR convertJContentAppToTargetEndpointInfo(jobject contentApp, TargetEndpointInfo & outTargetEndpointInfo) -{ - ChipLogProgress(AppServer, "convertJContentAppToTargetEndpointInfo called"); - VerifyOrReturnError(contentApp != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass jContentAppClass; - ReturnErrorOnFailure(chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/ContentApp", jContentAppClass)); - - jfieldID jEndpointIdField = env->GetFieldID(jContentAppClass, "endpointId", "S"); - jshort jEndpointId = env->GetShortField(contentApp, jEndpointIdField); - outTargetEndpointInfo.Initialize(static_cast(jEndpointId)); - - jfieldID jclusterIdsField = env->GetFieldID(jContentAppClass, "clusterIds", "Ljava/util/List;"); - jobject jClusterIds = env->GetObjectField(contentApp, jclusterIdsField); - if (jClusterIds == nullptr) - { - return CHIP_NO_ERROR; - } - - jobject jIterator = env->CallObjectMethod( - jClusterIds, env->GetMethodID(env->GetObjectClass(jClusterIds), "iterator", "()Ljava/util/Iterator;")); - jmethodID jNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "next", "()Ljava/lang/Object;"); - jmethodID jHasNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "hasNext", "()Z"); - - while (env->CallBooleanMethod(jIterator, jHasNextMid)) - { - jobject jClusterId = env->CallObjectMethod(jIterator, jNextMid); - jclass jIntegerClass = env->FindClass("java/lang/Integer"); - jmethodID jIntValueMid = env->GetMethodID(jIntegerClass, "intValue", "()I"); - outTargetEndpointInfo.AddCluster(static_cast(env->CallIntMethod(jClusterId, jIntValueMid))); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR convertTargetEndpointInfoToJContentApp(TargetEndpointInfo * targetEndpointInfo, jobject & outContentApp) -{ - ChipLogProgress(AppServer, "convertTargetEndpointInfoToJContentApp called"); - if (targetEndpointInfo != nullptr && targetEndpointInfo->IsInitialized()) - { - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass jContentAppClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/ContentApp", jContentAppClass)); - jmethodID jContentAppConstructor = env->GetMethodID(jContentAppClass, "", "(SLjava/util/List;)V"); - chip::ClusterId * clusters = targetEndpointInfo->GetClusters(); - jobject jClustersArrayList = nullptr; - if (clusters != nullptr) - { - chip::JniReferences::GetInstance().CreateArrayList(jClustersArrayList); - for (size_t i = 0; i < kMaxNumberOfClustersPerEndpoint && clusters[i] != chip::kInvalidClusterId; i++) - { - jobject jCluster = nullptr; - jint jniclusterId = static_cast(clusters[i]); - chip::JniReferences::GetInstance().CreateBoxedObject("java/lang/Integer", "(I)V", jniclusterId, jCluster); - chip::JniReferences::GetInstance().AddToList(jClustersArrayList, jCluster); - } - } - outContentApp = - env->NewObject(jContentAppClass, jContentAppConstructor, targetEndpointInfo->GetEndpointId(), jClustersArrayList); - } - return CHIP_NO_ERROR; -} - -CHIP_ERROR convertJVideoPlayerToTargetVideoPlayerInfo(jobject videoPlayer, TargetVideoPlayerInfo & outTargetVideoPlayerInfo) -{ - ChipLogProgress(AppServer, "convertJVideoPlayerToTargetVideoPlayerInfo called"); - VerifyOrReturnError(videoPlayer != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass jVideoPlayerClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/VideoPlayer", jVideoPlayerClass)); - - jfieldID jNodeIdField = env->GetFieldID(jVideoPlayerClass, "nodeId", "J"); - chip::NodeId nodeId = static_cast(env->GetLongField(videoPlayer, jNodeIdField)); - - jfieldID jFabricIndexField = env->GetFieldID(jVideoPlayerClass, "fabricIndex", "B"); - chip::FabricIndex fabricIndex = static_cast(env->GetByteField(videoPlayer, jFabricIndexField)); - - jfieldID jVendorIdField = env->GetFieldID(jVideoPlayerClass, "vendorId", "I"); - uint16_t vendorId = static_cast(env->GetIntField(videoPlayer, jVendorIdField)); - - jfieldID jProductIdField = env->GetFieldID(jVideoPlayerClass, "productId", "I"); - uint16_t productId = static_cast(env->GetIntField(videoPlayer, jProductIdField)); - - jfieldID jDeviceType = env->GetFieldID(jVideoPlayerClass, "deviceType", "I"); - uint16_t deviceType = static_cast(env->GetIntField(videoPlayer, jDeviceType)); - - jfieldID getDeviceNameField = env->GetFieldID(jVideoPlayerClass, "deviceName", "Ljava/lang/String;"); - jstring jDeviceName = static_cast(env->GetObjectField(videoPlayer, getDeviceNameField)); - const char * deviceName = env->GetStringUTFChars(jDeviceName, 0); - - jfieldID getHostNameField = env->GetFieldID(jVideoPlayerClass, "hostName", "Ljava/lang/String;"); - jstring jHostName = static_cast(env->GetObjectField(videoPlayer, getHostNameField)); - const char * hostName = env->GetStringUTFChars(jHostName, 0); - - jfieldID jPort = env->GetFieldID(jVideoPlayerClass, "port", "I"); - uint16_t port = static_cast(env->GetIntField(videoPlayer, jPort)); - - jfieldID getInstanceNameField = env->GetFieldID(jVideoPlayerClass, "instanceName", "Ljava/lang/String;"); - jstring jInstanceName = static_cast(env->GetObjectField(videoPlayer, getInstanceNameField)); - const char * instanceName = {}; - if (jInstanceName != nullptr) - { - instanceName = env->GetStringUTFChars(jInstanceName, 0); - } - - jfieldID jLastDiscoveredMs = env->GetFieldID(jVideoPlayerClass, "lastDiscoveredMs", "J"); - long lastDiscoveredMs = static_cast(env->GetLongField(videoPlayer, jLastDiscoveredMs)); - - jfieldID getMACAddressField = env->GetFieldID(jVideoPlayerClass, "MACAddress", "Ljava/lang/String;"); - jstring jMACAddress = static_cast(env->GetObjectField(videoPlayer, getMACAddressField)); - const char * MACAddress = jMACAddress == nullptr ? nullptr : env->GetStringUTFChars(jMACAddress, 0); - - jfieldID jIsAsleep = env->GetFieldID(jVideoPlayerClass, "isAsleep", "Z"); - bool isAsleep = static_cast(env->GetBooleanField(videoPlayer, jIsAsleep)); - - outTargetVideoPlayerInfo.Initialize(nodeId, fabricIndex, nullptr, nullptr, vendorId, productId, deviceType, deviceName, - hostName, 0, nullptr, port, instanceName, chip::System::Clock::Timestamp(lastDiscoveredMs)); - - if (MACAddress != nullptr) - { - chip::CharSpan MACAddressSpan(MACAddress, 2 * 2 * chip::DeviceLayer::ConfigurationManager::kPrimaryMACAddressLength); - outTargetVideoPlayerInfo.SetMACAddress(MACAddressSpan); - } - - outTargetVideoPlayerInfo.SetIsAsleep(isAsleep); - - jfieldID jContentAppsField = env->GetFieldID(jVideoPlayerClass, "contentApps", "Ljava/util/List;"); - jobject jContentApps = env->GetObjectField(videoPlayer, jContentAppsField); - if (jContentApps == nullptr) - { - return CHIP_NO_ERROR; - } - - jobject jIterator = env->CallObjectMethod( - jContentApps, env->GetMethodID(env->GetObjectClass(jContentApps), "iterator", "()Ljava/util/Iterator;")); - jmethodID jNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "next", "()Ljava/lang/Object;"); - jmethodID jHasNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "hasNext", "()Z"); - - while (env->CallBooleanMethod(jIterator, jHasNextMid)) - { - jobject jContentApp = env->CallObjectMethod(jIterator, jNextMid); - - jclass jContentAppClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/ContentApp", jContentAppClass)); - jfieldID jEndpointIdField = env->GetFieldID(jContentAppClass, "endpointId", "S"); - chip::EndpointId endpointId = static_cast(env->GetShortField(jContentApp, jEndpointIdField)); - TargetEndpointInfo * endpoint = outTargetVideoPlayerInfo.GetOrAddEndpoint(endpointId); - - ReturnErrorOnFailure(convertJContentAppToTargetEndpointInfo(jContentApp, *endpoint)); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR convertTargetVideoPlayerInfoToJVideoPlayer(TargetVideoPlayerInfo * targetVideoPlayerInfo, jobject & outVideoPlayer) -{ - ChipLogProgress(AppServer, "convertTargetVideoPlayerInfoToJVideoPlayer called"); - if (targetVideoPlayerInfo != nullptr && targetVideoPlayerInfo->IsInitialized()) - { - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass jVideoPlayerClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/VideoPlayer", jVideoPlayerClass)); - jmethodID jVideoPlayerConstructor = env->GetMethodID(jVideoPlayerClass, "", - "(JBLjava/lang/String;IIILjava/util/List;ILjava/util/List;Ljava/lang/" - "String;Ljava/lang/String;IJLjava/lang/String;ZZ)V"); - - jobject jContentAppList = nullptr; - TargetEndpointInfo * endpoints = targetVideoPlayerInfo->GetEndpoints(); - if (endpoints != nullptr) - { - chip::JniReferences::GetInstance().CreateArrayList(jContentAppList); - for (size_t i = 0; i < kMaxNumberOfEndpoints && endpoints[i].IsInitialized(); i++) - { - jobject contentApp = nullptr; - ReturnErrorOnFailure(convertTargetEndpointInfoToJContentApp(&endpoints[i], contentApp)); - chip::JniReferences::GetInstance().AddToList(jContentAppList, contentApp); - } - } - - jstring deviceName = - targetVideoPlayerInfo->GetDeviceName() == nullptr ? nullptr : env->NewStringUTF(targetVideoPlayerInfo->GetDeviceName()); - - jstring hostName = - targetVideoPlayerInfo->GetHostName() == nullptr ? nullptr : env->NewStringUTF(targetVideoPlayerInfo->GetHostName()); - - jstring instanceName = targetVideoPlayerInfo->GetInstanceName() == nullptr - ? nullptr - : env->NewStringUTF(targetVideoPlayerInfo->GetInstanceName()); - - jstring MACAddress = nullptr; - if (targetVideoPlayerInfo->GetMACAddress() != nullptr && targetVideoPlayerInfo->GetMACAddress()->data() != nullptr) - { - char MACAddressWithNil[2 * chip::DeviceLayer::ConfigurationManager::kPrimaryMACAddressLength + 1]; - memcpy(MACAddressWithNil, targetVideoPlayerInfo->GetMACAddress()->data(), - targetVideoPlayerInfo->GetMACAddress()->size()); - MACAddressWithNil[targetVideoPlayerInfo->GetMACAddress()->size()] = '\0'; - MACAddress = env->NewStringUTF(MACAddressWithNil); - } - - jobject jIPAddressList = nullptr; - const chip::Inet::IPAddress * ipAddresses = targetVideoPlayerInfo->GetIpAddresses(); - if (ipAddresses != nullptr) - { - chip::JniReferences::GetInstance().CreateArrayList(jIPAddressList); - for (size_t i = 0; i < targetVideoPlayerInfo->GetNumIPs() && i < chip::Dnssd::CommonResolutionData::kMaxIPAddresses; - i++) - { - char addrCString[chip::Inet::IPAddress::kMaxStringLength]; - ipAddresses[i].ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength); - jstring jIPAddressStr = env->NewStringUTF(addrCString); - - jclass jIPAddressClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "java/net/InetAddress", jIPAddressClass)); - jmethodID jGetByNameMid = - env->GetStaticMethodID(jIPAddressClass, "getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;"); - jobject jIPAddress = env->CallStaticObjectMethod(jIPAddressClass, jGetByNameMid, jIPAddressStr); - - chip::JniReferences::GetInstance().AddToList(jIPAddressList, jIPAddress); - } - } - - outVideoPlayer = env->NewObject( - jVideoPlayerClass, jVideoPlayerConstructor, targetVideoPlayerInfo->GetNodeId(), targetVideoPlayerInfo->GetFabricIndex(), - deviceName, targetVideoPlayerInfo->GetVendorId(), targetVideoPlayerInfo->GetProductId(), - targetVideoPlayerInfo->GetDeviceType(), jContentAppList, targetVideoPlayerInfo->GetNumIPs(), jIPAddressList, hostName, - instanceName, targetVideoPlayerInfo->GetPort(), targetVideoPlayerInfo->GetLastDiscovered().count(), MACAddress, - targetVideoPlayerInfo->IsAsleep(), targetVideoPlayerInfo->GetOperationalDeviceProxy() != nullptr); - } - return CHIP_NO_ERROR; -} - -CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscoveredNodeData, - chip::Dnssd::CommissionNodeData & outCppDiscoveredNodeData) -{ - ChipLogProgress(AppServer, "convertJDiscoveredNodeDataToCppDiscoveredNodeData called"); - VerifyOrReturnError(jDiscoveredNodeData != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass jDiscoveredNodeDataClass; - ReturnErrorOnFailure( - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/DiscoveredNodeData", jDiscoveredNodeDataClass)); - - jfieldID getHostNameField = env->GetFieldID(jDiscoveredNodeDataClass, "hostName", "Ljava/lang/String;"); - jstring jHostName = static_cast(env->GetObjectField(jDiscoveredNodeData, getHostNameField)); - if (jHostName != nullptr) - { - chip::Platform::CopyString(outCppDiscoveredNodeData.hostName, chip::Dnssd::kHostNameMaxLength + 1, - env->GetStringUTFChars(jHostName, 0)); - } - - jfieldID getInstanceNameField = env->GetFieldID(jDiscoveredNodeDataClass, "instanceName", "Ljava/lang/String;"); - jstring jInstanceName = static_cast(env->GetObjectField(jDiscoveredNodeData, getInstanceNameField)); - if (jInstanceName != nullptr) - { - chip::Platform::CopyString(outCppDiscoveredNodeData.instanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1, - env->GetStringUTFChars(jInstanceName, 0)); - } - - jfieldID jLongDiscriminatorField = env->GetFieldID(jDiscoveredNodeDataClass, "longDiscriminator", "J"); - outCppDiscoveredNodeData.vendorId = static_cast(env->GetLongField(jDiscoveredNodeData, jLongDiscriminatorField)); - - jfieldID jVendorIdField = env->GetFieldID(jDiscoveredNodeDataClass, "vendorId", "J"); - outCppDiscoveredNodeData.vendorId = static_cast(env->GetLongField(jDiscoveredNodeData, jVendorIdField)); - - jfieldID jProductIdField = env->GetFieldID(jDiscoveredNodeDataClass, "productId", "J"); - outCppDiscoveredNodeData.productId = static_cast(env->GetLongField(jDiscoveredNodeData, jProductIdField)); - - jfieldID jCommissioningModeField = env->GetFieldID(jDiscoveredNodeDataClass, "commissioningMode", "B"); - outCppDiscoveredNodeData.commissioningMode = - static_cast(env->GetByteField(jDiscoveredNodeData, jCommissioningModeField)); - - jfieldID jDeviceTypeField = env->GetFieldID(jDiscoveredNodeDataClass, "deviceType", "J"); - outCppDiscoveredNodeData.deviceType = static_cast(env->GetLongField(jDiscoveredNodeData, jDeviceTypeField)); - - jfieldID getDeviceNameField = env->GetFieldID(jDiscoveredNodeDataClass, "deviceName", "Ljava/lang/String;"); - jstring jDeviceName = static_cast(env->GetObjectField(jDiscoveredNodeData, getDeviceNameField)); - if (jDeviceName != nullptr) - { - chip::Platform::CopyString(outCppDiscoveredNodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, - env->GetStringUTFChars(jDeviceName, 0)); - } - - // TODO: map rotating ID - jfieldID jRotatingIdLenField = env->GetFieldID(jDiscoveredNodeDataClass, "rotatingIdLen", "I"); - outCppDiscoveredNodeData.rotatingIdLen = static_cast(env->GetIntField(jDiscoveredNodeData, jRotatingIdLenField)); - - jfieldID jPairingHintField = env->GetFieldID(jDiscoveredNodeDataClass, "pairingHint", "S"); - outCppDiscoveredNodeData.pairingHint = static_cast(env->GetShortField(jDiscoveredNodeData, jPairingHintField)); - - jfieldID getPairingInstructionField = env->GetFieldID(jDiscoveredNodeDataClass, "pairingInstruction", "Ljava/lang/String;"); - jstring jPairingInstruction = static_cast(env->GetObjectField(jDiscoveredNodeData, getPairingInstructionField)); - if (jPairingInstruction != nullptr) - { - chip::Platform::CopyString(outCppDiscoveredNodeData.pairingInstruction, chip::Dnssd::kMaxPairingInstructionLen + 1, - env->GetStringUTFChars(jPairingInstruction, 0)); - } - - jfieldID jPortField = env->GetFieldID(jDiscoveredNodeDataClass, "port", "I"); - outCppDiscoveredNodeData.port = static_cast(env->GetIntField(jDiscoveredNodeData, jPortField)); - - jfieldID jNumIpsField = env->GetFieldID(jDiscoveredNodeDataClass, "numIPs", "I"); - outCppDiscoveredNodeData.numIPs = static_cast(env->GetIntField(jDiscoveredNodeData, jNumIpsField)); - - jfieldID jIPAddressesField = env->GetFieldID(jDiscoveredNodeDataClass, "ipAddresses", "Ljava/util/List;"); - jobject jIPAddresses = env->GetObjectField(jDiscoveredNodeData, jIPAddressesField); - if (jIPAddresses == nullptr && outCppDiscoveredNodeData.numIPs > 0) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - - jobject jIterator = env->CallObjectMethod( - jIPAddresses, env->GetMethodID(env->GetObjectClass(jIPAddresses), "iterator", "()Ljava/util/Iterator;")); - jmethodID jNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "next", "()Ljava/lang/Object;"); - jmethodID jHasNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "hasNext", "()Z"); - - size_t ipAddressCount = 0; - while (env->CallBooleanMethod(jIterator, jHasNextMid)) - { - jobject jIPAddress = env->CallObjectMethod(jIterator, jNextMid); - jclass jIPAddressClass; - ReturnErrorOnFailure(chip::JniReferences::GetInstance().GetLocalClassRef(env, "java/net/InetAddress", jIPAddressClass)); - jmethodID jGetHostAddressMid = env->GetMethodID(jIPAddressClass, "getHostAddress", "()Ljava/lang/String;"); - jstring jIPAddressStr = static_cast(env->CallObjectMethod(jIPAddress, jGetHostAddressMid)); - - chip::Inet::IPAddress addressInet; - chip::JniUtfString addressJniString(env, jIPAddressStr); - VerifyOrReturnError(chip::Inet::IPAddress::FromString(addressJniString.c_str(), addressInet), CHIP_ERROR_INVALID_ARGUMENT); - outCppDiscoveredNodeData.ipAddress[ipAddressCount] = addressInet; - - if (ipAddressCount == 0) - { - outCppDiscoveredNodeData.interfaceId = chip::Inet::InterfaceId::FromIPAddress(addressInet); - } - ipAddressCount++; - } - - return CHIP_NO_ERROR; -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h deleted file mode 100644 index 28f5a1abd28c5a..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include "AppParams.h" -#include "TargetEndpointInfo.h" -#include "TargetVideoPlayerInfo.h" - -#include - -CHIP_ERROR convertJAppParametersToCppAppParams(jobject appParameters, AppParams & outAppParams); - -CHIP_ERROR convertJContentAppToTargetEndpointInfo(jobject contentApp, TargetEndpointInfo & outTargetEndpointInfo); - -CHIP_ERROR convertTargetEndpointInfoToJContentApp(TargetEndpointInfo * targetEndpointInfo, jobject & outContentApp); - -CHIP_ERROR convertJVideoPlayerToTargetVideoPlayerInfo(jobject videoPlayer, TargetVideoPlayerInfo & targetVideoPlayerInfo); - -CHIP_ERROR convertTargetVideoPlayerInfoToJVideoPlayer(TargetVideoPlayerInfo * targetVideoPlayerInfo, jobject & outVideoPlayer); - -CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscoveredNodeData, - chip::Dnssd::CommissionNodeData & cppDiscoveredNodeData); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp deleted file mode 100644 index ca62ba5f37ee22..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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 "MatterCallbackHandler-JNI.h" - -#include - -using namespace chip; - -CHIP_ERROR CallbackBaseJNI::SetUp(JNIEnv * env, jobject inHandler) -{ - ChipLogProgress(AppServer, "CallbackBaseJNI::SetUp called"); - CHIP_ERROR err = CHIP_NO_ERROR; - - VerifyOrExit(mObject.Init(inHandler) == CHIP_NO_ERROR, ChipLogError(AppServer, "Failed to Init mObject")); - - mClazz = env->GetObjectClass(mObject.ObjectRef()); - VerifyOrExit(mClazz != nullptr, ChipLogError(AppServer, "Failed to get handler Java class")); - - mSuperClazz = env->GetSuperclass(mClazz); - VerifyOrExit(mSuperClazz != nullptr, ChipLogError(AppServer, "Failed to get handler's parent's Java class")); - - mMethod = env->GetMethodID(mSuperClazz, "handleInternal", mMethodSignature); - if (mMethod == nullptr) - { - ChipLogError(AppServer, "Failed to access 'handleInternal' method with signature %s", mMethodSignature); - env->ExceptionClear(); - } - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "CallbackBaseJNI::SetUp error: %s", err.AsString()); - return err; - } - - return err; -} - -void FailureHandlerJNI::Handle(CHIP_ERROR callbackErr) -{ - ChipLogProgress(AppServer, "Handle(CHIP_ERROR) called"); - - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - UtfString jniCallbackErrString(env, callbackErr.AsString()); - - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrExit(mObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - env->CallVoidMethod(mObject.ObjectRef(), mMethod, static_cast(callbackErr.AsInteger()), jniCallbackErrString.jniValue()); -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "Handle(CHIP_ERROR) status error: %s", err.AsString()); - } -} - -void SubscriptionEstablishedHandlerJNI::Handle() -{ - ChipLogProgress(AppServer, "SubscriptionEstablishedHandlerJNI::Handle called"); - - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrExit(mObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - env->CallVoidMethod(mObject.ObjectRef(), mMethod); -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "SubscriptionEstablishedHandlerJNI::Handle status error: %s", err.AsString()); - } -} - -jobject ConvertToLongJObject(uint64_t responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass responseTypeClass = env->FindClass("java/lang/Long"); - if (responseTypeClass == nullptr) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(J)V"); - return env->NewObject(responseTypeClass, constructor, responseData); -} - -jobject ConvertToFloatJObject(float responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass responseTypeClass = env->FindClass("java/lang/Float"); - if (responseTypeClass == nullptr) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(F)V"); - return env->NewObject(responseTypeClass, constructor, responseData); -} - -jobject ConvertToShortJObject(uint16_t responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass responseTypeClass = env->FindClass("java/lang/Short"); - if (responseTypeClass == nullptr) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(S)V"); - return env->NewObject(responseTypeClass, constructor, responseData); -} - -jobject ConvertToByteJObject(uint8_t responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass responseTypeClass = env->FindClass("java/lang/Byte"); - if (responseTypeClass == nullptr) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(B)V"); - return env->NewObject(responseTypeClass, constructor, responseData); -} - -jstring ConvertToJString(chip::CharSpan responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - return env->NewStringUTF(std::string(responseData.data(), responseData.size()).c_str()); -} - -jobject ConvertToIntegerJObject(uint32_t responseData) -{ - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - - jclass responseTypeClass = env->FindClass("java/lang/Integer"); - if (responseTypeClass == nullptr) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(I)V"); - return env->NewObject(responseTypeClass, constructor, responseData); -} - -// COMMISSIONING AND CONNECTION -jobject OnConnectionSuccessHandlerJNI::ConvertToJObject(TargetVideoPlayerInfo * targetVideoPlayerInfo) -{ - ChipLogProgress(AppServer, "OnConnectionSuccessHandlerJNI::ConvertToJObject called"); - jobject videoPlayer = nullptr; - CHIP_ERROR err = convertTargetVideoPlayerInfoToJVideoPlayer(targetVideoPlayerInfo, videoPlayer); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "OnConnectionSuccessHandlerJNI::ConvertToJObject failed with %" CHIP_ERROR_FORMAT, err.Format()); - } - return videoPlayer; -} - -jobject OnNewOrUpdatedEndpointHandlerJNI::ConvertToJObject(TargetEndpointInfo * targetEndpointInfo) -{ - ChipLogProgress(AppServer, "OnNewOrUpdatedEndpointHandlerJNI::ConvertToJObject called"); - jobject contentApp = nullptr; - CHIP_ERROR err = convertTargetEndpointInfoToJContentApp(targetEndpointInfo, contentApp); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "OnNewOrUpdatedEndpointHandlerJNI::ConvertToJObject failed with %" CHIP_ERROR_FORMAT, err.Format()); - } - return contentApp; -} - -// MEDIA PLAYBACK -jobject CurrentStateSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "CurrentStateSuccessHandlerJNI::ConvertToJObject called"); - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturnValue(env != nullptr, nullptr); - JniLocalReferenceScope scope(env); - - jclass enumClass = nullptr; - CHIP_ERROR err = - JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/MediaPlaybackTypes$PlaybackStateEnum", enumClass); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jfieldID enumType = nullptr; - switch (responseData) - { - case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPlaying: - enumType = env->GetStaticFieldID(enumClass, "Playing", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); - break; - case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPaused: - enumType = env->GetStaticFieldID(enumClass, "Paused", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); - break; - case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kNotPlaying: - enumType = env->GetStaticFieldID(enumClass, "NotPlaying", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); - break; - case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kBuffering: - enumType = env->GetStaticFieldID(enumClass, "Buffering", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); - break; - default: - enumType = env->GetStaticFieldID(enumClass, "Unknown", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); - break; - } - - if (enumType != nullptr) - { - return env->GetStaticObjectField(enumClass, enumType); - } - return nullptr; -} - -jobject DurationSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "DurationSuccessHandlerJNI::ConvertToJObject called"); - return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); -} - -jobject SampledPositionSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "SampledPositionSuccessHandlerJNI::ConvertToJObject called"); - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturnValue(env != nullptr, nullptr); - JniLocalReferenceScope scope(env); - - jobject jSampledPosition = nullptr; - if (!responseData.IsNull()) - { - const chip::app::Clusters::MediaPlayback::Structs::PlaybackPositionStruct::DecodableType & playbackPosition = - responseData.Value(); - - jclass responseTypeClass = nullptr; - CHIP_ERROR err = JniReferences::GetInstance().GetLocalClassRef( - env, "com/chip/casting/MediaPlaybackTypes$PlaybackPositionStruct", responseTypeClass); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - if (playbackPosition.position.IsNull()) - { - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Long;)V"); - jSampledPosition = env->NewObject(responseTypeClass, constructor, playbackPosition.updatedAt); - } - else - { - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Long;java/lang/Long;)V"); - jSampledPosition = - env->NewObject(responseTypeClass, constructor, playbackPosition.updatedAt, playbackPosition.position.Value()); - } - } - - return jSampledPosition; -} - -jobject PlaybackSpeedSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "PlaybackSpeedSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToFloatJObject(responseData); -} - -jobject SeekRangeEndSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "SeekRangeEndSuccessHandlerJNI::ConvertToJObject called"); - return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); -} - -jobject SeekRangeStartSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "SeekRangeStartSuccessHandlerJNI::ConvertToJObject called"); - return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); -} - -// TARGET NAVIGATOR -jobject CurrentTargetSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "CurrentTargetSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToByteJObject(responseData); -} - -jobject TargetListSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "TargetListSuccessHandlerJNI::ConvertToJObject called"); - - JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturnValue(env != nullptr, nullptr); - JniLocalReferenceScope scope(env); - - jobject jArrayList; - chip::JniReferences::GetInstance().CreateArrayList(jArrayList); - auto iter = responseData.begin(); - while (iter.Next()) - { - const chip::app::Clusters::TargetNavigator::Structs::TargetInfoStruct::DecodableType & targetInfo = iter.GetValue(); - - jclass responseTypeClass = nullptr; - CHIP_ERROR err = JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/TargetNavigatorTypes$TargetInfo", - responseTypeClass); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); - return nullptr; - } - - jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Integer;Ljava/lang/String;)V"); - chip::UtfString targetInfoName(env, targetInfo.name); - jobject jTargetInfo = env->NewObject(responseTypeClass, constructor, ConvertToIntegerJObject(targetInfo.identifier), - targetInfoName.jniValue()); - - chip::JniReferences::GetInstance().AddToList(jArrayList, jTargetInfo); - } - return jArrayList; -} - -// LEVEL CONTROL -jobject CurrentLevelSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "CurrentLevelSuccessHandlerJNI::ConvertToJObject called"); - return responseData.IsNull() ? nullptr : ConvertToByteJObject(responseData.Value()); -} - -jobject MinLevelSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "MinLevelSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToByteJObject(responseData); -} - -jobject MaxLevelSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "MaxLevelSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToByteJObject(responseData); -} - -// CONTENT LAUNCHER -jobject SupportedStreamingProtocolsSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "SupportedStreamingProtocolsSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToIntegerJObject(responseData.Raw()); -} - -// APPLICATION BASIC -jobject VendorNameSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "VendorNameSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToJString(responseData); -} - -jobject VendorIDSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "VendorIDSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToIntegerJObject(responseData); -} - -jobject ApplicationNameSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "ApplicationNameSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToJString(responseData); -} - -jobject ProductIDSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "ProductIDSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToIntegerJObject(responseData); -} - -jobject ApplicationVersionSuccessHandlerJNI::ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData) -{ - ChipLogProgress(AppServer, "ApplicationVersionSuccessHandlerJNI::ConvertToJObject called"); - return ConvertToJString(responseData); -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h deleted file mode 100644 index 152dac59737532..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include "ConversionUtils.h" -#include "TargetEndpointInfo.h" -#include "TargetVideoPlayerInfo.h" - -#include -#include -#include -#include -#include - -#include - -class CallbackBaseJNI -{ -public: - CallbackBaseJNI(const char * methodSignature) { mMethodSignature = methodSignature; } - CHIP_ERROR SetUp(JNIEnv * env, jobject inHandler); - -protected: - chip::JniGlobalReference mObject; - jclass mClazz = nullptr; - jclass mSuperClazz = nullptr; - jmethodID mMethod = nullptr; - const char * mMethodSignature = nullptr; -}; - -class FailureHandlerJNI : public CallbackBaseJNI -{ -public: - FailureHandlerJNI() : CallbackBaseJNI("(ILjava/lang/String;)V") {} - void Handle(CHIP_ERROR err); -}; - -class MatterCallbackHandlerJNI : public FailureHandlerJNI -{ -}; - -class SubscriptionEstablishedHandlerJNI : public CallbackBaseJNI -{ -public: - SubscriptionEstablishedHandlerJNI() : CallbackBaseJNI("()V") {} - void Handle(); -}; - -// helper functions for conversions -jobject ConvertToLongJObject(uint64_t responseData); -jobject ConvertToFloatJObject(float responseData); -jobject ConvertToShortJObject(uint8_t responseData); -jobject ConvertToByteJObject(uint8_t responseData); -jobject ConvertToIntegerJObject(uint32_t responseData); -jstring ConvertToJString(chip::CharSpan responseData); - -template -class SuccessHandlerJNI : public CallbackBaseJNI -{ -public: - SuccessHandlerJNI(const char * methodSignature) : CallbackBaseJNI(methodSignature) {} - - virtual ~SuccessHandlerJNI() = 0; - - virtual jobject ConvertToJObject(T responseData) = 0; - - void Handle(T responseData) - { - ChipLogProgress(AppServer, "SuccessHandlerJNI::Handle called"); - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - jobject jResponseData = ConvertToJObject(responseData); - - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrExit(mObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - env->CallVoidMethod(mObject.ObjectRef(), mMethod, jResponseData); - exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "SuccessHandlerJNI::Handle status error: %s", err.AsString()); - } - } -}; - -template -SuccessHandlerJNI::~SuccessHandlerJNI(){}; - -// COMMISSIONING AND CONNECTION -class SessionEstablishmentStartedHandlerJNI : public SuccessHandlerJNI -{ -public: - SessionEstablishmentStartedHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(void * responseData) - { - // return nullptr because the Java callback extends SuccessCallback and its handle() expects a Void param. - // It expects a Void becauase no value is passed as part of this callback. - return nullptr; - } -}; - -class SessionEstablishedHandlerJNI : public SuccessHandlerJNI -{ -public: - SessionEstablishedHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(void * responseData) - { - // return nullptr because the Java callback extends SuccessCallback and its handle() expects a Void param. - // It expects a Void becauase no value is passed as part of this callback. - return nullptr; - } -}; - -class OnConnectionSuccessHandlerJNI : public SuccessHandlerJNI -{ -public: - OnConnectionSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(TargetVideoPlayerInfo * responseData); -}; - -class OnNewOrUpdatedEndpointHandlerJNI : public SuccessHandlerJNI -{ -public: - OnNewOrUpdatedEndpointHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(TargetEndpointInfo * responseData); -}; - -// MEDIA PLAYBACK -class CurrentStateSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - CurrentStateSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData); -}; - -class DurationSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - DurationSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} - jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData); -}; - -class SampledPositionSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - SampledPositionSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData); -}; - -class PlaybackSpeedSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - PlaybackSpeedSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Float;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData); -}; - -class SeekRangeEndSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - SeekRangeEndSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} - jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData); -}; - -class SeekRangeStartSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - SeekRangeStartSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData); -}; - -// TARGET NAVIGATOR -class CurrentTargetSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - CurrentTargetSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData); -}; - -class TargetListSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - TargetListSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} - jobject ConvertToJObject(chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData); -}; - -// LEVEL CONTROL -class CurrentLevelSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - CurrentLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} - jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData); -}; - -class MinLevelSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - MinLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} - jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData); -}; - -class MaxLevelSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - MaxLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} - jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData); -}; - -// CONTENT LAUNCHER -class SupportedStreamingProtocolsSuccessHandlerJNI - : public SuccessHandlerJNI< - chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType> -{ -public: - SupportedStreamingProtocolsSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Integer;)V") {} - jobject ConvertToJObject( - chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData); -}; - -// APPLICATION BASIC -class VendorNameSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - VendorNameSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData); -}; - -class VendorIDSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - VendorIDSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Integer;)V") {} - jobject ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData); -}; - -class ApplicationNameSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - ApplicationNameSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} - jobject - ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData); -}; - -class ProductIDSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - ProductIDSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Integer;)V") {} - jobject ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData); -}; - -class ApplicationVersionSuccessHandlerJNI - : public SuccessHandlerJNI -{ -public: - ApplicationVersionSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} - jobject ConvertToJObject( - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData); -}; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp deleted file mode 100644 index f2e0d5b79fc53c..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp +++ /dev/null @@ -1,2129 +0,0 @@ -/* - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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 "TvCastingApp-JNI.h" -#include "CastingServer.h" -#include "Constants.h" -#include "ConversionUtils.h" -#include "JNIDACProvider.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace chip; - -#define JNI_METHOD(RETURN, METHOD_NAME) extern "C" JNIEXPORT RETURN JNICALL Java_com_chip_casting_TvCastingApp_##METHOD_NAME - -TvCastingAppJNI TvCastingAppJNI::sInstance; - -jint JNI_OnLoad(JavaVM * jvm, void * reserved) -{ - return AndroidAppServerJNI_OnLoad(jvm, reserved); -} - -void JNI_OnUnload(JavaVM * jvm, void * reserved) -{ - return AndroidAppServerJNI_OnUnload(jvm, reserved); -} - -JNI_METHOD(jboolean, preInitJni)(JNIEnv *, jobject, jobject jAppParameters) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD preInitJni called"); - - CHIP_ERROR err = CHIP_NO_ERROR; - if (jAppParameters == nullptr) - { - err = CastingServer::GetInstance()->PreInit(); - } - else - { - AppParams appParams; - err = convertJAppParametersToCppAppParams(jAppParameters, appParams); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion of AppParameters from jobject to Cpp type failed: %" CHIP_ERROR_FORMAT, - err.Format())); - err = CastingServer::GetInstance()->PreInit(&appParams); - } - VerifyOrExit( - err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Call to CastingServer::GetInstance()->PreInit() failed: %" CHIP_ERROR_FORMAT, err.Format())); -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, initJni)(JNIEnv *, jobject, jobject jAppParameters) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD initJni called"); - - CHIP_ERROR err = CHIP_NO_ERROR; - if (jAppParameters == nullptr) - { - err = CastingServer::GetInstance()->Init(); - } - else - { - AppParams appParams; - err = convertJAppParametersToCppAppParams(jAppParameters, appParams); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion of AppParameters from jobject to Cpp type failed: %" CHIP_ERROR_FORMAT, - err.Format())); - err = CastingServer::GetInstance()->Init(&appParams); - } - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Call to CastingServer::GetInstance()->Init() failed: %" CHIP_ERROR_FORMAT, err.Format())); -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(void, setDACProvider)(JNIEnv *, jobject, jobject provider) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD setDACProvider called"); - - JNIDACProvider * p = new JNIDACProvider(provider); - chip::Credentials::SetDeviceAttestationCredentialsProvider(p); -} - -JNI_METHOD(jboolean, openBasicCommissioningWindow) -(JNIEnv * env, jobject, jint duration, jobject jCommissioningCallbacks, jobject jOnConnectionSuccessHandler, - jobject jOnConnectionFailureHandler, jobject jOnNewOrUpdatedEndpointHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD openBasicCommissioningWindow called with duration %d", duration); - - CHIP_ERROR err = CHIP_NO_ERROR; - - CommissioningCallbacks commissioningCallbacks; - jclass jCommissioningCallbacksClass; - chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/CommissioningCallbacks", - jCommissioningCallbacksClass); - - jfieldID jCommissioningCompleteField = - env->GetFieldID(jCommissioningCallbacksClass, "commissioningComplete", "Ljava/lang/Object;"); - jobject jCommissioningComplete = env->GetObjectField(jCommissioningCallbacks, jCommissioningCompleteField); - if (jCommissioningComplete != nullptr) - { - err = TvCastingAppJNIMgr().getCommissioningCompleteHandler().SetUp(env, jCommissioningComplete); - VerifyOrReturnValue(err == CHIP_NO_ERROR, false, - ChipLogError(AppServer, "MatterCallbackHandlerJNI::SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - commissioningCallbacks.commissioningComplete = [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getCommissioningCompleteHandler().Handle(err); - }; - } - - jfieldID jSessionEstablishmentStartedField = - env->GetFieldID(jCommissioningCallbacksClass, "sessionEstablishmentStarted", "Lcom/chip/casting/SuccessCallback;"); - jobject jSessionEstablishmentStarted = env->GetObjectField(jCommissioningCallbacks, jSessionEstablishmentStartedField); - if (jSessionEstablishmentStarted != nullptr) - { - err = TvCastingAppJNIMgr().getSessionEstablishmentStartedHandler().SetUp(env, jSessionEstablishmentStarted); - VerifyOrReturnValue( - err == CHIP_NO_ERROR, false, - ChipLogError(AppServer, "SessionEstablishmentStartedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - commissioningCallbacks.sessionEstablishmentStarted = []() { - TvCastingAppJNIMgr().getSessionEstablishmentStartedHandler().Handle(nullptr); - }; - } - - jfieldID jSessionEstablishedField = - env->GetFieldID(jCommissioningCallbacksClass, "sessionEstablished", "Lcom/chip/casting/SuccessCallback;"); - jobject jSessionEstablished = env->GetObjectField(jCommissioningCallbacks, jSessionEstablishedField); - if (jSessionEstablished != nullptr) - { - err = TvCastingAppJNIMgr().getSessionEstablishedHandler().SetUp(env, jSessionEstablished); - VerifyOrReturnValue(err == CHIP_NO_ERROR, false, - ChipLogError(AppServer, "SessionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - commissioningCallbacks.sessionEstablished = []() { TvCastingAppJNIMgr().getSessionEstablishedHandler().Handle(nullptr); }; - } - - jfieldID jSessionEstablishmentErrorField = - env->GetFieldID(jCommissioningCallbacksClass, "sessionEstablishmentError", "Lcom/chip/casting/FailureCallback;"); - jobject jSessionEstablishmentError = env->GetObjectField(jCommissioningCallbacks, jSessionEstablishmentErrorField); - if (jSessionEstablishmentError != nullptr) - { - err = TvCastingAppJNIMgr().getSessionEstablishmentErrorHandler().SetUp(env, jSessionEstablishmentError); - VerifyOrReturnValue(err == CHIP_NO_ERROR, false); - commissioningCallbacks.sessionEstablishmentError = [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getSessionEstablishmentErrorHandler().Handle(err); - }; - } - - jfieldID jSessionEstablishmentStoppedField = - env->GetFieldID(jCommissioningCallbacksClass, "sessionEstablishmentStopped", "Lcom/chip/casting/FailureCallback;"); - jobject jSessionEstablishmentStopped = env->GetObjectField(jCommissioningCallbacks, jSessionEstablishmentStoppedField); - if (jSessionEstablishmentStopped != nullptr) - { - err = TvCastingAppJNIMgr().getSessionEstablishmentStoppedHandler().SetUp(env, jSessionEstablishmentStopped); - VerifyOrReturnValue( - err == CHIP_NO_ERROR, false, - ChipLogError(AppServer, "SessionEstablishmentStoppedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - commissioningCallbacks.sessionEstablishmentStopped = []() { - TvCastingAppJNIMgr().getSessionEstablishmentStoppedHandler().Handle(CHIP_NO_ERROR); - }; - } - - err = TvCastingAppJNIMgr().getOnConnectionSuccessHandler(false).SetUp(env, jOnConnectionSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnConnectionSuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getOnConnectionFailureHandler(false).SetUp(env, jOnConnectionFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnConnectionFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getOnNewOrUpdatedEndpointHandler(false).SetUp(env, jOnNewOrUpdatedEndpointHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnNewOrUpdatedEndpointHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->OpenBasicCommissioningWindow( - commissioningCallbacks, - [](TargetVideoPlayerInfo * videoPlayer) { TvCastingAppJNIMgr().getOnConnectionSuccessHandler(false).Handle(videoPlayer); }, - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getOnConnectionFailureHandler(false).Handle(err); }, - [](TargetEndpointInfo * endpoint) { TvCastingAppJNIMgr().getOnNewOrUpdatedEndpointHandler(false).Handle(endpoint); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer::OpenBasicCommissioningWindow failed: %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jobject, readCachedVideoPlayers)(JNIEnv * env, jobject) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD readCachedVideoPlayers called"); - - jobject jVideoPlayerList = nullptr; - TargetVideoPlayerInfo * targetVideoPlayerInfoList = CastingServer::GetInstance()->ReadCachedTargetVideoPlayerInfos(); - if (targetVideoPlayerInfoList != nullptr) - { - chip::JniReferences::GetInstance().CreateArrayList(jVideoPlayerList); - for (size_t i = 0; targetVideoPlayerInfoList[i].IsInitialized(); i++) - { - jobject jVideoPlayer = nullptr; - CHIP_ERROR err = convertTargetVideoPlayerInfoToJVideoPlayer(&targetVideoPlayerInfoList[i], jVideoPlayer); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, - "Conversion from TargetVideoPlayerInfo * to jobject VideoPlayer failed: %" CHIP_ERROR_FORMAT, - err.Format()); - continue; - } - chip::JniReferences::GetInstance().AddToList(jVideoPlayerList, jVideoPlayer); - } - } - - return jVideoPlayerList; -} - -JNI_METHOD(jboolean, verifyOrEstablishConnection) -(JNIEnv * env, jobject, jobject videoPlayer, jobject jOnConnectionSuccessHandler, jobject jOnConnectionFailureHandler, - jobject jOnNewOrUpdatedEndpointHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD verifyOrEstablishConnection called"); - - TargetVideoPlayerInfo targetVideoPlayerInfo; - CHIP_ERROR err = convertJVideoPlayerToTargetVideoPlayerInfo(videoPlayer, targetVideoPlayerInfo); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, - "Conversion from jobject VideoPlayer to TargetVideoPlayerInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getOnConnectionSuccessHandler(true).SetUp(env, jOnConnectionSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnConnectionSuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getOnConnectionFailureHandler(true).SetUp(env, jOnConnectionFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnConnectionFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getOnNewOrUpdatedEndpointHandler(true).SetUp(env, jOnNewOrUpdatedEndpointHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "OnNewOrUpdatedEndpointHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->VerifyOrEstablishConnection( - targetVideoPlayerInfo, - [](TargetVideoPlayerInfo * videoPlayer) { TvCastingAppJNIMgr().getOnConnectionSuccessHandler(true).Handle(videoPlayer); }, - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getOnConnectionFailureHandler(true).Handle(err); }, - [](TargetEndpointInfo * endpoint) { TvCastingAppJNIMgr().getOnNewOrUpdatedEndpointHandler(true).Handle(endpoint); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer::verifyOrEstablishConnection failed: %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, WasRecentlyDiscoverable) -(JNIEnv * env, jobject, jobject videoPlayer) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD WasRecentlyDiscoverable called"); - - TargetVideoPlayerInfo targetVideoPlayerInfo; - CHIP_ERROR err = convertJVideoPlayerToTargetVideoPlayerInfo(videoPlayer, targetVideoPlayerInfo); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, - "Conversion from jobject VideoPlayer to TargetVideoPlayerInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - return targetVideoPlayerInfo.WasRecentlyDiscoverable(); - -exit: - return false; // default to false -} - -JNI_METHOD(void, shutdownAllSubscriptions)(JNIEnv * env, jobject) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD shutdownAllSubscriptions called"); - - CastingServer::GetInstance()->ShutdownAllSubscriptions(); -} - -JNI_METHOD(void, disconnect)(JNIEnv * env, jobject) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD disconnect called"); - CastingServer::GetInstance()->Disconnect(); -} - -JNI_METHOD(jobject, getActiveTargetVideoPlayers)(JNIEnv * env, jobject) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD getActiveTargetVideoPlayers called"); - - jobject jVideoPlayerList = nullptr; - TargetVideoPlayerInfo * targetVideoPlayerInfo = CastingServer::GetInstance()->GetActiveTargetVideoPlayer(); - if (targetVideoPlayerInfo != nullptr) - { - chip::JniReferences::GetInstance().CreateArrayList(jVideoPlayerList); - jobject jVideoPlayer = nullptr; - CHIP_ERROR err = convertTargetVideoPlayerInfoToJVideoPlayer(targetVideoPlayerInfo, jVideoPlayer); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "Conversion from TargetVideoPlayerInfo * to jobject VideoPlayer failed: %" CHIP_ERROR_FORMAT, - err.Format()); - } - else - { - chip::JniReferences::GetInstance().AddToList(jVideoPlayerList, jVideoPlayer); - } - } - return jVideoPlayerList; -} - -JNI_METHOD(jboolean, sendUserDirectedCommissioningRequest)(JNIEnv * env, jobject, jstring addressJStr, jint port) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD sendUserDirectedCommissioningRequest called with port %d", port); - Inet::IPAddress addressInet; - JniUtfString addressJniString(env, addressJStr); - if (Inet::IPAddress::FromString(addressJniString.c_str(), addressInet) == false) - { - ChipLogError(AppServer, "Failed to parse IP address"); - return false; - } - - chip::Inet::InterfaceId interfaceId = chip::Inet::InterfaceId::FromIPAddress(addressInet); - chip::Transport::PeerAddress peerAddress = - chip::Transport::PeerAddress::UDP(addressInet, static_cast(port), interfaceId); - CHIP_ERROR err = CastingServer::GetInstance()->SendUserDirectedCommissioningRequest(peerAddress); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "TVCastingApp-JNI::sendUserDirectedCommissioningRequest failed: %" CHIP_ERROR_FORMAT, err.Format()); - return false; - } - return true; -} - -JNI_METHOD(jboolean, sendCommissioningRequest)(JNIEnv * env, jobject, jobject jDiscoveredNodeData) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD sendCommissioningRequest called"); - - chip::Dnssd::CommissionNodeData commissioner; - CHIP_ERROR err = convertJDiscoveredNodeDataToCppDiscoveredNodeData(jDiscoveredNodeData, commissioner); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, - "Conversion from jobject DiscoveredNodeData to Cpp DiscoveredNodeData failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = CastingServer::GetInstance()->SendUserDirectedCommissioningRequest(&commissioner); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "TVCastingApp-JNI::sendCommissioningRequest failed: %" CHIP_ERROR_FORMAT, err.Format()); - return false; - } - return true; -} - -JNI_METHOD(jboolean, purgeCache)(JNIEnv * env, jobject) -{ - chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD purgeCache called"); - - CHIP_ERROR err = CastingServer::GetInstance()->PurgeCache(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "TVCastingApp-JNI::purgeCache failed: %" CHIP_ERROR_FORMAT, err.Format()); - return false; - } - return true; -} - -JNI_METHOD(jboolean, contentLauncherLaunchURL) -(JNIEnv * env, jobject, jobject contentApp, jstring contentUrl, jstring contentDisplayStr, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD contentLauncherLaunchURL called"); - const char * nativeContentUrl = env->GetStringUTFChars(contentUrl, 0); - const char * nativeContentDisplayStr = env->GetStringUTFChars(contentDisplayStr, 0); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchURL).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI::SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ContentLauncherLaunchURL( - &endpoint, nativeContentUrl, nativeContentDisplayStr, - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchURL).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer::ContentLauncherLaunchURL failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(contentUrl, nativeContentUrl); - env->ReleaseStringUTFChars(contentDisplayStr, nativeContentDisplayStr); - -exit: - return (err == CHIP_NO_ERROR); -} - -CHIP_ERROR CreateParameter(JNIEnv * env, jobject jParameter, - chip::app::Clusters::ContentLauncher::Structs::ParameterStruct::Type & parameter) -{ - jclass jParameterClass = env->GetObjectClass(jParameter); - - jfieldID jTypeField = env->GetFieldID(jParameterClass, "type", "Ljava/lang/Integer;"); - jobject jTypeObj = env->GetObjectField(jParameter, jTypeField); - jclass jIntegerClass = env->FindClass("java/lang/Integer"); - jmethodID jIntValueMid = env->GetMethodID(jIntegerClass, "intValue", "()I"); - parameter.type = static_cast(env->CallIntMethod(jTypeObj, jIntValueMid)); - - jfieldID jValueField = env->GetFieldID(jParameterClass, "value", "Ljava/lang/String;"); - jstring jValueObj = (jstring) env->GetObjectField(jParameter, jValueField); - const char * nativeValue = env->GetStringUTFChars(jValueObj, 0); - parameter.value = CharSpan::fromCharString(nativeValue); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CreateContentSearch(JNIEnv * env, jobject jSearch, - chip::app::Clusters::ContentLauncher::Structs::ContentSearchStruct::Type & search, - ListFreer & listFreer) -{ - jclass jContentSearchClass; - ReturnErrorOnFailure(JniReferences::GetInstance().GetLocalClassRef(env, "com/chip/casting/ContentLauncherTypes$ContentSearch", - jContentSearchClass)); - - jfieldID jParameterListField = env->GetFieldID(jContentSearchClass, "parameterList", "Ljava/util/ArrayList;"); - jobject jParameterList = env->GetObjectField(jSearch, jParameterListField); - ReturnErrorOnFailure(jParameterList != nullptr ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ARGUMENT); - - jclass jArrayListClass = env->FindClass("java/util/ArrayList"); - jmethodID sizeMid = env->GetMethodID(jArrayListClass, "size", "()I"); - size_t parameterListSize = static_cast(env->CallIntMethod(jParameterList, sizeMid)); - - jobject jIterator = env->CallObjectMethod( - jParameterList, env->GetMethodID(env->GetObjectClass(jParameterList), "iterator", "()Ljava/util/Iterator;")); - jmethodID jNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "next", "()Ljava/lang/Object;"); - jmethodID jHasNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "hasNext", "()Z"); - - auto * parameterListHolder = - new ListHolder(parameterListSize); - listFreer.add(parameterListHolder); - int parameterIndex = 0; - while (env->CallBooleanMethod(jIterator, jHasNextMid)) - { - jobject jParameter = env->CallObjectMethod(jIterator, jNextMid); - chip::app::Clusters::ContentLauncher::Structs::ParameterStruct::Type parameter; - ReturnErrorOnFailure(CreateParameter(env, jParameter, parameter)); - parameterListHolder->mList[parameterIndex].type = parameter.type; - parameterListHolder->mList[parameterIndex].value = parameter.value; - parameterListHolder->mList[parameterIndex].externalIDList = parameter.externalIDList; - parameterIndex++; - } - search.parameterList = chip::app::DataModel::List( - parameterListHolder->mList, parameterListSize); - - return CHIP_NO_ERROR; -} - -JNI_METHOD(jboolean, contentLauncher_1launchContent) -(JNIEnv * env, jobject, jobject contentApp, jobject jSearch, jboolean jAutoplay, jstring jData, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD contentLauncher_1launchContent called"); - - // prepare arguments - bool autoplay = static_cast(jAutoplay); - - const char * nativeData = env->GetStringUTFChars(jData, 0); - chip::Optional data = MakeOptional(CharSpan::fromCharString(nativeData)); - - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Structs::ContentSearchStruct::Type search; - CHIP_ERROR err = CreateContentSearch(env, jSearch, search, listFreer); - - TargetEndpointInfo endpoint; - err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, - "contentLauncher_1launchContent::Could not create ContentSearch object %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchContent).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI::SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ContentLauncher_LaunchContent(&endpoint, search, autoplay, data, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchContent).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer::ContentLauncher_LaunchContent failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(jData, nativeData); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, contentLauncher_1subscribeToSupportedStreamingProtocols) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD ContentLauncher_subscribeToSupportedStreamingProtocols called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getSupportedStreamingProtocolsSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionReadFailureHandler(ContentLauncher_SupportedStreamingProtocols) - .SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ContentLauncher_SupportedStreamingProtocols) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ContentLauncher_SubscribeToSupportedStreamingProtocols( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getSupportedStreamingProtocolsSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ContentLauncher_SupportedStreamingProtocols).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ContentLauncher_SupportedStreamingProtocols).Handle(); - }); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, - "CastingServer.ContentLauncher_SubscribeToSupportedStreamingProtocols failed %" CHIP_ERROR_FORMAT, - err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, levelControl_1step) -(JNIEnv * env, jobject, jobject contentApp, jbyte stepMode, jbyte stepSize, jshort transitionTime, jbyte optionMask, - jbyte optionOverride, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD levelControl_step called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(LevelControl_Step).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->LevelControl_Step( - &endpoint, static_cast(stepMode), static_cast(stepSize), - static_cast(transitionTime), static_cast(optionMask), static_cast(optionOverride), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(LevelControl_Step).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.LevelControl_Step failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, levelControl_1moveToLevel) -(JNIEnv * env, jobject, jobject contentApp, jbyte level, jshort transitionTime, jbyte optionMask, jbyte optionOverride, - jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD levelControl_moveToLevel called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(LevelControl_MoveToLevel).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->LevelControl_MoveToLevel( - &endpoint, static_cast(level), static_cast(transitionTime), static_cast(optionMask), - static_cast(optionOverride), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(LevelControl_MoveToLevel).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.LevelControl_MoveToLevel failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, levelControl_1subscribeToCurrentLevel) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToCurrentLevel called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getCurrentLevelSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_CurrentLevel).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(LevelControl_CurrentLevel) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->LevelControl_SubscribeToCurrentLevel( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getCurrentLevelSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_CurrentLevel).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_CurrentLevel).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToCurrentLevel failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, levelControl_1subscribeToMinLevel) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToMinLevel called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMinLevelSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MinLevel).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MinLevel).SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->LevelControl_SubscribeToMinLevel( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getMinLevelSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MinLevel).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MinLevel).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToMinLevel failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, levelControl_1subscribeToMaxLevel) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToMaxLevel called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMaxLevelSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MaxLevel).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MaxLevel).SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->LevelControl_SubscribeToMaxLevel( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getMaxLevelSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MaxLevel).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MaxLevel).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToMaxLevel failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, onOff_1on) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD onOff_on called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_On).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->OnOff_On( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_On).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "CastingServer.OnOff_On failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, onOff_1off) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD onOff_off called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_Off).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->OnOff_Off( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_Off).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "CastingServer.OnOff_Off failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, onOff_1toggle) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD onOff_toggle called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_Toggle).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->OnOff_Toggle( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(OnOff_Toggle).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.OnOff_Toggle failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, messages_1presentMessages) -(JNIEnv * env, jobject, jobject contentApp, jstring messageText, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD messages_presentMessages called"); - const char * nativeMessageText = env->GetStringUTFChars(messageText, 0); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(Messages_PresentMessagesRequest).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->Messages_PresentMessagesRequest(&endpoint, nativeMessageText, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(Messages_PresentMessagesRequest).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.Messages_PresentMessagesRequest failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(messageText, nativeMessageText); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1play) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_play called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Play).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_Play( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Play).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_Play failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1pause) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_pause called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Pause).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_Pause( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Pause).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_Pause failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1stopPlayback) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_stopPlayback called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_StopPlayback).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_StopPlayback(&endpoint, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_StopPlayback).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_StopPlayback failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1next) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_next called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Next).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_Next( - &endpoint, [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Next).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_Next failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1seek) -(JNIEnv * env, jobject, jobject contentApp, jlong position, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_seek called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Seek).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_Seek(&endpoint, static_cast(position), [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Seek).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_Seek failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1skipForward) -(JNIEnv * env, jobject, jobject contentApp, jlong deltaPositionMilliseconds, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_skipForward called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_SkipForward).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SkipForward( - &endpoint, static_cast(deltaPositionMilliseconds), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_SkipForward).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_SkipForward failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1skipBackward) -(JNIEnv * env, jobject, jobject contentApp, jlong deltaPositionMilliseconds, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_skipBackward called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_SkipBackward).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SkipBackward( - &endpoint, static_cast(deltaPositionMilliseconds), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_SkipBackward).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_SkipBackward failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1previous) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - return TvCastingAppJNIMgr().runCastingServerCommand( - env, contentApp, jResponseHandler, "MediaPlayback_Previous", MediaPlayback_Previous, - [](TargetEndpointInfo endpoint) -> CHIP_ERROR { - return CastingServer::GetInstance()->MediaPlayback_Previous(&endpoint, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Previous).Handle(err); - }); - }); -} - -JNI_METHOD(jboolean, mediaPlayback_1rewind) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - return TvCastingAppJNIMgr().runCastingServerCommand( - env, contentApp, jResponseHandler, "MediaPlayback_Rewind", MediaPlayback_Rewind, - [](TargetEndpointInfo endpoint) -> CHIP_ERROR { - return CastingServer::GetInstance()->MediaPlayback_Rewind(&endpoint, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_Rewind).Handle(err); - }); - }); -} - -JNI_METHOD(jboolean, mediaPlayback_1fastForward) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - return TvCastingAppJNIMgr().runCastingServerCommand( - env, contentApp, jResponseHandler, "MediaPlayback_FastForward", MediaPlayback_FastForward, - [](TargetEndpointInfo endpoint) -> CHIP_ERROR { - return CastingServer::GetInstance()->MediaPlayback_FastForward(&endpoint, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_FastForward).Handle(err); - }); - }); -} - -JNI_METHOD(jboolean, mediaPlayback_1startOver) -(JNIEnv * env, jobject, jobject contentApp, jobject jResponseHandler) -{ - return TvCastingAppJNIMgr().runCastingServerCommand( - env, contentApp, jResponseHandler, "MediaPlayback_StartOver", MediaPlayback_StartOver, - [](TargetEndpointInfo endpoint) -> CHIP_ERROR { - return CastingServer::GetInstance()->MediaPlayback_StartOver(&endpoint, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(MediaPlayback_StartOver).Handle(err); - }); - }); -} - -jboolean TvCastingAppJNI::runCastingServerCommand(JNIEnv * env, jobject contentApp, jobject jResponseHandler, - const char * commandName, MediaCommandName command, - const std::function & commandRunner) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD %s called", commandName); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(command).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = commandRunner(endpoint); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.%s failed %" CHIP_ERROR_FORMAT, commandName, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToCurrentState) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_subscribeToCurrentState called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getCurrentStateSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_CurrentState).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(MediaPlayback_CurrentState) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToCurrentState( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getCurrentStateSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_CurrentState).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_CurrentState).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.MediaPlayback_SubscribeToCurrentState failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToDuration) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToDuration called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getDurationSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_Duration).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_Duration).SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToDuration( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getDurationSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_Duration).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_Duration).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToDuration failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToSampledPosition) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSampledPosition called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getSampledPositionSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SampledPosition).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(MediaPlayback_SampledPosition) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSampledPosition( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getSampledPositionSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SampledPosition).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SampledPosition).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSampledPosition failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToPlaybackSpeed) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToPlaybackSpeed called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getPlaybackSpeedSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_PlaybackSpeed).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(MediaPlayback_PlaybackSpeed) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToPlaybackSpeed( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getPlaybackSpeedSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_PlaybackSpeed).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_PlaybackSpeed).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToPlaybackSpeed failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToSeekRangeEnd) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSeekRangeEnd called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getSeekRangeEndSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeEnd).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeEnd) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSeekRangeEnd( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getSeekRangeEndSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeEnd).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeEnd).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSeekRangeEnd failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, mediaPlayback_1subscribeToSeekRangeStart) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSeekRangeStart called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getSeekRangeStartSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeStart).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeStart) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSeekRangeStart( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getSeekRangeStartSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeStart).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeStart).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSeekRangeStart failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationLauncher_1launchApp) -(JNIEnv * env, jobject, jobject contentApp, jshort catalogVendorId, jstring applicationId, jbyteArray data, - jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_launchApp called"); - - chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application; - application.catalogVendorID = static_cast(catalogVendorId); - const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0); - application.applicationID = CharSpan::fromCharString(nativeApplicationId); - JniByteArray dataByteArray(env, data); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_LaunchApp).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationLauncher_LaunchApp( - &endpoint, application, chip::MakeOptional(dataByteArray.byteSpan()), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_LaunchApp).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.ApplicationLauncher_LaunchApp failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(applicationId, nativeApplicationId); -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationLauncher_1stopApp) -(JNIEnv * env, jobject, jobject contentApp, jshort catalogVendorId, jstring applicationId, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_stopApp called"); - - chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application; - application.catalogVendorID = static_cast(catalogVendorId); - const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0); - application.applicationID = CharSpan::fromCharString(nativeApplicationId); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_StopApp).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationLauncher_StopApp(&endpoint, application, [&](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_StopApp).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.ApplicationLauncher_StopApp failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(applicationId, nativeApplicationId); -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationLauncher_1hideApp) -(JNIEnv * env, jobject, jobject contentApp, jshort catalogVendorId, jstring applicationId, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationLauncher_hideApp called"); - - chip::app::Clusters::ApplicationLauncher::Structs::ApplicationStruct::Type application; - application.catalogVendorID = static_cast(catalogVendorId); - const char * nativeApplicationId = env->GetStringUTFChars(applicationId, 0); - application.applicationID = CharSpan::fromCharString(nativeApplicationId); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_HideApp).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationLauncher_HideApp(&endpoint, application, [](CHIP_ERROR err) { - TvCastingAppJNIMgr().getMediaCommandResponseHandler(ApplicationLauncher_HideApp).Handle(err); - }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.ApplicationLauncher_HideApp failed %" CHIP_ERROR_FORMAT, err.Format())); - - env->ReleaseStringUTFChars(applicationId, nativeApplicationId); -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, targetNavigator_1navigateTarget) -(JNIEnv * env, jobject, jobject contentApp, jbyte target, jstring data, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD targetNavigator_navigateTarget called"); - - const char * nativeData = (data != nullptr ? env->GetStringUTFChars(data, 0) : nullptr); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(TargetNavigator_NavigateTarget).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->TargetNavigator_NavigateTarget( - &endpoint, static_cast(target), - (nativeData != nullptr ? chip::MakeOptional(CharSpan::fromCharString(nativeData)) : chip::NullOptional), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(TargetNavigator_NavigateTarget).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.TargetNavigator_NavigateTarget failed %" CHIP_ERROR_FORMAT, err.Format())); - - if (nativeData != nullptr) - { - env->ReleaseStringUTFChars(data, nativeData); - } -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, targetNavigator_1subscribeToCurrentTarget) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD targetNavigator_1subscribeToCurrentTarget called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getCurrentTargetSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_CurrentTarget).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(TargetNavigator_CurrentTarget) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->TargetNavigator_SubscribeToCurrentTarget( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getCurrentTargetSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_CurrentTarget).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(TargetNavigator_CurrentTarget).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.targetNavigator_subscribeToCurrentTarget failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, targetNavigator_1subscribeToTargetList) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD targetNavigator_1subscribeToTargetList called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getTargetListSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_TargetList).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(TargetNavigator_TargetList) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->TargetNavigator_SubscribeToTargetList( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getTargetListSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_TargetList).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(TargetNavigator_TargetList).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.targetNavigator_subscribeToTargetList failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, keypadInput_1sendKey) -(JNIEnv * env, jobject, jobject contentApp, jbyte keyCode, jobject jResponseHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD keypadInput_sendKey called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(KeypadInput_SendKey).SetUp(env, jResponseHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->KeypadInput_SendKey( - &endpoint, static_cast(keyCode), - [](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(KeypadInput_SendKey).Handle(err); }); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.KeypadInput_SendKey failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -// APPLICATION BASIC -JNI_METHOD(jboolean, applicationBasic_1subscribeToVendorName) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToVendorName called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getVendorNameSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorName).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ApplicationBasic_VendorName) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToVendorName( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getVendorNameSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorName).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_VendorName).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToVendorName failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1subscribeToVendorID) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToVendorID called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getVendorIDSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorID).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ApplicationBasic_VendorID) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToVendorID( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getVendorIDSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorID).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_VendorID).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToVendorID failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1subscribeToApplicationName) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToApplicationName called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getApplicationNameSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationName).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationName) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToApplicationName( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getApplicationNameSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationName).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationName).Handle(); - }); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToApplicationName failed %" CHIP_ERROR_FORMAT, - err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1subscribeToProductID) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToProductID called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getProductIDSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ProductID).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ApplicationBasic_ProductID) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToProductID( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getProductIDSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ProductID).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ProductID).Handle(); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToProductID failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1subscribeToApplicationVersion) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, - jint maxInterval, jobject jSubscriptionEstablishedHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToApplicationVersion called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getApplicationVersionSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationVersion).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr() - .getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationVersion) - .SetUp(env, jSubscriptionEstablishedHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToApplicationVersion( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getApplicationVersionSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationVersion).Handle(err); - }, - static_cast(minInterval), static_cast(maxInterval), - [](void * context, chip::SubscriptionId) { - TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationVersion).Handle(); - }); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToApplicationVersion failed %" CHIP_ERROR_FORMAT, - err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1readVendorName) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1readVendorName called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getReadVendorNameSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_VendorName).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "ReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_ReadVendorName( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getReadVendorNameSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_VendorName).Handle(err); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_1readVendorName failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1readVendorID) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1readVendorID called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getReadVendorIDSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_VendorID).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "ReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_ReadVendorID( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getReadVendorIDSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_VendorID).Handle(err); }); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_ReadVendorID failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1readApplicationName) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1readApplicationName called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getReadApplicationNameSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ApplicationName).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "ReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_ReadApplicationName( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getReadApplicationNameSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ApplicationName).Handle(err); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_ReadApplicationName failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1readProductID) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1readProductID called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getReadProductIDSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ProductID).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "ReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_ReadProductID( - &endpoint, nullptr, - [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getReadProductIDSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ProductID).Handle(err); }); - - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_ReadProductID failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} - -JNI_METHOD(jboolean, applicationBasic_1readApplicationVersion) -(JNIEnv * env, jobject, jobject contentApp, jobject jReadSuccessHandler, jobject jReadFailureHandler) -{ - chip::DeviceLayer::StackLock lock; - - ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1readApplicationVersion called"); - - TargetEndpointInfo endpoint; - CHIP_ERROR err = convertJContentAppToTargetEndpointInfo(contentApp, endpoint); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(AppServer, "Conversion from jobject contentApp to TargetEndpointInfo * failed: %" CHIP_ERROR_FORMAT, - err.Format())); - - err = TvCastingAppJNIMgr().getReadApplicationVersionSuccessHandler().SetUp(env, jReadSuccessHandler); - VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ApplicationVersion).SetUp(env, jReadFailureHandler); - VerifyOrExit(CHIP_NO_ERROR == err, - ChipLogError(AppServer, "ReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); - - err = CastingServer::GetInstance()->ApplicationBasic_ReadApplicationVersion( - &endpoint, nullptr, - [](void * context, - chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData) { - TvCastingAppJNIMgr().getReadApplicationVersionSuccessHandler().Handle(responseData); - }, - [](void * context, CHIP_ERROR err) { - TvCastingAppJNIMgr().getReadFailureHandler(ApplicationBasic_ApplicationVersion).Handle(err); - }); - - VerifyOrExit( - CHIP_NO_ERROR == err, - ChipLogError(AppServer, "CastingServer.applicationBasic_ReadApplicationVersion failed %" CHIP_ERROR_FORMAT, err.Format())); - -exit: - return (err == CHIP_NO_ERROR); -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h deleted file mode 100644 index 863e2691c44a52..00000000000000 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include - -#include "Constants.h" -#include "MatterCallbackHandler-JNI.h" - -class TvCastingAppJNI -{ -public: - MatterCallbackHandlerJNI & getCommissioningCompleteHandler() { return mCommissioningCompleteHandler; } - - SessionEstablishmentStartedHandlerJNI & getSessionEstablishmentStartedHandler() { return mSessionEstablishmentStartedHandler; } - - SessionEstablishedHandlerJNI & getSessionEstablishedHandler() { return mSessionEstablishedHandler; } - - FailureHandlerJNI & getSessionEstablishmentErrorHandler() { return mSessionEstablishmentErrorHandler; } - - FailureHandlerJNI & getSessionEstablishmentStoppedHandler() { return mSessionEstablishmentStoppedHandler; } - - OnConnectionSuccessHandlerJNI & getOnConnectionSuccessHandler(bool preCommissioned) - { - return preCommissioned ? mPreCommissionedOnConnectionSuccessHandler : mCommissioningOnConnectionSuccessHandler; - } - - FailureHandlerJNI & getOnConnectionFailureHandler(bool preCommissioned) - { - return preCommissioned ? mPreCommissionedOnConnectionFailureHandler : mCommissioningOnConnectionFailureHandler; - } - OnNewOrUpdatedEndpointHandlerJNI & getOnNewOrUpdatedEndpointHandler(bool preCommissioned) - { - return preCommissioned ? mPreCommissionedOnNewOrUpdatedEndpointHandler : mCommissioningOnNewOrUpdatedEndpointHandler; - } - - MatterCallbackHandlerJNI & getMediaCommandResponseHandler(enum MediaCommandName name) - { - return mMediaCommandResponseHandler[name]; - } - - FailureHandlerJNI & getReadFailureHandler(enum MediaAttributeName name) { return mReadFailureHandler[name]; } - - FailureHandlerJNI & getSubscriptionReadFailureHandler(enum MediaAttributeName name) - { - return mSubscriptionReadFailureHandler[name]; - } - - SubscriptionEstablishedHandlerJNI & getSubscriptionEstablishedHandler(enum MediaAttributeName name) - { - return mSubscriptionEstablishedHandler[name]; - } - - CurrentStateSuccessHandlerJNI & getCurrentStateSuccessHandler() { return mCurrentStateSuccessHandlerJNI; } - DurationSuccessHandlerJNI & getDurationSuccessHandler() { return mDurationSuccessHandlerJNI; } - SampledPositionSuccessHandlerJNI & getSampledPositionSuccessHandler() { return mSampledPositionSuccessHandlerJNI; } - PlaybackSpeedSuccessHandlerJNI & getPlaybackSpeedSuccessHandler() { return mPlaybackSpeedSuccessHandlerJNI; } - SeekRangeEndSuccessHandlerJNI & getSeekRangeEndSuccessHandler() { return mSeekRangeEndSuccessHandlerJNI; } - SeekRangeStartSuccessHandlerJNI & getSeekRangeStartSuccessHandler() { return mSeekRangeStartSuccessHandlerJNI; } - - CurrentTargetSuccessHandlerJNI & getCurrentTargetSuccessHandler() { return mCurrentTargetSuccessHandlerJNI; } - TargetListSuccessHandlerJNI & getTargetListSuccessHandler() { return mTargetListSuccessHandlerJNI; } - - CurrentLevelSuccessHandlerJNI & getCurrentLevelSuccessHandler() { return mCurrentLevelSuccessHandlerJNI; } - MinLevelSuccessHandlerJNI & getMinLevelSuccessHandler() { return mMinLevelSuccessHandlerJNI; } - MaxLevelSuccessHandlerJNI & getMaxLevelSuccessHandler() { return mMaxLevelSuccessHandlerJNI; } - - SupportedStreamingProtocolsSuccessHandlerJNI & getSupportedStreamingProtocolsSuccessHandler() - { - return mSupportedStreamingProtocolsSuccessHandlerJNI; - } - - VendorNameSuccessHandlerJNI & getVendorNameSuccessHandler() { return mVendorNameSuccessHandlerJNI; } - VendorIDSuccessHandlerJNI & getVendorIDSuccessHandler() { return mVendorIDSuccessHandlerJNI; } - ApplicationNameSuccessHandlerJNI & getApplicationNameSuccessHandler() { return mApplicationNameSuccessHandlerJNI; } - ProductIDSuccessHandlerJNI & getProductIDSuccessHandler() { return mProductIDSuccessHandlerJNI; } - ApplicationVersionSuccessHandlerJNI & getApplicationVersionSuccessHandler() { return mApplicationVersionSuccessHandlerJNI; } - - VendorNameSuccessHandlerJNI & getReadVendorNameSuccessHandler() { return mReadVendorNameSuccessHandlerJNI; } - VendorIDSuccessHandlerJNI & getReadVendorIDSuccessHandler() { return mReadVendorIDSuccessHandlerJNI; } - ApplicationNameSuccessHandlerJNI & getReadApplicationNameSuccessHandler() { return mReadApplicationNameSuccessHandlerJNI; } - ProductIDSuccessHandlerJNI & getReadProductIDSuccessHandler() { return mReadProductIDSuccessHandlerJNI; } - ApplicationVersionSuccessHandlerJNI & getReadApplicationVersionSuccessHandler() - { - return mReadApplicationVersionSuccessHandlerJNI; - } - - jboolean runCastingServerCommand(JNIEnv * env, jobject contentApp, jobject jResponseHandler, const char * commandName, - MediaCommandName command, const std::function & commandRunner); - -private: - friend TvCastingAppJNI & TvCastingAppJNIMgr(); - - static TvCastingAppJNI sInstance; - - MatterCallbackHandlerJNI mCommissioningCompleteHandler; - SessionEstablishmentStartedHandlerJNI mSessionEstablishmentStartedHandler; - SessionEstablishedHandlerJNI mSessionEstablishedHandler; - FailureHandlerJNI mSessionEstablishmentErrorHandler; - FailureHandlerJNI mSessionEstablishmentStoppedHandler; - OnConnectionSuccessHandlerJNI mCommissioningOnConnectionSuccessHandler; - FailureHandlerJNI mCommissioningOnConnectionFailureHandler; - OnNewOrUpdatedEndpointHandlerJNI mCommissioningOnNewOrUpdatedEndpointHandler; - - OnConnectionSuccessHandlerJNI mPreCommissionedOnConnectionSuccessHandler; - FailureHandlerJNI mPreCommissionedOnConnectionFailureHandler; - OnNewOrUpdatedEndpointHandlerJNI mPreCommissionedOnNewOrUpdatedEndpointHandler; - - MatterCallbackHandlerJNI mMediaCommandResponseHandler[MEDIA_COMMAND_COUNT]; - FailureHandlerJNI mSubscriptionReadFailureHandler[MEDIA_ATTRIBUTE_COUNT]; - SubscriptionEstablishedHandlerJNI mSubscriptionEstablishedHandler[MEDIA_ATTRIBUTE_COUNT]; - FailureHandlerJNI mReadFailureHandler[MEDIA_ATTRIBUTE_COUNT]; - - CurrentStateSuccessHandlerJNI mCurrentStateSuccessHandlerJNI; - DurationSuccessHandlerJNI mDurationSuccessHandlerJNI; - SampledPositionSuccessHandlerJNI mSampledPositionSuccessHandlerJNI; - PlaybackSpeedSuccessHandlerJNI mPlaybackSpeedSuccessHandlerJNI; - SeekRangeEndSuccessHandlerJNI mSeekRangeEndSuccessHandlerJNI; - SeekRangeStartSuccessHandlerJNI mSeekRangeStartSuccessHandlerJNI; - - CurrentTargetSuccessHandlerJNI mCurrentTargetSuccessHandlerJNI; - TargetListSuccessHandlerJNI mTargetListSuccessHandlerJNI; - - CurrentLevelSuccessHandlerJNI mCurrentLevelSuccessHandlerJNI; - MinLevelSuccessHandlerJNI mMinLevelSuccessHandlerJNI; - MaxLevelSuccessHandlerJNI mMaxLevelSuccessHandlerJNI; - - SupportedStreamingProtocolsSuccessHandlerJNI mSupportedStreamingProtocolsSuccessHandlerJNI; - - VendorNameSuccessHandlerJNI mVendorNameSuccessHandlerJNI; - VendorIDSuccessHandlerJNI mVendorIDSuccessHandlerJNI; - ApplicationNameSuccessHandlerJNI mApplicationNameSuccessHandlerJNI; - ProductIDSuccessHandlerJNI mProductIDSuccessHandlerJNI; - ApplicationVersionSuccessHandlerJNI mApplicationVersionSuccessHandlerJNI; - - VendorNameSuccessHandlerJNI mReadVendorNameSuccessHandlerJNI; - VendorIDSuccessHandlerJNI mReadVendorIDSuccessHandlerJNI; - ApplicationNameSuccessHandlerJNI mReadApplicationNameSuccessHandlerJNI; - ProductIDSuccessHandlerJNI mReadProductIDSuccessHandlerJNI; - ApplicationVersionSuccessHandlerJNI mReadApplicationVersionSuccessHandlerJNI; -}; - -inline class TvCastingAppJNI & TvCastingAppJNIMgr() -{ - return TvCastingAppJNI::sInstance; -} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp index ce8e8c0e1b77a6..2242619df27431 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp @@ -18,8 +18,8 @@ #include "CastingApp-JNI.h" -#include "../JNIDACProvider.h" #include "../support/Converters-JNI.h" +#include "../support/JNIDACProvider.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" // from tv-casting-common @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,16 @@ using namespace chip; #define JNI_METHOD(RETURN, METHOD_NAME) extern "C" JNIEXPORT RETURN JNICALL Java_com_matter_casting_core_CastingApp_##METHOD_NAME +jint JNI_OnLoad(JavaVM * jvm, void * reserved) +{ + return AndroidAppServerJNI_OnLoad(jvm, reserved); +} + +void JNI_OnUnload(JavaVM * jvm, void * reserved) +{ + return AndroidAppServerJNI_OnUnload(jvm, reserved); +} + namespace matter { namespace casting { namespace core { @@ -73,7 +84,7 @@ JNI_METHOD(jobject, finishInitialization)(JNIEnv *, jobject, jobject jAppParamet VerifyOrReturnValue(jDACProvider != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INCORRECT_STATE)); // set the DACProvider - JNIDACProvider * dacProvider = new JNIDACProvider(jDACProvider); + support::JNIDACProvider * dacProvider = new support::JNIDACProvider(jDACProvider); chip::Credentials::SetDeviceAttestationCredentialsProvider(dacProvider); return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingPlayerDiscovery-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingPlayerDiscovery-JNI.cpp index 26526dfdac8f07..0dd0a351b7a679 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingPlayerDiscovery-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingPlayerDiscovery-JNI.cpp @@ -18,7 +18,6 @@ #include "CastingPlayerDiscovery-JNI.h" -#include "../JNIDACProvider.h" #include "../support/Converters-JNI.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" #include "core/CastingApp.h" // from tv-casting-common diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp index b718682a17124b..5219dbca3a88af 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp @@ -18,7 +18,6 @@ #include "MatterCastingPlayer-JNI.h" -#include "../JNIDACProvider.h" #include "../support/Converters-JNI.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" #include "core/CastingApp.h" // from tv-casting-common diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterEndpoint-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterEndpoint-JNI.cpp index e0c41ebc92d260..685be549856981 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterEndpoint-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterEndpoint-JNI.cpp @@ -18,7 +18,6 @@ #include "MatterEndpoint-JNI.h" -#include "../JNIDACProvider.h" #include "../support/MatterCallback-JNI.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" #include "clusters/Clusters.h" // from tv-casting-common diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.cpp similarity index 98% rename from examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.cpp rename to examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.cpp index 363a629db2c9e5..1fbbfd1402dda8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.cpp @@ -29,6 +29,10 @@ using namespace chip; +namespace matter { +namespace casting { +namespace support { + JNIDACProvider::JNIDACProvider(jobject provider) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -174,3 +178,7 @@ CHIP_ERROR JNIDACProvider::SignWithDeviceAttestationKey(const ByteSpan & message return chip::Crypto::EcdsaAsn1SignatureToRaw(32, ByteSpan(asn1_signature_buffer.data(), asn1_signature_buffer.size()), out_signature_buffer); } + +}; // namespace support +}; // namespace casting +}; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.h similarity index 94% rename from examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.h rename to examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.h index d8d774f41f3061..bb7902f600848c 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/JNIDACProvider.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/JNIDACProvider.h @@ -21,6 +21,10 @@ #include #include +namespace matter { +namespace casting { +namespace support { + class JNIDACProvider : public chip::Credentials::DeviceAttestationCredentialsProvider { public: @@ -42,3 +46,7 @@ class JNIDACProvider : public chip::Credentials::DeviceAttestationCredentialsPro jmethodID mGetProductAttestationIntermediateCertMethod = nullptr; jmethodID mSignWithDeviceAttestationKeyMethod = nullptr; }; + +}; // namespace support +}; // namespace casting +}; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/res/layout/activity_main.xml b/examples/tv-casting-app/android/App/app/src/main/res/layout/activity_main.xml index ff56873cb23c22..8e3724ec39dd48 100644 --- a/examples/tv-casting-app/android/App/app/src/main/res/layout/activity_main.xml +++ b/examples/tv-casting-app/android/App/app/src/main/res/layout/activity_main.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".chip.casting.app.MainActivity"> + tools:context=".matter.casting.MainActivity"> ShutdownAllSubscriptions(); return CHIP_NO_ERROR; From 4aac314416bc579e1d3aa89128fed7ccbe96974f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 22 Aug 2024 00:16:07 -0400 Subject: [PATCH 21/53] Remove subscription establishment bits from the MTRDevice base class. (#35139) _setupSubscriptionWithReason was only called from _reattemptSubscriptionNowIfNeededWithReason. _reattemptSubscriptionNowIfNeededWithReason was only called from: * _handleUnsolicitedMessageFromPublisher, which is only called in callbacks set up by _setupSubscriptionWithReason. * _triggerResubscribeWithReason, which only calls it when _reattemptingSubscription is YES. But that's only set to YES in _doHandleSubscriptionReset, see next item. * _doHandleSubscriptionReset, called from: * _handleSubscriptionReset: only called from callbacks set up by _setupSubscriptionWithReason. * _resetSubscriptionWithReasonString: called from unitTestResetSubscription and us detecting persisted data corruption in _clusterDataForPath. But we don't actually have persisted data in the MTRDevice base class anymore, so that's not reachable. So _setupSubscriptionWithReason is not reachable and can be removed. And unitTestResetSubscription can be made a no-op on the base MTRDevice. And we can remove the _resetSubscriptionWithReasonString call in _clusterDataForPath. Once those are done, the following become unreachable: * _handleSubscriptionReset * _handleSubscriptionError * Writing a nonzero value to _unitTestAttributesReportedSinceLastCheck * _markDeviceAsUnreachableIfNeverSubscribed * _handleResubscriptionNeededWithDelay * _handleSubscriptionEstablished * _handleUnsolicitedMessageFromPublisher * _createDataVersionFilterListFromDictionary * _setupConnectivityMonitoring * _resetSubscriptionWithReasonString Once those have been removed, the following become unreachable: * HadSubscriptionEstablishedOnce * _stopConnectivityMonitoring * _doHandleSubscriptionError * _doHandleSubscriptionReset Once those have been removed, the following become unreachable: * _setLastSubscriptionAttemptWait * Setting _lastSubscriptionFailureTime to non-nil * _clearSubscriptionPoolWork * _scheduleSubscriptionPoolWork * Use of _initialSubscribeStart * _storePersistedDeviceData * Use of _connectivityMonitor * Use of _lastSubscriptionFailureTimeForDescription * Any code depending on reattemptingSubscription being YES. * Use of _lastSubscriptionAttemptWait * Use of _lastSubscriptionAttemptWaitForDescription Once those have been removed, _reattemptSubscriptionNowIfNeededWithReason is unreachable and can be removed. At this point _currentReadClient and _currentSubscriptionCallback are always nil, so all code conditioned on those can be removed. Once that's done, _triggerResubscribeWithReason is a no-op, so it and all calls to it can be removed. Since _lastSubscriptionFailureTime is always nil, all code guarded on it not being nil can be removed, so _readThroughSkipped becomes a no-op and _lastSubscriptionFailureTime can be removed. At this point, the following are not reachable: * NeedToStartSubscriptionSetup * _changeInternalState Once those are removed, _internalDeviceStateForDescription is unused, and _internalDeviceState is always MTRInternalDeviceStateUnsubscribed. So HaveSubscriptionEstablishedRightNow() always returns NO and can be removed. At this point SubscriptionCallback is unused and can also be removed. --- src/darwin/Framework/CHIP/MTRDevice.mm | 1044 +----------------------- 1 file changed, 4 insertions(+), 1040 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index f17e6d5c90f6eb..d4027f7725ddeb 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -22,7 +22,6 @@ #import "MTRAttributeSpecifiedCheck.h" #import "MTRBaseClusters.h" #import "MTRBaseDevice_Internal.h" -#import "MTRBaseSubscriptionCallback.h" #import "MTRCluster.h" #import "MTRClusterConstants.h" #import "MTRCommandTimedCheck.h" @@ -43,16 +42,8 @@ #import "zap-generated/MTRCommandPayloads_Internal.h" #import "lib/core/CHIPError.h" -#import "lib/core/DataModelTypes.h" -#import -#import - -#import -#import -#import -#import + #import -#import typedef void (^MTRDeviceAttributeReportHandler)(NSArray * _Nonnull); @@ -113,68 +104,13 @@ - (void)_deviceInternalStateChanged:(MTRDevice *)device; /* END DRAGONS */ -#pragma mark - SubscriptionCallback class declaration using namespace chip; using namespace chip::app; using namespace chip::Protocols::InteractionModel; using namespace chip::Tracing::DarwinFramework; -typedef void (^FirstReportHandler)(void); - -namespace { - -class SubscriptionCallback final : public MTRBaseSubscriptionCallback { -public: - SubscriptionCallback(DataReportCallback attributeReportCallback, DataReportCallback eventReportCallback, - ErrorCallback errorCallback, MTRDeviceResubscriptionScheduledHandler resubscriptionCallback, - SubscriptionEstablishedHandler subscriptionEstablishedHandler, OnDoneHandler onDoneHandler, - UnsolicitedMessageFromPublisherHandler unsolicitedMessageFromPublisherHandler, ReportBeginHandler reportBeginHandler, - ReportEndHandler reportEndHandler) - : MTRBaseSubscriptionCallback(attributeReportCallback, eventReportCallback, errorCallback, resubscriptionCallback, - subscriptionEstablishedHandler, onDoneHandler, unsolicitedMessageFromPublisherHandler, reportBeginHandler, - reportEndHandler) - { - } - - // Used to reset Resubscription backoff on events that indicate likely availability of device to come back online - void ResetResubscriptionBackoff() { mResubscriptionNumRetries = 0; } - -private: - void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override; - - void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override; - - CHIP_ERROR OnResubscriptionNeeded(chip::app::ReadClient * apReadClient, CHIP_ERROR aTerminationCause) override; - - // Copied from ReadClient and customized for MTRDevice resubscription time reset - uint32_t ComputeTimeTillNextSubscription(); - uint32_t mResubscriptionNumRetries = 0; -}; - -} // anonymous namespace - #pragma mark - MTRDevice -// Utility methods for working with MTRInternalDeviceState, located near the -// enum so it's easier to notice that they need to stay in sync. -namespace { -bool HadSubscriptionEstablishedOnce(MTRInternalDeviceState state) -{ - return state >= MTRInternalDeviceStateInitialSubscriptionEstablished; -} - -bool NeedToStartSubscriptionSetup(MTRInternalDeviceState state) -{ - return state <= MTRInternalDeviceStateUnsubscribed; -} - -bool HaveSubscriptionEstablishedRightNow(MTRInternalDeviceState state) -{ - return state == MTRInternalDeviceStateInitialSubscriptionEstablished || state == MTRInternalDeviceStateLaterSubscriptionEstablished; -} - -} // anonymous namespace - typedef NS_ENUM(NSUInteger, MTRDeviceExpectedValueFieldIndex) { MTRDeviceExpectedValueFieldExpirationTimeIndex = 0, MTRDeviceExpectedValueFieldValueIndex = 1, @@ -338,13 +274,6 @@ @interface MTRDevice () #define MTRDEVICE_SUBSCRIPTION_ATTEMPT_MAX_WAIT_SECONDS (3600) @property (nonatomic) uint32_t lastSubscriptionAttemptWait; -/** - * If reattemptingSubscription is true, that means that we have failed to get a - * CASE session for the publisher and are now waiting to try again. In this - * state we never have subscriptionActive true or a non-null currentReadClient. - */ -@property (nonatomic) BOOL reattemptingSubscription; - // Expected value cache is attributePath => NSArray of [NSDate of expiration time, NSDictionary of value, expected value ID] // - See MTRDeviceExpectedValueFieldIndex for the definitions of indices into this array. // See MTRDeviceResponseHandler definition for value dictionary details. @@ -362,14 +291,6 @@ @interface MTRDevice () @property (nonatomic) NSMutableDictionary * temporaryMetaDataCache; -/** - * If currentReadClient is non-null, that means that we successfully - * called SendAutoResubscribeRequest on the ReadClient and have not yet gotten - * an OnDone for that ReadClient. - */ -@property (nonatomic) ReadClient * currentReadClient; -@property (nonatomic) SubscriptionCallback * currentSubscriptionCallback; // valid when and only when currentReadClient is valid - @end // Declaring selector so compiler won't complain about testing and calling it in _handleReportEnd @@ -389,10 +310,6 @@ - (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device; #endif @implementation MTRDevice { -#ifdef DEBUG - NSUInteger _unitTestAttributesReportedSinceLastCheck; -#endif - // _deviceCachePrimed is true if we have the data that comes from an initial // subscription priming report (whether it came from storage or from our // subscription). @@ -410,26 +327,10 @@ @implementation MTRDevice { // right now (because they have been evicted). NSMutableSet * _persistedClusters; - // When we last failed to subscribe to the device (either via - // _setupSubscriptionWithReason or via the auto-resubscribe behavior - // of the ReadClient). Nil if we have had no such failures. - NSDate * _Nullable _lastSubscriptionFailureTime; - MTRDeviceConnectivityMonitor * _connectivityMonitor; - // This boolean keeps track of any device configuration changes received in an attribute report. // If this is true when the report ends, we notify the delegate. BOOL _deviceConfigurationChanged; - // The completion block is set when the subscription / resubscription work is enqueued, and called / cleared when any of the following happen: - // 1. Subscription establishes - // 2. OnResubscriptionNeeded is called - // 3. Subscription reset (including when getSessionForNode fails) - MTRAsyncWorkCompletionBlock _subscriptionPoolWorkCompletionBlock; - - // Tracking of initial subscribe latency. When _initialSubscribeStart is - // nil, we are not tracking the latency. - NSDate * _Nullable _initialSubscribeStart; - // Storage behavior configuration and variables to keep track of the logic // _clusterDataPersistenceFirstScheduledTime is used to track the start time of the delay between // report and persistence. @@ -459,14 +360,8 @@ @implementation MTRDevice { // _allNetworkFeatures is a bitwise or of the feature maps of all network commissioning clusters // present on the device, or nil if there aren't any. NSNumber * _Nullable _allNetworkFeatures; - // Copy of _internalDeviceState that is safe to use in description. - MTRInternalDeviceState _internalDeviceStateForDescription; - // Copy of _lastSubscriptionAttemptWait that is safe to use in description. - uint32_t _lastSubscriptionAttemptWaitForDescription; // Most recent entry in _mostRecentReportTimes, if any. NSDate * _Nullable _mostRecentReportTimeForDescription; - // Copy of _lastSubscriptionFailureTime that is safe to use in description. - NSDate * _Nullable _lastSubscriptionFailureTimeForDescription; } - (instancetype)initForSubclassesWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller @@ -496,7 +391,6 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle _asyncWorkQueue = [[MTRAsyncWorkQueue alloc] initWithContext:self]; _state = MTRDeviceStateUnknown; _internalDeviceState = MTRInternalDeviceStateUnsubscribed; - _internalDeviceStateForDescription = MTRInternalDeviceStateUnsubscribed; if (controller.controllerDataStore) { _persistedClusterData = [[NSCache alloc] init]; } else { @@ -861,51 +755,6 @@ - (void)nodeMayBeAdvertisingOperational assertChipStackLockedByCurrentThread(); MTR_LOG("%@ saw new operational advertisement", self); - - [self _triggerResubscribeWithReason:@"operational advertisement seen" - nodeLikelyReachable:YES]; -} - -// Trigger a resubscribe as needed. nodeLikelyReachable should be YES if we -// have reason to suspect the node is now reachable, NO if we have no idea -// whether it might be. -- (void)_triggerResubscribeWithReason:(NSString *)reason nodeLikelyReachable:(BOOL)nodeLikelyReachable -{ - MTR_LOG("%@ _triggerResubscribeWithReason called with reason %@", self, reason); - assertChipStackLockedByCurrentThread(); - - // We might want to trigger a resubscribe on our existing ReadClient. Do - // that outside the scope of our lock, so we're not calling arbitrary code - // we don't control with the lock held. This is safe, because we are - // running on he Matter queue and the ReadClient can't get destroyed while - // we are on that queue. - ReadClient * readClientToResubscribe = nullptr; - SubscriptionCallback * subscriptionCallback = nullptr; - - os_unfair_lock_lock(&self->_lock); - - // Don't change state to MTRDeviceStateReachable, since the device might not - // in fact be reachable yet; we won't know until we have managed to - // establish a CASE session. And at that point, our subscription will - // trigger the state change as needed. - if (self.reattemptingSubscription) { - [self _reattemptSubscriptionNowIfNeededWithReason:reason]; - } else { - readClientToResubscribe = self->_currentReadClient; - subscriptionCallback = self->_currentSubscriptionCallback; - } - os_unfair_lock_unlock(&self->_lock); - - if (readClientToResubscribe) { - if (nodeLikelyReachable) { - // If we have reason to suspect the node is now reachable, reset the - // backoff timer, so that if this attempt fails we'll try again - // quickly; it's possible we'll just catch the node at a bad time - // here (e.g. still booting up), but should try again reasonably quickly. - subscriptionCallback->ResetResubscriptionBackoff(); - } - readClientToResubscribe->TriggerResubscribeIfScheduled(reason.UTF8String); - } } // Return YES if we are in a state where, apart from communication issues with @@ -941,41 +790,6 @@ - (BOOL)_subscriptionAbleToReport // Notification that read-through was skipped for an attribute read. - (void)_readThroughSkipped { - std::lock_guard lock(_lock); - if (_state == MTRDeviceStateReachable) { - // We're getting reports from the device, so there's nothing else to be - // done here. We could skip this check, because our "try to - // resubscribe" code would be a no-op in this case, but then we'd have - // an extra dispatch in the common case of read-while-subscribed, which - // is not great for peformance. - return; - } - - if (_lastSubscriptionFailureTime == nil) { - // No need to try to do anything here, because we have never failed a - // subscription attempt (so we might be in the middle of one now, and no - // need to prod things along). - return; - } - - if ([[NSDate now] timeIntervalSinceDate:_lastSubscriptionFailureTime] < MTRDEVICE_MIN_RESUBSCRIBE_DUE_TO_READ_INTERVAL_SECONDS) { - // Not enough time has passed since we last tried. Don't create extra - // network traffic. - // - // TODO: Do we need to worry about this being too spammy in the log if - // we keep getting reads while not subscribed? We could add another - // backoff timer or counter for the log line... - MTR_LOG_DEBUG("%@ skipping resubscribe from skipped read-through: not enough time has passed since %@", self, _lastSubscriptionFailureTime); - return; - } - - // Do the remaining work on the Matter queue, because we may want to touch - // ReadClient in there. If the dispatch fails, that's fine; it means our - // controller has shut down, so nothing to be done. - [_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:@"read-through skipped while not subscribed" nodeLikelyReachable:NO]; - } - errorHandler:nil]; } - (BOOL)_delegateExists @@ -1090,29 +904,6 @@ - (void)_changeState:(MTRDeviceState)state } } -- (void)_changeInternalState:(MTRInternalDeviceState)state -{ - os_unfair_lock_assert_owner(&self->_lock); - MTRInternalDeviceState lastState = _internalDeviceState; - _internalDeviceState = state; - { - std::lock_guard lock(_descriptionLock); - _internalDeviceStateForDescription = _internalDeviceState; - } - if (lastState != state) { - MTR_LOG("%@ internal state change %lu => %lu", self, static_cast(lastState), static_cast(state)); - - /* BEGIN DRAGONS: This is a huge hack for a specific use case, do not rename, remove or modify behavior here */ - // TODO: This should only be called for thread devices - [self _callDelegatesWithBlock:^(id delegate) { - if ([delegate respondsToSelector:@selector(_deviceInternalStateChanged:)]) { - [delegate _deviceInternalStateChanged:self]; - } - }]; - /* END DRAGONS */ - } -} - #ifdef DEBUG - (MTRInternalDeviceState)_getInternalState { @@ -1121,71 +912,6 @@ - (MTRInternalDeviceState)_getInternalState } #endif -// First Time Sync happens 2 minutes after reachability (this can be changed in the future) -#define MTR_DEVICE_TIME_UPDATE_INITIAL_WAIT_TIME_SEC (60 * 2) -- (void)_handleSubscriptionEstablished -{ - os_unfair_lock_lock(&self->_lock); - - // If subscription had reset since this handler was scheduled, do not execute "established" logic below - if (!HaveSubscriptionEstablishedRightNow(_internalDeviceState)) { - MTR_LOG("%@ _handleSubscriptionEstablished run with internal state %lu - skipping subscription establishment logic", self, static_cast(_internalDeviceState)); - return; - } - - // We have completed the subscription work - remove from the subscription pool. - [self _clearSubscriptionPoolWork]; - - // No need to monitor connectivity after subscription establishment - [self _stopConnectivityMonitoring]; - - // reset subscription attempt wait time when subscription succeeds - [self _setLastSubscriptionAttemptWait:0]; - - auto initialSubscribeStart = _initialSubscribeStart; - // We no longer need to track subscribe latency for this device. - _initialSubscribeStart = nil; - - if (initialSubscribeStart != nil) { - // We want time interval from initialSubscribeStart to now, not the other - // way around. - NSTimeInterval subscriptionLatency = -[initialSubscribeStart timeIntervalSinceNow]; - if (_estimatedSubscriptionLatency == nil) { - _estimatedSubscriptionLatency = @(subscriptionLatency); - } else { - NSTimeInterval newSubscriptionLatencyEstimate = MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT * subscriptionLatency + (1 - MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT) * _estimatedSubscriptionLatency.doubleValue; - _estimatedSubscriptionLatency = @(newSubscriptionLatencyEstimate); - } - [self _storePersistedDeviceData]; - } - - os_unfair_lock_unlock(&self->_lock); - - os_unfair_lock_lock(&self->_timeSyncLock); - - if (!self.timeUpdateScheduled) { - [self _scheduleNextUpdate:MTR_DEVICE_TIME_UPDATE_INITIAL_WAIT_TIME_SEC]; - } - - os_unfair_lock_unlock(&self->_timeSyncLock); -} - -- (void)_handleSubscriptionError:(NSError *)error -{ - std::lock_guard lock(_lock); - [self _doHandleSubscriptionError:error]; -} - -- (void)_doHandleSubscriptionError:(NSError *)error -{ - os_unfair_lock_assert_owner(&_lock); - - [self _changeInternalState:MTRInternalDeviceStateUnsubscribed]; - _unreportedEvents = nil; - - [self _changeState:MTRDeviceStateUnreachable]; -} - - (BOOL)deviceUsesThread { std::lock_guard lock(_lock); @@ -1229,253 +955,6 @@ - (BOOL)_deviceUsesThread return (networkCommissioningClusterFeatureMapValue & MTRNetworkCommissioningFeatureThreadNetworkInterface) != 0 ? YES : NO; } -- (void)_clearSubscriptionPoolWork -{ - os_unfair_lock_assert_owner(&self->_lock); - MTRAsyncWorkCompletionBlock completion = self->_subscriptionPoolWorkCompletionBlock; - if (completion) { -#ifdef DEBUG - [self _callDelegatesWithBlock:^(id testDelegate) { - if ([testDelegate respondsToSelector:@selector(unitTestSubscriptionPoolWorkComplete:)]) { - [testDelegate unitTestSubscriptionPoolWorkComplete:self]; - } - }]; -#endif - self->_subscriptionPoolWorkCompletionBlock = nil; - completion(MTRAsyncWorkComplete); - } -} - -- (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds:(int64_t)inNanoseconds description:(NSString *)description -{ - os_unfair_lock_assert_owner(&self->_lock); - - // Sanity check we are not scheduling for this device multiple times in the pool - if (_subscriptionPoolWorkCompletionBlock) { - MTR_LOG("%@ already scheduled in subscription pool for this device - ignoring: %@", self, description); - return; - } - - // Wait the required amount of time, then put it in the subscription pool to wait additionally for a spot, if needed - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, inNanoseconds), dispatch_get_main_queue(), ^{ - // In the case where a resubscription triggering event happened and already established, running the work block should result in a no-op - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; - [workItem setReadyHandler:^(id _Nonnull context, NSInteger retryCount, MTRAsyncWorkCompletionBlock _Nonnull completion) { - MTR_LOG("%@ - work item is ready to attempt pooled subscription", self); - os_unfair_lock_lock(&self->_lock); -#ifdef DEBUG - [self _callDelegatesWithBlock:^(id testDelegate) { - if ([testDelegate respondsToSelector:@selector(unitTestSubscriptionPoolDequeue:)]) { - [testDelegate unitTestSubscriptionPoolDequeue:self]; - } - }]; -#endif - if (self->_subscriptionPoolWorkCompletionBlock) { - // This means a resubscription triggering event happened and is now in-progress - MTR_LOG("%@ timer fired but already running in subscription pool - ignoring: %@", self, description); - os_unfair_lock_unlock(&self->_lock); - - // call completion as complete to remove from queue - completion(MTRAsyncWorkComplete); - return; - } - - // Otherwise, save the completion block - self->_subscriptionPoolWorkCompletionBlock = completion; - os_unfair_lock_unlock(&self->_lock); - - workBlock(); - }]; - [self->_deviceController.concurrentSubscriptionPool enqueueWorkItem:workItem description:description]; - MTR_LOG("%@ - enqueued in the subscription pool", self); - }); -} - -- (void)_handleResubscriptionNeededWithDelay:(NSNumber *)resubscriptionDelayMs -{ - BOOL deviceUsesThread; - - os_unfair_lock_lock(&self->_lock); - - [self _changeState:MTRDeviceStateUnknown]; - [self _changeInternalState:MTRInternalDeviceStateResubscribing]; - - // If we are here, then the ReadClient either just detected a subscription - // drop or just tried again and failed. Either way, count it as "tried and - // failed to subscribe": in the latter case it's actually true, and in the - // former case we recently had a subscription and do not want to be forcing - // retries immediately. - _lastSubscriptionFailureTime = [NSDate now]; - { - std::lock_guard lock(_descriptionLock); - _lastSubscriptionFailureTimeForDescription = _lastSubscriptionFailureTime; - } - - deviceUsesThread = [self _deviceUsesThread]; - - // If a previous resubscription failed, remove the item from the subscription pool. - [self _clearSubscriptionPoolWork]; - - os_unfair_lock_unlock(&self->_lock); - - // Use the existing _triggerResubscribeWithReason mechanism, which does the right checks when - // this block is run -- if other triggering events had happened, this would become a no-op. - auto resubscriptionBlock = ^{ - [self->_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:@"ResubscriptionNeeded timer fired" nodeLikelyReachable:NO]; - } errorHandler:^(NSError * _Nonnull error) { - // If controller is not running, clear work item from the subscription queue - MTR_LOG_ERROR("%@ could not dispatch to matter queue for resubscription - error %@", self, error); - std::lock_guard lock(self->_lock); - [self _clearSubscriptionPoolWork]; - }]; - }; - - int64_t resubscriptionDelayNs = static_cast(resubscriptionDelayMs.unsignedIntValue * NSEC_PER_MSEC); - if (deviceUsesThread) { - std::lock_guard lock(_lock); - // For Thread-enabled devices, schedule the _triggerResubscribeWithReason call to run in the subscription pool - [self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:@"ReadClient resubscription"]; - } else { - // For non-Thread-enabled devices, just call the resubscription block after the specified time - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, resubscriptionDelayNs), self.queue, resubscriptionBlock); - } - - // Set up connectivity monitoring in case network routability changes for the positive, to accelerate resubscription - [self _setupConnectivityMonitoring]; -} - -- (void)_handleSubscriptionReset:(NSNumber * _Nullable)retryDelay -{ - std::lock_guard lock(_lock); - [self _doHandleSubscriptionReset:retryDelay]; -} - -- (void)_setLastSubscriptionAttemptWait:(uint32_t)lastSubscriptionAttemptWait -{ - os_unfair_lock_assert_owner(&_lock); - _lastSubscriptionAttemptWait = lastSubscriptionAttemptWait; - - std::lock_guard lock(_descriptionLock); - _lastSubscriptionAttemptWaitForDescription = lastSubscriptionAttemptWait; -} - -- (void)_doHandleSubscriptionReset:(NSNumber * _Nullable)retryDelay -{ - os_unfair_lock_assert_owner(&_lock); - - // If we are here, then either we failed to establish initial CASE, or we - // failed to send the initial SubscribeRequest message, or our ReadClient - // has given up completely. Those all count as "we have tried and failed to - // subscribe". - _lastSubscriptionFailureTime = [NSDate now]; - { - std::lock_guard lock(_descriptionLock); - _lastSubscriptionFailureTimeForDescription = _lastSubscriptionFailureTime; - } - - // if there is no delegate then also do not retry - if (![self _delegateExists]) { - // NOTE: Do not log anything here: we have been invalidated, and the - // Matter stack might already be torn down. - return; - } - - // don't schedule multiple retries - if (self.reattemptingSubscription) { - return; - } - - self.reattemptingSubscription = YES; - - NSTimeInterval secondsToWait; - if (_lastSubscriptionAttemptWait < MTRDEVICE_SUBSCRIPTION_ATTEMPT_MIN_WAIT_SECONDS) { - _lastSubscriptionAttemptWait = MTRDEVICE_SUBSCRIPTION_ATTEMPT_MIN_WAIT_SECONDS; - secondsToWait = _lastSubscriptionAttemptWait; - } else if (retryDelay != nil) { - // The device responded but is currently busy. Reset our backoff - // counter, so that we don't end up waiting for a long time if the next - // attempt fails for some reason, and retry after whatever time period - // the device told us to use. - [self _setLastSubscriptionAttemptWait:0]; - secondsToWait = retryDelay.doubleValue; - MTR_LOG("%@ resetting resubscribe attempt counter, and delaying by the server-provided delay: %f", - self, secondsToWait); - } else { - auto lastSubscriptionAttemptWait = _lastSubscriptionAttemptWait * 2; - if (lastSubscriptionAttemptWait > MTRDEVICE_SUBSCRIPTION_ATTEMPT_MAX_WAIT_SECONDS) { - lastSubscriptionAttemptWait = MTRDEVICE_SUBSCRIPTION_ATTEMPT_MAX_WAIT_SECONDS; - } - [self _setLastSubscriptionAttemptWait:lastSubscriptionAttemptWait]; - secondsToWait = lastSubscriptionAttemptWait; - } - - MTR_LOG("%@ scheduling to reattempt subscription in %f seconds", self, secondsToWait); - - // If we started subscription or session establishment but failed, remove item from the subscription pool so we can re-queue. - [self _clearSubscriptionPoolWork]; - - // Call _reattemptSubscriptionNowIfNeededWithReason when timer fires - if subscription is - // in a better state at that time this will be a no-op. - auto resubscriptionBlock = ^{ - std::lock_guard lock(self->_lock); - [self _reattemptSubscriptionNowIfNeededWithReason:@"got subscription reset"]; - }; - - int64_t resubscriptionDelayNs = static_cast(secondsToWait * NSEC_PER_SEC); - if ([self _deviceUsesThread]) { - // For Thread-enabled devices, schedule the _reattemptSubscriptionNowIfNeededWithReason call to run in the subscription pool - [self _scheduleSubscriptionPoolWork:resubscriptionBlock inNanoseconds:resubscriptionDelayNs description:@"MTRDevice resubscription"]; - } else { - // For non-Thread-enabled devices, just call the resubscription block after the specified time - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, resubscriptionDelayNs), self.queue, resubscriptionBlock); - } -} - -- (void)_reattemptSubscriptionNowIfNeededWithReason:(NSString *)reason -{ - os_unfair_lock_assert_owner(&self->_lock); - if (!self.reattemptingSubscription) { - return; - } - - MTR_LOG("%@ reattempting subscription with reason %@", self, reason); - self.reattemptingSubscription = NO; - [self _setupSubscriptionWithReason:reason]; -} - -- (void)_handleUnsolicitedMessageFromPublisher -{ - std::lock_guard lock(_lock); - - [self _changeState:MTRDeviceStateReachable]; - - [self _callDelegatesWithBlock:^(id delegate) { - if ([delegate respondsToSelector:@selector(deviceBecameActive:)]) { - [delegate deviceBecameActive:self]; - } - }]; - - // in case this is called during exponential back off of subscription - // reestablishment, this starts the attempt right away - // TODO: This doesn't really make sense. If we _don't_ have a live - // ReadClient how did we get this notification and if we _do_ have an active - // ReadClient, this call or _setupSubscriptionWithReason would be no-ops. - [self _reattemptSubscriptionNowIfNeededWithReason:@"got unsolicited message from publisher"]; -} - -- (void)_markDeviceAsUnreachableIfNeverSubscribed -{ - os_unfair_lock_assert_owner(&self->_lock); - - if (HadSubscriptionEstablishedOnce(_internalDeviceState)) { - return; - } - - MTR_LOG("%@ still not subscribed, marking the device as unreachable", self); - [self _changeState:MTRDeviceStateUnreachable]; -} - - (void)_handleReportBegin { std::lock_guard lock(_lock); @@ -1487,7 +966,7 @@ - (void)_handleReportBegin // If we currently don't have an established subscription, this must be a // priming report. - _receivingPrimingReport = !HaveSubscriptionEstablishedRightNow(_internalDeviceState); + _receivingPrimingReport = YES; } - (NSDictionary *)_clusterDataToPersistSnapshot @@ -2136,8 +1615,6 @@ - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)cluster // First make sure _persistedClusters is consistent with storage, so repeated calls don't immediately re-trigger this [self _reconcilePersistedClustersWithStorage]; - - [self _resetSubscriptionWithReasonString:[NSString stringWithFormat:@"Data store has no data for cluster %@", clusterPath]]; } return data; @@ -2243,352 +1720,16 @@ - (void)_removeCachedAttribute:(NSNumber *)attributeID fromCluster:(MTRClusterPa [clusterData removeValueForAttribute:attributeID]; } -- (void)_createDataVersionFilterListFromDictionary:(NSDictionary *)dataVersions dataVersionFilterList:(DataVersionFilter **)dataVersionFilterList count:(size_t *)count -{ - size_t dataVersionFilterSize = dataVersions.count; - - // Check if any filter list should be generated - if (dataVersionFilterSize == 0) { - *count = 0; - *dataVersionFilterList = nullptr; - return; - } - - DataVersionFilter * dataVersionFilterArray = new DataVersionFilter[dataVersionFilterSize]; - size_t i = 0; - for (MTRClusterPath * path in dataVersions) { - NSNumber * dataVersionNumber = dataVersions[path]; - dataVersionFilterArray[i++] = DataVersionFilter(static_cast(path.endpoint.unsignedShortValue), static_cast(path.cluster.unsignedLongValue), static_cast(dataVersionNumber.unsignedLongValue)); - } - - *dataVersionFilterList = dataVersionFilterArray; - *count = dataVersionFilterSize; -} - -- (void)_setupConnectivityMonitoring -{ -#if ENABLE_CONNECTIVITY_MONITORING - // Dispatch to own queue because we used to need to do that to get the compressedFabricID, but - // at this point that's not really needed anymore. - dispatch_async(self.queue, ^{ - // Get the required info before setting up the connectivity monitor - NSNumber * compressedFabricID = [self->_deviceController compressedFabricID]; - if (!compressedFabricID) { - MTR_LOG_ERROR("%@ could not get compressed fabricID", self); - return; - } - - // Now lock for _connectivityMonitor - std::lock_guard lock(self->_lock); - if (self->_connectivityMonitor) { - // already monitoring - return; - } - - self->_connectivityMonitor = [[MTRDeviceConnectivityMonitor alloc] initWithCompressedFabricID:compressedFabricID nodeID:self.nodeID]; - [self->_connectivityMonitor startMonitoringWithHandler:^{ - [self->_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:@"device connectivity changed" nodeLikelyReachable:YES]; - } - errorHandler:nil]; - } queue:self.queue]; - }); -#endif -} - -- (void)_stopConnectivityMonitoring -{ - os_unfair_lock_assert_owner(&_lock); - - if (_connectivityMonitor) { - [_connectivityMonitor stopMonitoring]; - _connectivityMonitor = nil; - } -} - -- (void)_resetSubscriptionWithReasonString:(NSString *)reasonString -{ - os_unfair_lock_assert_owner(&self->_lock); - MTR_LOG_ERROR("%@ %@ - resetting subscription", self, reasonString); - - [_deviceController asyncDispatchToMatterQueue:^{ - MTR_LOG("%@ subscription reset disconnecting ReadClient and SubscriptionCallback", self); - - std::lock_guard lock(self->_lock); - self->_currentReadClient = nullptr; - if (self->_currentSubscriptionCallback) { - delete self->_currentSubscriptionCallback; - } - self->_currentSubscriptionCallback = nullptr; - - [self _doHandleSubscriptionError:nil]; - // Use nil reset delay so that this keeps existing backoff timing - [self _doHandleSubscriptionReset:nil]; - } - errorHandler:nil]; -} - #ifdef DEBUG - (void)unitTestResetSubscription { - std::lock_guard lock(self->_lock); - [self _resetSubscriptionWithReasonString:@"Unit test reset subscription"]; } #endif -// assume lock is held -- (void)_setupSubscriptionWithReason:(NSString *)reason -{ - // TODO: XPC: This is not really called anymore in this class. Should - // remove this function and anything only reachable from it. - os_unfair_lock_assert_owner(&self->_lock); - - if (![self _subscriptionsAllowed]) { - MTR_LOG("%@ _setupSubscription: Subscriptions not allowed. Do not set up subscription (reason: %@)", self, reason); - return; - } - -#ifdef DEBUG - __block NSNumber * delegateMin = nil; - Optional maxIntervalOverride; - [self _callFirstDelegateSynchronouslyWithBlock:^(id testDelegate) { - if ([testDelegate respondsToSelector:@selector(unitTestMaxIntervalOverrideForSubscription:)]) { - delegateMin = [testDelegate unitTestMaxIntervalOverrideForSubscription:self]; - } - }]; - if (delegateMin) { - maxIntervalOverride.Emplace(delegateMin.unsignedIntValue); - } -#endif - - // for now just subscribe once - if (!NeedToStartSubscriptionSetup(_internalDeviceState)) { - MTR_LOG("%@ setupSubscription: no need to subscribe due to internal state %lu (reason: %@)", self, static_cast(_internalDeviceState), reason); - return; - } - - [self _changeInternalState:MTRInternalDeviceStateSubscribing]; - - MTR_LOG("%@ setting up subscription with reason: %@", self, reason); - - __block bool markUnreachableAfterWait = true; -#ifdef DEBUG - [self _callFirstDelegateSynchronouslyWithBlock:^(id testDelegate) { - if ([testDelegate respondsToSelector:@selector(unitTestSuppressTimeBasedReachabilityChanges:)]) { - markUnreachableAfterWait = ![testDelegate unitTestSuppressTimeBasedReachabilityChanges:self]; - } - }]; -#endif - - if (markUnreachableAfterWait) { - // Set up a timer to mark as not reachable if it takes too long to set up a subscription - mtr_weakify(self); - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ - mtr_strongify(self); - if (self != nil) { - std::lock_guard lock(self->_lock); - [self _markDeviceAsUnreachableIfNeverSubscribed]; - } - }); - } - - // This marks begin of initial subscription to the device (before CASE is established). The end is only marked after successfully setting - // up the subscription since it is always retried as long as the MTRDevice is kept running. - MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceInitialSubscriptionSetup); - - // Call directlyGetSessionForNode because the subscription setup already goes through the subscription pool queue - [_deviceController - directlyGetSessionForNode:_nodeID.unsignedLongLongValue - completion:^(chip::Messaging::ExchangeManager * _Nullable exchangeManager, - const chip::Optional & session, NSError * _Nullable error, - NSNumber * _Nullable retryDelay) { - if (error != nil) { - MTR_LOG_ERROR("%@ getSessionForNode error %@", self, error); - dispatch_async(self.queue, ^{ - [self _handleSubscriptionError:error]; - [self _handleSubscriptionReset:retryDelay]; - }); - return; - } - - auto callback = std::make_unique( - ^(NSArray * value) { - MTR_LOG("%@ got attribute report %@", self, value); - dispatch_async(self.queue, ^{ - // OnAttributeData - [self _handleAttributeReport:value fromSubscription:YES]; -#ifdef DEBUG - self->_unitTestAttributesReportedSinceLastCheck += value.count; -#endif - }); - }, - ^(NSArray * value) { - MTR_LOG("%@ got event report %@", self, value); - dispatch_async(self.queue, ^{ - // OnEventReport - [self _handleEventReport:value]; - }); - }, - ^(NSError * error) { - MTR_LOG_ERROR("%@ got subscription error %@", self, error); - dispatch_async(self.queue, ^{ - // OnError - [self _handleSubscriptionError:error]; - }); - }, - ^(NSError * error, NSNumber * resubscriptionDelayMs) { - MTR_LOG_ERROR("%@ got resubscription error %@ delay %@", self, error, resubscriptionDelayMs); - dispatch_async(self.queue, ^{ - // OnResubscriptionNeeded - [self _handleResubscriptionNeededWithDelay:resubscriptionDelayMs]; - }); - }, - ^(void) { - MTR_LOG("%@ got subscription established", self); - std::lock_guard lock(self->_lock); - - // First synchronously change state - if (HadSubscriptionEstablishedOnce(self->_internalDeviceState)) { - [self _changeInternalState:MTRInternalDeviceStateLaterSubscriptionEstablished]; - } else { - MATTER_LOG_METRIC_END(kMetricMTRDeviceInitialSubscriptionSetup, CHIP_NO_ERROR); - [self _changeInternalState:MTRInternalDeviceStateInitialSubscriptionEstablished]; - } - - [self _changeState:MTRDeviceStateReachable]; - - // Then async work that shouldn't be performed on the matter queue - dispatch_async(self.queue, ^{ - // OnSubscriptionEstablished - [self _handleSubscriptionEstablished]; - }); - }, - ^(void) { - MTR_LOG("%@ got subscription done", self); - // Drop our pointer to the ReadClient immediately, since - // it's about to be destroyed and we don't want to be - // holding a dangling pointer. - std::lock_guard lock(self->_lock); - self->_currentReadClient = nullptr; - self->_currentSubscriptionCallback = nullptr; - - dispatch_async(self.queue, ^{ - // OnDone - [self _handleSubscriptionReset:nil]; - }); - }, - ^(void) { - MTR_LOG("%@ got unsolicited message from publisher", self); - dispatch_async(self.queue, ^{ - // OnUnsolicitedMessageFromPublisher - [self _handleUnsolicitedMessageFromPublisher]; - }); - }, - ^(void) { - MTR_LOG("%@ got report begin", self); - dispatch_async(self.queue, ^{ - [self _handleReportBegin]; - }); - }, - ^(void) { - MTR_LOG("%@ got report end", self); - dispatch_async(self.queue, ^{ - [self _handleReportEnd]; - }); - }); - - // Set up a cluster state cache. We just want this for the logic it has for - // tracking data versions and event numbers so we minimize the amount of data we - // request on resubscribes, so tell it not to store data. - auto clusterStateCache = std::make_unique(*callback.get(), - /* highestReceivedEventNumber = */ NullOptional, - /* cacheData = */ false); - auto readClient = std::make_unique(InteractionModelEngine::GetInstance(), exchangeManager, - clusterStateCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); - - // Wildcard endpoint, cluster, attribute, event. - auto attributePath = std::make_unique(); - auto eventPath = std::make_unique(); - // We want to get event reports at the minInterval, not the maxInterval. - eventPath->mIsUrgentEvent = true; - ReadPrepareParams readParams(session.Value()); - - readParams.mMinIntervalFloorSeconds = 0; - // Select a max interval based on the device's claimed idle sleep interval. - auto idleSleepInterval = std::chrono::duration_cast( - session.Value()->GetRemoteMRPConfig().mIdleRetransTimeout); - - auto maxIntervalCeilingMin = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MIN); - if (idleSleepInterval < maxIntervalCeilingMin) { - idleSleepInterval = maxIntervalCeilingMin; - } - - auto maxIntervalCeilingMax = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX); - if (idleSleepInterval > maxIntervalCeilingMax) { - idleSleepInterval = maxIntervalCeilingMax; - } -#ifdef DEBUG - if (maxIntervalOverride.HasValue()) { - idleSleepInterval = maxIntervalOverride.Value(); - } -#endif - readParams.mMaxIntervalCeilingSeconds = static_cast(idleSleepInterval.count()); - - readParams.mpAttributePathParamsList = attributePath.get(); - readParams.mAttributePathParamsListSize = 1; - readParams.mpEventPathParamsList = eventPath.get(); - readParams.mEventPathParamsListSize = 1; - readParams.mKeepSubscriptions = true; - readParams.mIsFabricFiltered = false; - - // Subscribe with data version filter list from our cache. - size_t dataVersionFilterListSize = 0; - DataVersionFilter * dataVersionFilterList; - [self _createDataVersionFilterListFromDictionary:[self _getCachedDataVersions] dataVersionFilterList:&dataVersionFilterList count:&dataVersionFilterListSize]; - - readParams.mDataVersionFilterListSize = dataVersionFilterListSize; - readParams.mpDataVersionFilterList = dataVersionFilterList; - attributePath.release(); - eventPath.release(); - - // TODO: Change from local filter list generation to rehydrating ClusterStateCache to take advantage of existing filter list sorting algorithm - - // SendAutoResubscribeRequest cleans up the params, even on failure. - CHIP_ERROR err = readClient->SendAutoResubscribeRequest(std::move(readParams)); - if (err != CHIP_NO_ERROR) { - NSError * error = [MTRError errorForCHIPErrorCode:err logContext:self]; - MTR_LOG_ERROR("%@ SendAutoResubscribeRequest error %@", self, error); - dispatch_async(self.queue, ^{ - [self _handleSubscriptionError:error]; - [self _handleSubscriptionReset:nil]; - }); - - return; - } - - MTR_LOG("%@ Subscribe with data version list size %lu", self, static_cast(dataVersionFilterListSize)); - - // Callback and ClusterStateCache and ReadClient will be deleted - // when OnDone is called. - os_unfair_lock_lock(&self->_lock); - self->_currentReadClient = readClient.get(); - self->_currentSubscriptionCallback = callback.get(); - os_unfair_lock_unlock(&self->_lock); - callback->AdoptReadClient(std::move(readClient)); - callback->AdoptClusterStateCache(std::move(clusterStateCache)); - callback.release(); - }]; - - // Set up connectivity monitoring in case network becomes routable after any part of the subscription process goes into backoff retries. - [self _setupConnectivityMonitoring]; -} - #ifdef DEBUG - (NSUInteger)unitTestAttributesReportedSinceLastCheck { - NSUInteger attributesReportedSinceLastCheck = _unitTestAttributesReportedSinceLastCheck; - _unitTestAttributesReportedSinceLastCheck = 0; - return attributesReportedSinceLastCheck; + return 0; } - (NSUInteger)unitTestNonnullDelegateCount @@ -3472,13 +2613,6 @@ - (void)_pruneEndpointsIn:(MTRDeviceDataValueDictionary)previousPartsListValue } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:NO]; [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:endpoint]; - - [_deviceController asyncDispatchToMatterQueue:^{ - std::lock_guard lock(self->_lock); - if (self->_currentSubscriptionCallback) { - self->_currentSubscriptionCallback->ClearCachedAttributeState(static_cast(endpoint.unsignedLongLongValue)); - } - } errorHandler:nil]; } } @@ -3499,17 +2633,6 @@ - (void)_pruneClustersIn:(MTRDeviceDataValueDictionary)previousServerListValue } } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:YES]; - - [_deviceController asyncDispatchToMatterQueue:^{ - std::lock_guard lock(self->_lock); - if (self->_currentSubscriptionCallback) { - for (NSNumber * cluster in toBeRemovedClusters) { - ConcreteClusterPath clusterPath(static_cast(endpointID.unsignedLongLongValue), - static_cast(cluster.unsignedLongLongValue)); - self->_currentSubscriptionCallback->ClearCachedAttributeState(clusterPath); - } - } - } errorHandler:nil]; } - (void)_pruneAttributesIn:(MTRDeviceDataValueDictionary)previousAttributeListValue @@ -3523,18 +2646,6 @@ - (void)_pruneAttributesIn:(MTRDeviceDataValueDictionary)previousAttributeListVa [toBeRemovedAttributes minusSet:attributesStillInCluster]; [self _removeAttributes:toBeRemovedAttributes fromCluster:clusterPath]; - - [_deviceController asyncDispatchToMatterQueue:^{ - std::lock_guard lock(self->_lock); - if (self->_currentSubscriptionCallback) { - for (NSNumber * attribute in toBeRemovedAttributes) { - ConcreteAttributePath attributePath(static_cast(clusterPath.endpoint.unsignedLongLongValue), - static_cast(clusterPath.cluster.unsignedLongLongValue), - static_cast(attribute.unsignedLongLongValue)); - self->_currentSubscriptionCallback->ClearCachedAttributeState(attributePath); - } - } - } errorHandler:nil]; } - (void)_pruneStoredDataForPath:(MTRAttributePath *)attributePath @@ -3769,25 +2880,6 @@ - (void)setPersistedDeviceData:(NSDictionary *)data } } -- (void)_storePersistedDeviceData -{ - os_unfair_lock_assert_owner(&self->_lock); - - auto datastore = _deviceController.controllerDataStore; - if (datastore == nil) { - // No way to store. - return; - } - - // For now the only data we have is our initial subscribe latency. - NSMutableDictionary * data = [NSMutableDictionary dictionary]; - if (_estimatedSubscriptionLatency != nil) { - data[sLastInitialSubscribeLatencyKey] = _estimatedSubscriptionLatency; - } - - [datastore storeDeviceData:[data copy] forNodeID:self.nodeID]; -} - #ifdef DEBUG - (MTRDeviceClusterData *)unitTestGetClusterDataForPath:(MTRClusterPath *)path { @@ -4215,20 +3307,11 @@ @implementation MTRDevice (MatterPrivateForInternalDragonsDoNotFeed) - (BOOL)_deviceHasActiveSubscription { - std::lock_guard lock(_lock); - - // TODO: This should always return YES for thread devices - return HaveSubscriptionEstablishedRightNow(_internalDeviceState); + return NO; } - (void)_deviceMayBeReachable { - MTR_LOG("%@ _deviceMayBeReachable called", self); - // TODO: This should only be allowed for thread devices - [_deviceController asyncDispatchToMatterQueue:^{ - [self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable" - nodeLikelyReachable:YES]; - } errorHandler:nil]; } /* END DRAGONS */ @@ -4264,122 +3347,3 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID } @end - -#pragma mark - SubscriptionCallback -namespace { -void SubscriptionCallback::OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) -{ - if (mEventReports == nil) { - // Never got a OnReportBegin? Not much to do other than tear things down. - ReportError(CHIP_ERROR_INCORRECT_STATE); - return; - } - - MTREventPath * eventPath = [[MTREventPath alloc] initWithPath:aEventHeader.mPath]; - if (apStatus != nullptr) { - [mEventReports addObject:@ { MTREventPathKey : eventPath, MTRErrorKey : [MTRError errorForIMStatus:*apStatus] }]; - } else if (apData == nullptr) { - [mEventReports addObject:@ { - MTREventPathKey : eventPath, - MTRErrorKey : [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT] - }]; - } else { - id value = MTRDecodeDataValueDictionaryFromCHIPTLV(apData); - if (value == nil) { - MTR_LOG_ERROR("Failed to decode event data for path %@", eventPath); - [mEventReports addObject:@ { - MTREventPathKey : eventPath, - MTRErrorKey : [MTRError errorForCHIPErrorCode:CHIP_ERROR_DECODE_FAILED], - }]; - } else { - [mEventReports addObject:[MTRBaseDevice eventReportForHeader:aEventHeader andData:value]]; - } - } - - QueueInterimReport(); -} - -void SubscriptionCallback::OnAttributeData( - const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) -{ - if (aPath.IsListItemOperation()) { - ReportError(CHIP_ERROR_INCORRECT_STATE); - return; - } - - if (mAttributeReports == nil) { - // Never got a OnReportBegin? Not much to do other than tear things down. - ReportError(CHIP_ERROR_INCORRECT_STATE); - return; - } - - MTRAttributePath * attributePath = [[MTRAttributePath alloc] initWithPath:aPath]; - if (aStatus.mStatus != Status::Success) { - [mAttributeReports addObject:@ { MTRAttributePathKey : attributePath, MTRErrorKey : [MTRError errorForIMStatus:aStatus] }]; - } else if (apData == nullptr) { - [mAttributeReports addObject:@ { - MTRAttributePathKey : attributePath, - MTRErrorKey : [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT] - }]; - } else { - NSNumber * dataVersionNumber = aPath.mDataVersion.HasValue() ? @(aPath.mDataVersion.Value()) : nil; - NSDictionary * value = MTRDecodeDataValueDictionaryFromCHIPTLV(apData, dataVersionNumber); - if (value == nil) { - MTR_LOG_ERROR("Failed to decode attribute data for path %@", attributePath); - [mAttributeReports addObject:@ { - MTRAttributePathKey : attributePath, - MTRErrorKey : [MTRError errorForCHIPErrorCode:CHIP_ERROR_DECODE_FAILED], - }]; - } else { - [mAttributeReports addObject:@ { MTRAttributePathKey : attributePath, MTRDataKey : value }]; - } - } - - QueueInterimReport(); -} - -uint32_t SubscriptionCallback::ComputeTimeTillNextSubscription() -{ - uint32_t maxWaitTimeInMsec = 0; - uint32_t waitTimeInMsec = 0; - uint32_t minWaitTimeInMsec = 0; - - if (mResubscriptionNumRetries <= CHIP_RESUBSCRIBE_MAX_FIBONACCI_STEP_INDEX) { - maxWaitTimeInMsec = GetFibonacciForIndex(mResubscriptionNumRetries) * CHIP_RESUBSCRIBE_WAIT_TIME_MULTIPLIER_MS; - } else { - maxWaitTimeInMsec = CHIP_RESUBSCRIBE_MAX_RETRY_WAIT_INTERVAL_MS; - } - - if (maxWaitTimeInMsec != 0) { - minWaitTimeInMsec = (CHIP_RESUBSCRIBE_MIN_WAIT_TIME_INTERVAL_PERCENT_PER_STEP * maxWaitTimeInMsec) / 100; - waitTimeInMsec = minWaitTimeInMsec + (Crypto::GetRandU32() % (maxWaitTimeInMsec - minWaitTimeInMsec)); - } - - return waitTimeInMsec; -} - -CHIP_ERROR SubscriptionCallback::OnResubscriptionNeeded(ReadClient * apReadClient, CHIP_ERROR aTerminationCause) -{ - // No need to check ReadClient internal state is Idle because ReadClient only calls OnResubscriptionNeeded after calling ClearActiveSubscriptionState(), which sets the state to Idle. - - // This part is copied from ReadClient's DefaultResubscribePolicy: - auto timeTillNextResubscriptionMs = ComputeTimeTillNextSubscription(); - ChipLogProgress(DataManagement, - "Will try to resubscribe to %02x:" ChipLogFormatX64 " at retry index %" PRIu32 " after %" PRIu32 - "ms due to error %" CHIP_ERROR_FORMAT, - apReadClient->GetFabricIndex(), ChipLogValueX64(apReadClient->GetPeerNodeId()), mResubscriptionNumRetries, timeTillNextResubscriptionMs, - aTerminationCause.Format()); - - // Schedule a maximum time resubscription, to be triggered with TriggerResubscribeIfScheduled after a separate timer. - // This way the aReestablishCASE value is saved, and the sanity checks in ScheduleResubscription are observed and returned. - ReturnErrorOnFailure(apReadClient->ScheduleResubscription(UINT32_MAX, NullOptional, aTerminationCause == CHIP_ERROR_TIMEOUT)); - - // Not as good a place to increment as when resubscription timer fires, but as is, this should be as good, because OnResubscriptionNeeded is only called from ReadClient's Close() while Idle, and nothing should cause this to happen - mResubscriptionNumRetries++; - - auto error = [MTRError errorForCHIPErrorCode:aTerminationCause]; - CallResubscriptionScheduledHandler(error, @(timeTillNextResubscriptionMs)); - - return CHIP_NO_ERROR; -} -} // anonymous namespace From 72ee6eb2973c3b5aecb17e7b92dc90780ec6bf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Tomkiel?= Date: Thu, 22 Aug 2024 08:51:25 +0200 Subject: [PATCH 22/53] Enhance chip-tool's formatting for some IDs (#35088) * Added logging functions * Modify ZAP template file generation * Updated files for CommandId support * Updated manual tests for the new formatting * Fixed variable name shadowing * Fixed typo * Added logging functions to fabric admin * Restyled by whitespace * Restyled by clang-format * Fixed linking * Fixed typo * Fixed CommandId logging * Updated ZAP generated files * Restyled by clang-format --------- Co-authored-by: Restyled.io --- examples/chip-tool/BUILD.gn | 1 + .../commands/clusters/DataModelLogger.h | 95 + .../logging/DataModelLogger-src.zapt | 12 + .../templates/logging/EntryToText-src.zapt | 84 + .../templates/logging/EntryToText.zapt | 13 + examples/chip-tool/templates/templates.json | 10 + .../commands/clusters/DataModelLogger.h | 95 + .../tv-casting-app/tv-casting-common/BUILD.gn | 1 + .../suites/certification/Test_TC_DEM_1_1.yaml | 54 +- .../certification/Test_TC_DESC_2_1.yaml | 178 +- .../suites/certification/Test_TC_IDM_2_2.yaml | 424 +- .../certification/Test_TC_WAKEONLAN_4_1.yaml | 8 +- .../cluster/logging/DataModelLogger.cpp | 773 +- .../cluster/logging/EntryToText.cpp | 6700 +++++++++++++++++ .../cluster/logging/EntryToText.h | 30 + 15 files changed, 7765 insertions(+), 713 deletions(-) create mode 100644 examples/chip-tool/templates/logging/EntryToText-src.zapt create mode 100644 examples/chip-tool/templates/logging/EntryToText.zapt create mode 100644 zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp create mode 100644 zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.h diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 94e1eebbde7508..acacbc70e8bfad 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -53,6 +53,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/controller/ExamplePersistentStorage.h", "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp", "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp", + "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp", "commands/clusters/ModelCommand.cpp", "commands/clusters/ModelCommand.h", "commands/common/BDXDiagnosticLogsServerDelegate.cpp", diff --git a/examples/chip-tool/commands/clusters/DataModelLogger.h b/examples/chip-tool/commands/clusters/DataModelLogger.h index 1d9d1e1ccd6955..7186b833ff5153 100644 --- a/examples/chip-tool/commands/clusters/DataModelLogger.h +++ b/examples/chip-tool/commands/clusters/DataModelLogger.h @@ -28,6 +28,7 @@ #include #include #include +#include class DataModelLogger { @@ -157,6 +158,100 @@ class DataModelLogger return CHIP_NO_ERROR; } + static CHIP_ERROR LogClusterId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + ClusterIdToText(iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogAttributeId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + AttributeIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogAcceptedCommandId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, + chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + AcceptedCommandIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogGeneratedCommandId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, + chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + GeneratedCommandIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + #include static void LogString(size_t indent, const std::string string) { LogString("", indent, string); } diff --git a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt index 0f41ff2e16b96a..3f76143ffab36c 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt @@ -75,7 +75,19 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP { {{zapTypeToDecodableClusterObjectType type ns=parent.name forceNotOptional=true}} value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); +{{#if (isEqual name "ServerList")}} + return DataModelLogger::LogClusterId("{{name}}", 1, value); +{{else if (isEqual name "ClientList")}} + return DataModelLogger::LogClusterId("{{name}}", 1, value); +{{else if (isEqual name "AttributeList")}} + return DataModelLogger::LogAttributeId("{{name}}", 1, value, {{asUpperCamelCase parent.name}}::Id); +{{else if (isEqual name "AcceptedCommandList")}} + return DataModelLogger::LogAcceptedCommandId("{{name}}", 1, value, {{asUpperCamelCase parent.name}}::Id); +{{else if (isEqual name "GeneratedCommandList")}} + return DataModelLogger::LogGeneratedCommandId("{{name}}", 1, value, {{asUpperCamelCase parent.name}}::Id); +{{else}} return DataModelLogger::LogValue("{{name}}", 1, value); +{{/if}} } {{#last}} } diff --git a/examples/chip-tool/templates/logging/EntryToText-src.zapt b/examples/chip-tool/templates/logging/EntryToText-src.zapt new file mode 100644 index 00000000000000..646ee2ad872eaf --- /dev/null +++ b/examples/chip-tool/templates/logging/EntryToText-src.zapt @@ -0,0 +1,84 @@ +{{> header}} + +#include +#include +#include + +char const * ClusterIdToText(chip::ClusterId id) { + switch(id) + { +{{#zcl_clusters}} + case chip::app::Clusters::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; +{{/zcl_clusters}} + default: return "Unknown"; + } +} + +char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) { + switch(cluster) + { +{{#zcl_clusters}} +{{#zcl_attributes_server}} +{{#first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: + { + switch(id) + { +{{/first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; +{{#last}} + default: return "Unknown"; + } + } +{{/last}} +{{/zcl_attributes_server}} +{{/zcl_clusters}} + default: return "Unknown"; + } +} + +char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) { + switch(cluster) + { +{{#zcl_clusters}} +{{#zcl_commands_source_client}} +{{#first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: + { + switch(id) + { +{{/first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; +{{#last}} + default: return "Unknown"; + } + } +{{/last}} +{{/zcl_commands_source_client}} +{{/zcl_clusters}} + default: return "Unknown"; + } +} + +char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) { + switch(cluster) + { +{{#zcl_clusters}} +{{#zcl_commands_source_server}} +{{#first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: + { + switch(id) + { +{{/first}} + case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; +{{#last}} + default: return "Unknown"; + } + } +{{/last}} +{{/zcl_commands_source_server}} +{{/zcl_clusters}} + default: return "Unknown"; + } +} \ No newline at end of file diff --git a/examples/chip-tool/templates/logging/EntryToText.zapt b/examples/chip-tool/templates/logging/EntryToText.zapt new file mode 100644 index 00000000000000..d1a78f84dc218c --- /dev/null +++ b/examples/chip-tool/templates/logging/EntryToText.zapt @@ -0,0 +1,13 @@ +{{> header}} + +#include +#include +#include + +char const * ClusterIdToText(chip::ClusterId id); + +char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id); + +char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); + +char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); \ No newline at end of file diff --git a/examples/chip-tool/templates/templates.json b/examples/chip-tool/templates/templates.json index 528c7d266dcb97..9ced10b1372590 100644 --- a/examples/chip-tool/templates/templates.json +++ b/examples/chip-tool/templates/templates.json @@ -64,6 +64,16 @@ "path": "ComplexArgumentParser-src.zapt", "name": "Complex Argument Parser", "output": "cluster/ComplexArgumentParser.cpp" + }, + { + "path": "logging/EntryToText.zapt", + "name": "Entry To Text header", + "output": "cluster/logging/EntryToText.h" + }, + { + "path": "logging/EntryToText-src.zapt", + "name": "Entry To Text", + "output": "cluster/logging/EntryToText.cpp" } ] } diff --git a/examples/fabric-admin/commands/clusters/DataModelLogger.h b/examples/fabric-admin/commands/clusters/DataModelLogger.h index ee649755014906..36f53ba3811c24 100644 --- a/examples/fabric-admin/commands/clusters/DataModelLogger.h +++ b/examples/fabric-admin/commands/clusters/DataModelLogger.h @@ -28,6 +28,7 @@ #include #include #include +#include class DataModelLogger { @@ -157,6 +158,100 @@ class DataModelLogger return CHIP_NO_ERROR; } + static CHIP_ERROR LogClusterId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + ClusterIdToText(iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogAttributeId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + AttributeIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogAcceptedCommandId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, + chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + AcceptedCommandIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + + static CHIP_ERROR LogGeneratedCommandId(const char * label, size_t indent, + const chip::app::DataModel::DecodableList & value, + chip::ClusterId cluster) + { + size_t count = 0; + ReturnErrorOnFailure(value.ComputeSize(&count)); + DataModelLogger::LogString(label, indent, std::to_string(count) + " entries"); + + auto iter = value.begin(); + size_t i = 0; + while (iter.Next()) + { + ++i; + std::string index = std::string("[") + std::to_string(i) + "]"; + std::string item = std::to_string(iter.GetValue()) + " (" + GeneratedCommandIdToText(cluster, iter.GetValue()) + ")"; + DataModelLogger::LogString(index, indent + 1, item); + } + if (iter.GetStatus() != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "List truncated due to invalid value"); + } + return iter.GetStatus(); + } + #include static void LogString(size_t indent, const std::string string) { LogString("", indent, string); } diff --git a/examples/tv-casting-app/tv-casting-common/BUILD.gn b/examples/tv-casting-app/tv-casting-common/BUILD.gn index ee422e1b063db9..2c30080f027ee5 100644 --- a/examples/tv-casting-app/tv-casting-common/BUILD.gn +++ b/examples/tv-casting-app/tv-casting-common/BUILD.gn @@ -50,6 +50,7 @@ chip_data_model("tv-casting-common") { "${chip_root}/src/controller/ExamplePersistentStorage.h", "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp", "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp", + "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp", "clusters/content-app-observer/ContentAppObserver.cpp", "clusters/content-app-observer/ContentAppObserver.h", "commands/clusters/ModelCommand.cpp", diff --git a/src/app/tests/suites/certification/Test_TC_DEM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DEM_1_1.yaml index 4d1a72392ab435..e69e5a62b0a820 100644 --- a/src/app/tests/suites/certification/Test_TC_DEM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DEM_1_1.yaml @@ -62,21 +62,21 @@ tests: - Based on feature support:- 0x0005, 0x0006, 0x0007 Below mentioned log is based on the RPI implementation, Value may vary on real DUT - [1705649142.831039][6212:6214] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFFB DataVersion: 633673396 - [1705649142.831110][6212:6214] CHIP:TOO: AttributeList: 13 entries - [1705649142.831151][6212:6214] CHIP:TOO: [1]: 0 - [1705649142.831174][6212:6214] CHIP:TOO: [2]: 1 - [1705649142.831208][6212:6214] CHIP:TOO: [3]: 2 - [1705649142.831230][6212:6214] CHIP:TOO: [4]: 3 - [1705649142.831261][6212:6214] CHIP:TOO: [5]: 4 - [1705649142.831283][6212:6214] CHIP:TOO: [6]: 5 - [1705649142.831304][6212:6214] CHIP:TOO: [7]: 6 - [1705649142.831336][6212:6214] CHIP:TOO: [8]: 7 - [1705649142.831359][6212:6214] CHIP:TOO: [9]: 65528 - [1705649142.831390][6212:6214] CHIP:TOO: [10]: 65529 - [1705649142.831434][6212:6214] CHIP:TOO: [11]: 65531 - [1705649142.831458][6212:6214] CHIP:TOO: [12]: 65532 - [1705649142.831490][6212:6214] CHIP:TOO: [13]: 65533 + [1723642027.628] [328171:328173] [TOO] Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFFB DataVersion: 3122179410 + [1723642027.628] [328171:328173] [TOO] AttributeList: 13 entries + [1723642027.628] [328171:328173] [TOO] [1]: 0 (ESAType) + [1723642027.628] [328171:328173] [TOO] [2]: 1 (ESACanGenerate) + [1723642027.628] [328171:328173] [TOO] [3]: 2 (ESAState) + [1723642027.628] [328171:328173] [TOO] [4]: 3 (AbsMinPower) + [1723642027.628] [328171:328173] [TOO] [5]: 4 (AbsMaxPower) + [1723642027.628] [328171:328173] [TOO] [6]: 5 (PowerAdjustmentCapability) + [1723642027.628] [328171:328173] [TOO] [7]: 6 (Forecast) + [1723642027.628] [328171:328173] [TOO] [8]: 7 (OptOutState) + [1723642027.628] [328171:328173] [TOO] [9]: 65528 (GeneratedCommandList) + [1723642027.628] [328171:328173] [TOO] [10]: 65529 (AcceptedCommandList) + [1723642027.628] [328171:328173] [TOO] [11]: 65531 (AttributeList) + [1723642027.628] [328171:328173] [TOO] [12]: 65532 (FeatureMap) + [1723642027.628] [328171:328173] [TOO] [13]: 65533 (ClusterRevision) disabled: true - label: "Step 5*: TH reads from the DUT the EventList attribute." @@ -100,16 +100,16 @@ tests: On TH(chip-tool), Verify the AcceptedCommandList attribute that contains 7 entries: Below mentioned log is based on the RPI implementation, Value may vary on real DUT - [1705649342.947638][6221:6223] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFF9 DataVersion: 633673396 - [1705649342.947712][6221:6223] CHIP:TOO: AcceptedCommandList: 8 entries - [1705649342.947754][6221:6223] CHIP:TOO: [1]: 0 - [1705649342.947779][6221:6223] CHIP:TOO: [2]: 1 - [1705649342.947802][6221:6223] CHIP:TOO: [3]: 2 - [1705649342.947825][6221:6223] CHIP:TOO: [4]: 3 - [1705649342.947848][6221:6223] CHIP:TOO: [5]: 4 - [1705649342.947871][6221:6223] CHIP:TOO: [6]: 5 - [1705649342.947894][6221:6223] CHIP:TOO: [7]: 6 - [1705649342.947917][6221:6223] CHIP:TOO: [8]: 7 + [1705649342.947638][6221:6223] [TOO] Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFF9 DataVersion: 633673396 + [1705649342.947712][6221:6223] [TOO] AcceptedCommandList: 8 entries + [1705649342.947754][6221:6223] [TOO] [1]: 0 (PowerAdjustRequest) + [1705649342.947779][6221:6223] [TOO] [2]: 1 (CancelPowerAdjustRequest) + [1705649342.947802][6221:6223] [TOO] [3]: 2 (StartTimeAdjustRequest) + [1705649342.947825][6221:6223] [TOO] [4]: 3 (PauseRequest) + [1705649342.947848][6221:6223] [TOO] [5]: 4 (ResumeRequest) + [1705649342.947871][6221:6223] [TOO] [6]: 5 (ModifyForecastRequest) + [1705649342.947894][6221:6223] [TOO] [7]: 6 (RequestConstraintBasedForecast) + [1705649342.947917][6221:6223] [TOO] [8]: 7 (CancelRequest) disabled: true - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." @@ -118,6 +118,6 @@ tests: On TH(chip-tool), Verify the GeneratedCommandList attribute that contains 1 entries: - [1705567897.076935][7141:7143] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFF8 DataVersion: 1117764527 - [1705567897.076989][7141:7143] CHIP:TOO: GeneratedCommandList: 0 entries + [1705567897.076935][7141:7143] [TOO] Endpoint: 1 Cluster: 0x0000_0098 Attribute 0x0000_FFF8 DataVersion: 1117764527 + [1705567897.076989][7141:7143] [TOO] GeneratedCommandList: 0 entries disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DESC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_DESC_2_1.yaml index 2ce0e296bbc2d5..2afe448fa99f30 100644 --- a/src/app/tests/suites/certification/Test_TC_DESC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DESC_2_1.yaml @@ -142,95 +142,95 @@ tests: Verify ServerList entries on the TH (Chip-tool) and below is the sample log provided for the raspi platform, - [1707996554.409850][20755:20757] CHIP:DMG: } - [1707996554.410814][20755:20757] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_001D Attribute 0x0000_0001 DataVersion: 3583190746 - [1707996554.410955][20755:20757] CHIP:TOO: ServerList: 71 entries - [1707996554.410990][20755:20757] CHIP:TOO: [1]: 3 - [1707996554.411002][20755:20757] CHIP:TOO: [2]: 4 - [1707996554.411013][20755:20757] CHIP:TOO: [3]: 6 - [1707996554.411024][20755:20757] CHIP:TOO: [4]: 7 - [1707996554.411034][20755:20757] CHIP:TOO: [5]: 8 - [1707996554.411045][20755:20757] CHIP:TOO: [6]: 15 - [1707996554.411056][20755:20757] CHIP:TOO: [7]: 29 - [1707996554.411067][20755:20757] CHIP:TOO: [8]: 30 - [1707996554.411078][20755:20757] CHIP:TOO: [9]: 37 - [1707996554.411092][20755:20757] CHIP:TOO: [10]: 47 - [1707996554.411103][20755:20757] CHIP:TOO: [11]: 59 - [1707996554.411113][20755:20757] CHIP:TOO: [12]: 64 - [1707996554.411124][20755:20757] CHIP:TOO: [13]: 65 - [1707996554.411135][20755:20757] CHIP:TOO: [14]: 69 - [1707996554.411146][20755:20757] CHIP:TOO: [15]: 72 - [1707996554.411156][20755:20757] CHIP:TOO: [16]: 73 - [1707996554.411167][20755:20757] CHIP:TOO: [17]: 74 - [1707996554.411177][20755:20757] CHIP:TOO: [18]: 80 - [1707996554.411188][20755:20757] CHIP:TOO: [19]: 81 - [1707996554.411199][20755:20757] CHIP:TOO: [20]: 82 - [1707996554.411209][20755:20757] CHIP:TOO: [21]: 83 - [1707996554.411220][20755:20757] CHIP:TOO: [22]: 84 - [1707996554.411231][20755:20757] CHIP:TOO: [23]: 85 - [1707996554.411240][20755:20757] CHIP:TOO: [24]: 86 - [1707996554.411251][20755:20757] CHIP:TOO: [25]: 87 - [1707996554.411261][20755:20757] CHIP:TOO: [26]: 89 - [1707996554.411271][20755:20757] CHIP:TOO: [27]: 91 - [1707996554.411282][20755:20757] CHIP:TOO: [28]: 92 - [1707996554.411293][20755:20757] CHIP:TOO: [29]: 93 - [1707996554.411303][20755:20757] CHIP:TOO: [30]: 94 - [1707996554.411313][20755:20757] CHIP:TOO: [31]: 96 - [1707996554.411323][20755:20757] CHIP:TOO: [32]: 97 - [1707996554.411334][20755:20757] CHIP:TOO: [33]: 98 - [1707996554.411345][20755:20757] CHIP:TOO: [34]: 113 - [1707996554.411355][20755:20757] CHIP:TOO: [35]: 114 - [1707996554.411367][20755:20757] CHIP:TOO: [36]: 128 - [1707996554.411376][20755:20757] CHIP:TOO: [37]: 129 - [1707996554.411387][20755:20757] CHIP:TOO: [38]: 144 - [1707996554.411396][20755:20757] CHIP:TOO: [39]: 145 - [1707996554.411406][20755:20757] CHIP:TOO: [40]: 152 - [1707996554.411417][20755:20757] CHIP:TOO: [41]: 153 - [1707996554.411427][20755:20757] CHIP:TOO: [42]: 157 - [1707996554.411437][20755:20757] CHIP:TOO: [43]: 159 - [1707996554.411449][20755:20757] CHIP:TOO: [44]: 258 - [1707996554.411459][20755:20757] CHIP:TOO: [45]: 259 - [1707996554.411469][20755:20757] CHIP:TOO: [46]: 512 - [1707996554.411480][20755:20757] CHIP:TOO: [47]: 513 - [1707996554.411490][20755:20757] CHIP:TOO: [48]: 514 - [1707996554.411500][20755:20757] CHIP:TOO: [49]: 516 - [1707996554.411511][20755:20757] CHIP:TOO: [50]: 768 - [1707996554.411521][20755:20757] CHIP:TOO: [51]: 769 - [1707996554.411532][20755:20757] CHIP:TOO: [52]: 1024 - [1707996554.411559][20755:20757] CHIP:TOO: [53]: 1026 - [1707996554.411562][20755:20757] CHIP:TOO: [54]: 1027 - [1707996554.411565][20755:20757] CHIP:TOO: [55]: 1028 - [1707996554.411568][20755:20757] CHIP:TOO: [56]: 1029 - [1707996554.411571][20755:20757] CHIP:TOO: [57]: 1030 - [1707996554.411575][20755:20757] CHIP:TOO: [58]: 1036 - [1707996554.411578][20755:20757] CHIP:TOO: [59]: 1037 - [1707996554.411581][20755:20757] CHIP:TOO: [60]: 1043 - [1707996554.411584][20755:20757] CHIP:TOO: [61]: 1045 - [1707996554.411587][20755:20757] CHIP:TOO: [62]: 1066 - [1707996554.411589][20755:20757] CHIP:TOO: [63]: 1067 - [1707996554.411592][20755:20757] CHIP:TOO: [64]: 1068 - [1707996554.411595][20755:20757] CHIP:TOO: [65]: 1069 - [1707996554.411598][20755:20757] CHIP:TOO: [66]: 1070 - [1707996554.411601][20755:20757] CHIP:TOO: [67]: 1071 - [1707996554.411604][20755:20757] CHIP:TOO: [68]: 1283 - [1707996554.411607][20755:20757] CHIP:TOO: [69]: 1288 - [1707996554.411610][20755:20757] CHIP:TOO: [70]: 2820 - [1707996554.411613][20755:20757] CHIP:TOO: [71]: 4294048773 + [1707996554.409850][20755:20757] [DMG] } + [1707996554.410814][20755:20757] [TOO] Endpoint: 1 Cluster: 0x0000_001D Attribute 0x0000_0001 DataVersion: 3583190746 + [1707996554.410955][20755:20757] [TOO] ServerList: 71 entries + [1707996554.410990][20755:20757] [TOO] [1]: 3 (Identify) + [1707996554.411002][20755:20757] [TOO] [2]: 4 (Groups) + [1707996554.411013][20755:20757] [TOO] [3]: 6 (OnOff) + [1707996554.411024][20755:20757] [TOO] [4]: 7 (OnOffSwitchConfiguration) + [1707996554.411034][20755:20757] [TOO] [5]: 8 (LevelControl) + [1707996554.411045][20755:20757] [TOO] [6]: 15 (BinaryInputBasic) + [1707996554.411056][20755:20757] [TOO] [7]: 29 (Descriptor) + [1707996554.411067][20755:20757] [TOO] [8]: 30 (Binding) + [1707996554.411078][20755:20757] [TOO] [9]: 37 (Actions) + [1707996554.411092][20755:20757] [TOO] [10]: 47 (PowerSource) + [1707996554.411103][20755:20757] [TOO] [11]: 59 (Switch) + [1707996554.411113][20755:20757] [TOO] [12]: 64 (FixedLabel) + [1707996554.411124][20755:20757] [TOO] [13]: 65 (UserLabel) + [1707996554.411135][20755:20757] [TOO] [14]: 69 (BooleanState) + [1707996554.411146][20755:20757] [TOO] [15]: 72 (OvenCavityOperationalState) + [1707996554.411156][20755:20757] [TOO] [16]: 73 (OvenMode) + [1707996554.411167][20755:20757] [TOO] [17]: 74 (LaundryDryerControls) + [1707996554.411177][20755:20757] [TOO] [18]: 80 (ModeSelect) + [1707996554.411188][20755:20757] [TOO] [19]: 81 (LaundryWasherMode) + [1707996554.411199][20755:20757] [TOO] [20]: 82 (RefrigeratorAndTemperatureControlledCabinetMode) + [1707996554.411209][20755:20757] [TOO] [21]: 83 (LaundryWasherControls) + [1707996554.411220][20755:20757] [TOO] [22]: 84 (RvcRunMode) + [1707996554.411231][20755:20757] [TOO] [23]: 85 (RvcCleanMode) + [1707996554.411240][20755:20757] [TOO] [24]: 86 (TemperatureControl) + [1707996554.411251][20755:20757] [TOO] [25]: 87 (RefrigeratorAlarm) + [1707996554.411261][20755:20757] [TOO] [26]: 89 (DishwasherMode) + [1707996554.411271][20755:20757] [TOO] [27]: 91 (AirQuality) + [1707996554.411282][20755:20757] [TOO] [28]: 92 (SmokeCoAlarm) + [1707996554.411293][20755:20757] [TOO] [29]: 93 (DishwasherAlarm) + [1707996554.411303][20755:20757] [TOO] [30]: 94 (MicrowaveOvenMode) + [1707996554.411313][20755:20757] [TOO] [31]: 96 (OperationalState) + [1707996554.411323][20755:20757] [TOO] [32]: 97 (RvcOperationalState) + [1707996554.411334][20755:20757] [TOO] [33]: 98 (ScenesManagement) + [1707996554.411345][20755:20757] [TOO] [34]: 113 (HepaFilterMonitoring) + [1707996554.411355][20755:20757] [TOO] [35]: 114 (ActivatedCarbonFilterMonitoring) + [1707996554.411367][20755:20757] [TOO] [36]: 128 (BooleanStateConfiguration) + [1707996554.411376][20755:20757] [TOO] [37]: 129 (ValveConfigurationAndControl) + [1707996554.411387][20755:20757] [TOO] [38]: 144 (ElectricalPowerMeasurement) + [1707996554.411396][20755:20757] [TOO] [39]: 145 (ElectricalEnergyMeasurement) + [1707996554.411406][20755:20757] [TOO] [40]: 152 (DeviceEnergyManagement) + [1707996554.411417][20755:20757] [TOO] [41]: 153 (EnergyEvse) + [1707996554.411427][20755:20757] [TOO] [42]: 157 (EnergyEvseMode) + [1707996554.411437][20755:20757] [TOO] [43]: 159 (DeviceEnergyManagementMode) + [1707996554.411449][20755:20757] [TOO] [44]: 258 (WindowCovering) + [1707996554.411459][20755:20757] [TOO] [45]: 259 (BarrierControl) + [1707996554.411469][20755:20757] [TOO] [46]: 512 (PumpConfigurationAndControl) + [1707996554.411480][20755:20757] [TOO] [47]: 513 (Thermostat) + [1707996554.411490][20755:20757] [TOO] [48]: 514 (FanControl) + [1707996554.411500][20755:20757] [TOO] [49]: 516 (ThermostatUserInterfaceConfiguration) + [1707996554.411511][20755:20757] [TOO] [50]: 768 (ColorControl) + [1707996554.411521][20755:20757] [TOO] [51]: 769 (BallastConfiguration) + [1707996554.411532][20755:20757] [TOO] [52]: 1024 (IlluminanceMeasurement) + [1707996554.411559][20755:20757] [TOO] [53]: 1026 (TemperatureMeasurement) + [1707996554.411562][20755:20757] [TOO] [54]: 1027 (PressureMeasurement) + [1707996554.411565][20755:20757] [TOO] [55]: 1028 (FlowMeasurement) + [1707996554.411568][20755:20757] [TOO] [56]: 1029 (RelativeHumidityMeasurement) + [1707996554.411571][20755:20757] [TOO] [57]: 1030 (OccupancySensing) + [1707996554.411575][20755:20757] [TOO] [58]: 1036 (CarbonMonoxideConcentrationMeasurement) + [1707996554.411578][20755:20757] [TOO] [59]: 1037 (CarbonDioxideConcentrationMeasurement) + [1707996554.411581][20755:20757] [TOO] [60]: 1043 (NitrogenDioxideConcentrationMeasurement) + [1707996554.411584][20755:20757] [TOO] [61]: 1045 (OzoneConcentrationMeasurement) + [1707996554.411587][20755:20757] [TOO] [62]: 1066 (Pm25ConcentrationMeasurement) + [1707996554.411589][20755:20757] [TOO] [63]: 1067 (FormaldehydeConcentrationMeasurement) + [1707996554.411592][20755:20757] [TOO] [64]: 1068 (Pm1ConcentrationMeasurement) + [1707996554.411595][20755:20757] [TOO] [65]: 1069 (Pm10ConcentrationMeasurement) + [1707996554.411598][20755:20757] [TOO] [66]: 1070 (TotalVolatileOrganicCompoundsConcentrationMeasurement) + [1707996554.411601][20755:20757] [TOO] [67]: 1071 (RadonConcentrationMeasurement) + [1707996554.411604][20755:20757] [TOO] [68]: 1283 (WakeOnLan) + [1707996554.411607][20755:20757] [TOO] [69]: 1288 (LowPower) + [1707996554.411610][20755:20757] [TOO] [70]: 2820 (ElectricalMeasurement) + [1707996554.411613][20755:20757] [TOO] [71]: 4294048773 (UnitTesting) ./chip-tool descriptor read server-list 1 2 Verify ServerList entries on TH (Chip-tool) Log and below is the sample log provided for the raspi platform, Here ServerList entries are 7. - [1692618559.962829][31688:31690] CHIP:TOO: Endpoint: 2 Cluster: 0x0000_001D Attribute 0x0000_0001 DataVersion: 1103199808 - [1692618559.962884][31688:31690] CHIP:TOO: ServerList: 7 entries - [1692618559.962910][31688:31690] CHIP:TOO: [1]: 3 - [1692618559.962922][31688:31690] CHIP:TOO: [2]: 4 - [1692618559.962933][31688:31690] CHIP:TOO: [3]: 5 - [1692618559.962945][31688:31690] CHIP:TOO: [4]: 6 - [1692618559.962955][31688:31690] CHIP:TOO: [5]: 29 - [1692618559.962966][31688:31690] CHIP:TOO: [6]: 47 - [1692618559.962978][31688:31690] CHIP:TOO: [7]: 1030 + [1692618559.962829][31688:31690] [TOO] Endpoint: 2 Cluster: 0x0000_001D Attribute 0x0000_0001 DataVersion: 1103199808 + [1692618559.962884][31688:31690] [TOO] ServerList: 7 entries + [1692618559.962910][31688:31690] [TOO] [1]: 3 (Identify) + [1692618559.962922][31688:31690] [TOO] [2]: 4 (Groups) + [1692618559.962933][31688:31690] [TOO] [3]: 5 (Unknown) + [1692618559.962945][31688:31690] [TOO] [4]: 6 (OnOff) + [1692618559.962955][31688:31690] [TOO] [5]: 29 (Descriptor) + [1692618559.962966][31688:31690] [TOO] [6]: 47 (PowerSource) + [1692618559.962978][31688:31690] [TOO] [7]: 1030 (OccupancySensing) disabled: true - label: "Step 3: TH reads 'ClientList' attribute" @@ -244,17 +244,17 @@ tests: Verify client list entries on the TH (Chip-tool) and below is the sample log provided for the raspi platform, Here ClientList entries are 1. - [1676367470.160199][9805:9807] CHIP:DMG: } - [1676367470.160268][9805:9807] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_001D Attribute 0x0000_0002 DataVersion: 3336430903 - [1676367470.160282][9805:9807] CHIP:TOO: ClientList: 1 entries - [1676367470.160289][9805:9807] CHIP:TOO: [1]: 6 + [1676367470.160199][9805:9807] [DMG] } + [1676367470.160268][9805:9807] [TOO] Endpoint: 1 Cluster: 0x0000_001D Attribute 0x0000_0002 DataVersion: 3336430903 + [1676367470.160282][9805:9807] [TOO] ClientList: 1 entries + [1676367470.160289][9805:9807] [TOO] [1]: 6 (OnOff) ./chip-tool descriptor read client-list 1 2 Verify client list entries on the TH (Chip-tool) and below is the sample log provided for the raspi platform, Here ClientList entries are 0. - [1660146160.390200][46818:46823] CHIP:TOO: Endpoint: 2 Cluster: 0x0000_001D Attribute 0x0000_0002 DataVersion: 1051414887 - [1660146160.390211][46818:46823] CHIP:TOO: ClientList: 0 entries + [1660146160.390200][46818:46823] [TOO] Endpoint: 2 Cluster: 0x0000_001D Attribute 0x0000_0002 DataVersion: 1051414887 + [1660146160.390211][46818:46823] [TOO] ClientList: 0 entries disabled: true - label: "Step 4: TH reads 'PartsList' attribute." diff --git a/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml index 6b4f2c7e7df9a9..7c00f74535fd7d 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml @@ -81,33 +81,33 @@ tests: On the TH(chip-tool) verify the received report data message has only the attributes that the TH has privilege to. - [1655727546.354466][5286:5291] CHIP:DMG: - [1655727546.354512][5286:5291] CHIP:DMG: SuppressResponse = true, - [1655727546.354538][5286:5291] CHIP:DMG: InteractionModelRevision = 1 - [1655727546.354580][5286:5291] CHIP:DMG: } - [1655727546.355252][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 1545325355 - [1655727546.355324][5286:5291] CHIP:TOO: identify time: 0 - [1655727546.355386][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 1545325355 - [1655727546.355414][5286:5291] CHIP:TOO: identify type: 2 - [1655727546.355470][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFC DataVersion: 1545325355 - [1655727546.355524][5286:5291] CHIP:TOO: FeatureMap: 0 - [1655727546.355606][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 1545325355 - [1655727546.355635][5286:5291] CHIP:TOO: ClusterRevision: 4 - [1655727546.355788][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 1545325355 - [1655727546.355845][5286:5291] CHIP:TOO: GeneratedCommandList: 0 entries - [1655727546.356030][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 1545325355 - [1655727546.356087][5286:5291] CHIP:TOO: AcceptedCommandList: 2 entries - [1655727546.356117][5286:5291] CHIP:TOO: [1]: 0 - [1655727546.356143][5286:5291] CHIP:TOO: [2]: 64 - [1655727546.356552][5286:5291] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 1545325355 - [1655727546.356590][5286:5291] CHIP:TOO: AttributeList: 7 entries - [1655727546.356617][5286:5291] CHIP:TOO: [1]: 0 - [1655727546.356642][5286:5291] CHIP:TOO: [2]: 1 - [1655727546.356667][5286:5291] CHIP:TOO: [3]: 65528 - [1655727546.356692][5286:5291] CHIP:TOO: [4]: 65529 - [1655727546.356716][5286:5291] CHIP:TOO: [5]: 65531 - [1655727546.356741][5286:5291] CHIP:TOO: [6]: 65532 - [1655727546.356766][5286:5291] CHIP:TOO: [7]: 65533 + [1723642164.392] [329152:329154] [DMG] + [1723642164.392] [329152:329154] [DMG] SuppressResponse = true, + [1723642164.392] [329152:329154] [DMG] InteractionModelRevision = 11 + [1723642164.392] [329152:329154] [DMG] } + [1723642164.392] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 357555707 + [1723642164.392] [329152:329154] [TOO] IdentifyTime: 0 + [1723642164.392] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 357555707 + [1723642164.392] [329152:329154] [TOO] IdentifyType: 2 + [1723642164.392] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFC DataVersion: 357555707 + [1723642164.392] [329152:329154] [TOO] FeatureMap: 0 + [1723642164.392] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 357555707 + [1723642164.392] [329152:329154] [TOO] ClusterRevision: 4 + [1723642164.393] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 357555707 + [1723642164.393] [329152:329154] [TOO] GeneratedCommandList: 0 entries + [1723642164.393] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 357555707 + [1723642164.393] [329152:329154] [TOO] AcceptedCommandList: 2 entries + [1723642164.393] [329152:329154] [TOO] [1]: 0 (Identify) + [1723642164.393] [329152:329154] [TOO] [2]: 64 (TriggerEffect) + [1723642164.393] [329152:329154] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 357555707 + [1723642164.393] [329152:329154] [TOO] AttributeList: 7 entries + [1723642164.393] [329152:329154] [TOO] [1]: 0 (IdentifyTime) + [1723642164.393] [329152:329154] [TOO] [2]: 1 (IdentifyType) + [1723642164.393] [329152:329154] [TOO] [3]: 65528 (GeneratedCommandList) + [1723642164.393] [329152:329154] [TOO] [4]: 65529 (AcceptedCommandList) + [1723642164.393] [329152:329154] [TOO] [5]: 65531 (AttributeList) + [1723642164.393] [329152:329154] [TOO] [6]: 65532 (FeatureMap) + [1723642164.393] [329152:329154] [TOO] [7]: 65533 (ClusterRevision) disabled: true - label: @@ -272,7 +272,7 @@ tests: disabled: true - label: - "Step 7: TH sends the Read Request Message to the DUT to read all + "Step 7: TH sends the Read Requ`est Message to the DUT to read all attributes from a cluster at all Endpoints AttributePath = [[Cluster = Specific ClusterID]] On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to @@ -284,52 +284,52 @@ tests: On the TH(chip-tool) verify the received report data message has all the right attribute values for above command - [1653629930.057852][8778:8783] CHIP:DMG: } - [1653629930.058739][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 2065044836 - [1653629930.058788][8778:8783] CHIP:TOO: identify time: 0 - [1653629930.058889][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 2065044836 - [1653629930.058919][8778:8783] CHIP:TOO: identify type: 2 - [1653629930.058980][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 2065044836 - [1653629930.058998][8778:8783] CHIP:TOO: ClusterRevision: 4 - [1653629930.059191][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 2065044836 - [1653629930.059220][8778:8783] CHIP:TOO: GeneratedCommandList: 1 entries - [1653629930.059239][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.059478][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 2065044836 - [1653629930.059503][8778:8783] CHIP:TOO: AcceptedCommandList: 3 entries - [1653629930.059519][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.059532][8778:8783] CHIP:TOO: [2]: 1 - [1653629930.059546][8778:8783] CHIP:TOO: [3]: 64 - [1653629930.059945][8778:8783] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 2065044836 - [1653629930.059974][8778:8783] CHIP:TOO: AttributeList: 6 entries - [1653629930.059989][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.060002][8778:8783] CHIP:TOO: [2]: 1 - [1653629930.060015][8778:8783] CHIP:TOO: [3]: 65528 - [1653629930.060032][8778:8783] CHIP:TOO: [4]: 65529 - [1653629930.060048][8778:8783] CHIP:TOO: [5]: 65531 - [1653629930.060064][8778:8783] CHIP:TOO: [6]: 65533 - [1653629930.060077][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435651 - [1653629930.060095][8778:8783] CHIP:TOO: identify time: 0 - [1653629930.060151][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435651 - [1653629930.060167][8778:8783] CHIP:TOO: identify type: 2 - [1653629930.060224][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435651 - [1653629930.060240][8778:8783] CHIP:TOO: ClusterRevision: 4 - [1653629930.060411][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435651 - [1653629930.060433][8778:8783] CHIP:TOO: GeneratedCommandList: 1 entries - [1653629930.060448][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.060671][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435651 - [1653629930.060695][8778:8783] CHIP:TOO: AcceptedCommandList: 3 entries - [1653629930.060710][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.060722][8778:8783] CHIP:TOO: [2]: 1 - [1653629930.060735][8778:8783] CHIP:TOO: [3]: 64 - [1653629930.061086][8778:8783] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435651 - [1653629930.061114][8778:8783] CHIP:TOO: AttributeList: 6 entries - [1653629930.061129][8778:8783] CHIP:TOO: [1]: 0 - [1653629930.061141][8778:8783] CHIP:TOO: [2]: 1 - [1653629930.061154][8778:8783] CHIP:TOO: [3]: 65528 - [1653629930.061167][8778:8783] CHIP:TOO: [4]: 65529 - [1653629930.061184][8778:8783] CHIP:TOO: [5]: 65531 - [1653629930.061201][8778:8783] CHIP:TOO: [6]: 65533 - [1653629930.061435][8778:8783] CHIP:EM: Sending Standalone Ack for MessageCounter:5968688 on exchange 11683i + [1653629930.057] [8778:8783] [DMG] } + [1653629930.058] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 2065044836 + [1653629930.058] [8778:8783] [TOO] identify time: 0 + [1653629930.058] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 2065044836 + [1653629930.058] [8778:8783] [TOO] identify type: 2 + [1653629930.058] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 2065044836 + [1653629930.058] [8778:8783] [TOO] ClusterRevision: 4 + [1653629930.059] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 2065044836 + [1653629930.059] [8778:8783] [TOO] GeneratedCommandList: 1 entries + [1653629930.059] [8778:8783] [TOO] [1]: 0 (Identify) + [1653629930.059] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 2065044836 + [1653629930.059] [8778:8783] [TOO] AcceptedCommandList: 3 entries + [1653629930.059] [8778:8783] [TOO] [1]: 0 (Identify) + [1653629930.059] [8778:8783] [TOO] [2]: 1 (Unknown) + [1653629930.059] [8778:8783] [TOO] [3]: 64 (TriggerEffect) + [1653629930.059] [8778:8783] [TOO] Endpoint: 0 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 2065044836 + [1653629930.059] [8778:8783] [TOO] AttributeList: 6 entries + [1653629930.059] [8778:8783] [TOO] [1]: 0 (IdentifyTime) + [1653629930.060] [8778:8783] [TOO] [2]: 1 (IdentifyType) + [1653629930.060] [8778:8783] [TOO] [3]: 65528 (GeneratedCommandList) + [1653629930.060] [8778:8783] [TOO] [4]: 65529 (AcceptedCommandList) + [1653629930.060] [8778:8783] [TOO] [5]: 65531 (AttributeList) + [1653629930.060] [8778:8783] [TOO] [6]: 65533 (ClusterRevision) + [1653629930.060] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435651 + [1653629930.060] [8778:8783] [TOO] identify time: 0 + [1653629930.060] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435651 + [1653629930.060] [8778:8783] [TOO] identify type: 2 + [1653629930.060] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435651 + [1653629930.060] [8778:8783] [TOO] ClusterRevision: 4 + [1653629930.060] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435651 + [1653629930.060] [8778:8783] [TOO] GeneratedCommandList: 1 entries + [1653629930.060] [8778:8783] [TOO] [1]: 0 (Identify) + [1653629930.060] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435651 + [1653629930.060] [8778:8783] [TOO] AcceptedCommandList: 3 entries + [1653629930.060] [8778:8783] [TOO] [1]: 0 (Identify) + [1653629930.060] [8778:8783] [TOO] [2]: 1 (Unknown) + [1653629930.060] [8778:8783] [TOO] [3]: 64 (TriggerEffect) + [1653629930.061] [8778:8783] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435651 + [1653629930.061] [8778:8783] [TOO] AttributeList: 6 entries + [1653629930.061] [8778:8783] [TOO] [1]: 0 (IdentifyTime) + [1653629930.061] [8778:8783] [TOO] [2]: 1 (IdentifyType) + [1653629930.061] [8778:8783] [TOO] [3]: 65528 (GeneratedCommandList) + [1653629930.061] [8778:8783] [TOO] [4]: 65529 (AcceptedCommandList) + [1653629930.061] [8778:8783] [TOO] [5]: 65531 (AttributeList) + [1653629930.061] [8778:8783] [TOO] [6]: 65533 (ClusterRevision) + [1653629930.061] [8778:8783] [EM] Sending Standalone Ack for MessageCounter:5968688 on exchange 11683i disabled: true - label: @@ -825,30 +825,29 @@ tests: Verify on TH(chip-tool), DUT is responds right attribute value for below command - [1653633965.092996][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435654 - [1653633965.093041][9835:9840] CHIP:TOO: identify time: 0 - [1653633965.093120][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435654 - [1653633965.093140][9835:9840] CHIP:TOO: identify type: 2 - [1653633965.093202][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435654 - [1653633965.093221][9835:9840] CHIP:TOO: ClusterRevision: 4 - [1653633965.093411][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435654 - [1653633965.093451][9835:9840] CHIP:TOO: GeneratedCommandList: 1 entries - [1653633965.093474][9835:9840] CHIP:TOO: [1]: 0 - [1653633965.093721][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435654 - [1653633965.093748][9835:9840] CHIP:TOO: AcceptedCommandList: 3 entries - [1653633965.093767][9835:9840] CHIP:TOO: [1]: 0 - [1653633965.093784][9835:9840] CHIP:TOO: [2]: 1 - [1653633965.093800][9835:9840] CHIP:TOO: [3]: 64 - [1653633965.094169][9835:9840] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435654 - [1653633965.094200][9835:9840] CHIP:TOO: AttributeList: 6 entries - [1653633965.094218][9835:9840] CHIP:TOO: [1]: 0 - [1653633965.094235][9835:9840] CHIP:TOO: [2]: 1 - [1653633965.094252][9835:9840] CHIP:TOO: [3]: 65528 - [1653633965.094269][9835:9840] CHIP:TOO: [4]: 65529 - [1653633965.094286][9835:9840] CHIP:TOO: [5]: 65531 - [1653633965.094302][9835:9840] CHIP:TOO: [6]: 65533 - [1653633965.094449][9835:9840] CHIP:EM: Sending Standalone Ack for MessageCounter:14221655 on exchange 17356i - + [1653633965.092996][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435654 + [1653633965.093041][9835:9840] [TOO] identify time: 0 + [1653633965.093120][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435654 + [1653633965.093140][9835:9840] [TOO] identify type: 2 + [1653633965.093202][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435654 + [1653633965.093221][9835:9840] [TOO] ClusterRevision: 4 + [1653633965.093411][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435654 + [1653633965.093451][9835:9840] [TOO] GeneratedCommandList: 1 entries + [1653633965.093474][9835:9840] [TOO] [1]: 0 (Identify) + [1653633965.093721][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435654 + [1653633965.093748][9835:9840] [TOO] AcceptedCommandList: 3 entries + [1653633965.093767][9835:9840] [TOO] [1]: 0 (Identify) + [1653633965.093784][9835:9840] [TOO] [2]: 1 (Unknown) + [1653633965.093800][9835:9840] [TOO] [3]: 64 (TriggerEffect) + [1653633965.094169][9835:9840] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435654 + [1653633965.094200][9835:9840] [TOO] AttributeList: 6 entries + [1653633965.094218][9835:9840] [TOO] [1]: 0 (IdentifyTime) + [1653633965.094235][9835:9840] [TOO] [2]: 1 (IdentifyType) + [1653633965.094252][9835:9840] [TOO] [3]: 65528 (GeneratedCommandList) + [1653633965.094269][9835:9840] [TOO] [4]: 65529 (AcceptedCommandList) + [1653633965.094286][9835:9840] [TOO] [5]: 65531 (AttributeList) + [1653633965.094302][9835:9840] [TOO] [6]: 65533 (ClusterRevision) + [1653633965.094449][9835:9840] [EM] Sending Standalone Ack for MessageCounter:14221655 on exchange 17356i ./chip-tool any write-by-id 0x03 0x00 2 1 1 @@ -884,29 +883,29 @@ tests: ./chip-tool any read-by-id 0x03 0xFFFFFFFF 1 1 --data-version 0xd7cb76c6 - [1653634117.935268][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435657 - [1653634117.935294][9878:9883] CHIP:TOO: identify time: 0 - [1653634117.935322][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435657 - [1653634117.935331][9878:9883] CHIP:TOO: identify type: 2 - [1653634117.935357][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435657 - [1653634117.935366][9878:9883] CHIP:TOO: ClusterRevision: 4 - [1653634117.935452][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435657 - [1653634117.935470][9878:9883] CHIP:TOO: GeneratedCommandList: 1 entries - [1653634117.935480][9878:9883] CHIP:TOO: [1]: 0 - [1653634117.935589][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435657 - [1653634117.935601][9878:9883] CHIP:TOO: AcceptedCommandList: 3 entries - [1653634117.935609][9878:9883] CHIP:TOO: [1]: 0 - [1653634117.935616][9878:9883] CHIP:TOO: [2]: 1 - [1653634117.935623][9878:9883] CHIP:TOO: [3]: 64 - [1653634117.935788][9878:9883] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435657 - [1653634117.935802][9878:9883] CHIP:TOO: AttributeList: 6 entries - [1653634117.935809][9878:9883] CHIP:TOO: [1]: 0 - [1653634117.935817][9878:9883] CHIP:TOO: [2]: 1 - [1653634117.935824][9878:9883] CHIP:TOO: [3]: 65528 - [1653634117.935831][9878:9883] CHIP:TOO: [4]: 65529 - [1653634117.935838][9878:9883] CHIP:TOO: [5]: 65531 - [1653634117.935845][9878:9883] CHIP:TOO: [6]: 65533 - [1653634117.935910][9878:9883] CHIP:EM: Sending Standalone Ack for MessageCounter:531776 on exchange 45674i + [1653634117.935268][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435657 + [1653634117.935294][9878:9883] [TOO] identify time: 0 + [1653634117.935322][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435657 + [1653634117.935331][9878:9883] [TOO] identify type: 2 + [1653634117.935357][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435657 + [1653634117.935366][9878:9883] [TOO] ClusterRevision: 4 + [1653634117.935452][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435657 + [1653634117.935470][9878:9883] [TOO] GeneratedCommandList: 1 entries + [1653634117.935480][9878:9883] [TOO] [1]: 0 (Identify) + [1653634117.935589][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435657 + [1653634117.935601][9878:9883] [TOO] AcceptedCommandList: 3 entries + [1653634117.935609][9878:9883] [TOO] [1]: 0 (Identify) + [1653634117.935616][9878:9883] [TOO] [2]: 1 (Unknown) + [1653634117.935623][9878:9883] [TOO] [3]: 64 (TriggerEffect) + [1653634117.935788][9878:9883] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435657 + [1653634117.935802][9878:9883] [TOO] AttributeList: 6 entries + [1653634117.935809][9878:9883] [TOO] [1]: 0 (IdentifyTime) + [1653634117.935817][9878:9883] [TOO] [2]: 1 (IdentifyType) + [1653634117.935824][9878:9883] [TOO] [3]: 65528 (GeneratedCommandList) + [1653634117.935831][9878:9883] [TOO] [4]: 65529 (AcceptedCommandList) + [1653634117.935838][9878:9883] [TOO] [5]: 65531 (AttributeList) + [1653634117.935845][9878:9883] [TOO] [6]: 65533 (ClusterRevision) + [1653634117.935910][9878:9883] [EM] Sending Standalone Ack for MessageCounter:531776 on exchange 45674i disabled: true - label: @@ -1000,55 +999,55 @@ tests: ./chip-tool any read-by-id 0x03 0xFFFFFFFF 1 1 - [1653634446.678378][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435660 - [1653634446.678404][9962:9967] CHIP:TOO: identify time: 0 - [1653634446.678437][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435660 - [1653634446.678447][9962:9967] CHIP:TOO: identify type: 2 - [1653634446.678474][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435660 - [1653634446.678483][9962:9967] CHIP:TOO: ClusterRevision: 4 - [1653634446.678570][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435660 - [1653634446.678584][9962:9967] CHIP:TOO: GeneratedCommandList: 1 entries - [1653634446.678594][9962:9967] CHIP:TOO: [1]: 0 - [1653634446.678767][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435660 - [1653634446.678780][9962:9967] CHIP:TOO: AcceptedCommandList: 3 entries - [1653634446.678789][9962:9967] CHIP:TOO: [1]: 0 - [1653634446.678796][9962:9967] CHIP:TOO: [2]: 1 - [1653634446.678805][9962:9967] CHIP:TOO: [3]: 64 - [1653634446.678998][9962:9967] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435660 - [1653634446.679017][9962:9967] CHIP:TOO: AttributeList: 6 entries - [1653634446.679024][9962:9967] CHIP:TOO: [1]: 0 - [1653634446.679030][9962:9967] CHIP:TOO: [2]: 1 - [1653634446.679036][9962:9967] CHIP:TOO: [3]: 65528 - [1653634446.679042][9962:9967] CHIP:TOO: [4]: 65529 - [1653634446.679048][9962:9967] CHIP:TOO: [5]: 65531 - [1653634446.679055][9962:9967] CHIP:TOO: [6]: 65533 - [1653634446.679129][9962:9967] CHIP:EM: Sending Standalone Ack for MessageCounter:15830359 on exchange 10739i + [1653634446.678378] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0000 DataVersion: 3620435660 + [1653634446.678404] [9962:9967] [TOO] identify time: 0 + [1653634446.678437] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_0001 DataVersion: 3620435660 + [1653634446.678447] [9962:9967] [TOO] identify type: 2 + [1653634446.678474] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFD DataVersion: 3620435660 + [1653634446.678483] [9962:9967] [TOO] ClusterRevision: 4 + [1653634446.678570] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF8 DataVersion: 3620435660 + [1653634446.678584] [9962:9967] [TOO] GeneratedCommandList: 1 entries + [1653634446.678594] [9962:9967] [TOO] [1]: 0 (Identify) + [1653634446.678767] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFF9 DataVersion: 3620435660 + [1653634446.678780] [9962:9967] [TOO] AcceptedCommandList: 3 entries + [1653634446.678789] [9962:9967] [TOO] [1]: 0 (Identify) + [1653634446.678796] [9962:9967] [TOO] [2]: 1 (Unknown) + [1653634446.678805] [9962:9967] [TOO] [3]: 64 (TriggerEffect) + [1653634446.678998] [9962:9967] [TOO] Endpoint: 1 Cluster: 0x0000_0003 Attribute 0x0000_FFFB DataVersion: 3620435660 + [1653634446.679017] [9962:9967] [TOO] AttributeList: 6 entries + [1653634446.679024] [9962:9967] [TOO] [1]: 0 (IdentifyTime) + [1653634446.679030] [9962:9967] [TOO] [2]: 1 (IdentifyType) + [1653634446.679036] [9962:9967] [TOO] [3]: 65528 (GeneratedCommandList) + [1653634446.679042] [9962:9967] [TOO] [4]: 65529 (AcceptedCommandList) + [1653634446.679048] [9962:9967] [TOO] [5]: 65531 (AttributeList) + [1653634446.679055] [9962:9967] [TOO] [6]: 65533 (ClusterRevision) + [1653634446.679129] [9962:9967] [EM] Sending Standalone Ack for MessageCounter:15830359 on exchange 10739i ./chip-tool levelcontrol read-by-id 0xFFFFFFFF 1 1 --data-version 0xd7cb76cc (Here given data version received for identify cluster) - [1653634568.902390][9990:9995] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_FFFB DataVersion: 199562416 - [1653634568.902417][9990:9995] CHIP:TOO: AttributeList: 19 entries - [1653634568.902428][9990:9995] CHIP:TOO: [1]: 0 - [1653634568.902436][9990:9995] CHIP:TOO: [2]: 1 - [1653634568.902444][9990:9995] CHIP:TOO: [3]: 2 - [1653634568.902451][9990:9995] CHIP:TOO: [4]: 3 - [1653634568.902458][9990:9995] CHIP:TOO: [5]: 4 - [1653634568.902466][9990:9995] CHIP:TOO: [6]: 5 - [1653634568.902475][9990:9995] CHIP:TOO: [7]: 6 - [1653634568.902483][9990:9995] CHIP:TOO: [8]: 15 - [1653634568.902490][9990:9995] CHIP:TOO: [9]: 16 - [1653634568.902498][9990:9995] CHIP:TOO: [10]: 17 - [1653634568.902506][9990:9995] CHIP:TOO: [11]: 18 - [1653634568.902513][9990:9995] CHIP:TOO: [12]: 19 - [1653634568.902520][9990:9995] CHIP:TOO: [13]: 20 - [1653634568.902528][9990:9995] CHIP:TOO: [14]: 16384 - [1653634568.902535][9990:9995] CHIP:TOO: [15]: 65528 - [1653634568.902542][9990:9995] CHIP:TOO: [16]: 65529 - [1653634568.902550][9990:9995] CHIP:TOO: [17]: 65531 - [1653634568.902557][9990:9995] CHIP:TOO: [18]: 65532 - [1653634568.902565][9990:9995] CHIP:TOO: [19]: 65533 - [1653634568.902621][9990:9995] CHIP:EM: Sending Standalone Ack for MessageCounter:3712616 on exchange 9501 + [1653634568.902390] [9990:9995] [TOO] Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_FFFB DataVersion: 199562416 + [1653634568.902417] [9990:9995] [TOO] AttributeList: 19 entries + [1653634568.902428] [9990:9995] [TOO] [1]: 0 (CurrentLevel) + [1653634568.902436] [9990:9995] [TOO] [2]: 1 (RemainingTime) + [1653634568.902444] [9990:9995] [TOO] [3]: 2 (MinLevel) + [1653634568.902451] [9990:9995] [TOO] [4]: 3 (MaxLevel) + [1653634568.902458] [9990:9995] [TOO] [5]: 4 (CurrentFrequency) + [1653634568.902466] [9990:9995] [TOO] [6]: 5 (MinFrequency) + [1653634568.902475] [9990:9995] [TOO] [7]: 6 (MaxFrequency) + [1653634568.902483] [9990:9995] [TOO] [8]: 15 (Options) + [1653634568.902490] [9990:9995] [TOO] [9]: 16 (OnOffTransitionTime) + [1653634568.902498] [9990:9995] [TOO] [10]: 17 (OnLevel) + [1653634568.902506] [9990:9995] [TOO] [11]: 18 (OnTransitionTime) + [1653634568.902513] [9990:9995] [TOO] [12]: 19 (OffTransitionTime) + [1653634568.902520] [9990:9995] [TOO] [13]: 20 (DefaultMoveRate) + [1653634568.902528] [9990:9995] [TOO] [14]: 16384 (StartUpCurrentLevel) + [1653634568.902535] [9990:9995] [TOO] [15]: 65528 (GeneratedCommandList) + [1653634568.902542] [9990:9995] [TOO] [16]: 65529 (AcceptedCommandList) + [1653634568.902550] [9990:9995] [TOO] [17]: 65531 (AttributeList) + [1653634568.902557] [9990:9995] [TOO] [18]: 65532 (FeatureMap) + [1653634568.902565] [9990:9995] [TOO] [19]: 65533 (ClusterRevision) + [1653634568.902621] [9990:9995] [EM] Sending Standalone Ack for MessageCounter:3712616 on exchange 9501 disabled: true - label: @@ -1166,53 +1165,52 @@ tests: Verify that there are no errors sent back for attributes the TH has no access to. - [1659422360.478947][2049:2054] CHIP:DMG: } - [1659422360.479556][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0000 DataVersion: 3949809681 - [1659422360.479619][2049:2054] CHIP:TOO: ACL: 1 entries - [1659422360.479679][2049:2054] CHIP:TOO: [1]: { - [1659422360.479706][2049:2054] CHIP:TOO: Privilege: 5 - [1659422360.479729][2049:2054] CHIP:TOO: AuthMode: 2 - [1659422360.479768][2049:2054] CHIP:TOO: Subjects: 2 entries - [1659422360.479819][2049:2054] CHIP:TOO: [1]: 1 - [1659422360.479847][2049:2054] CHIP:TOO: [2]: 112233 - [1659422360.479876][2049:2054] CHIP:TOO: Targets: 1 entries - [1659422360.479925][2049:2054] CHIP:TOO: [1]: { - [1659422360.479969][2049:2054] CHIP:TOO: Cluster: 31 - [1659422360.479993][2049:2054] CHIP:TOO: Endpoint: 0 - [1659422360.480016][2049:2054] CHIP:TOO: DeviceType: null - [1659422360.480038][2049:2054] CHIP:TOO: } - [1659422360.480062][2049:2054] CHIP:TOO: FabricIndex: 1 - [1659422360.480085][2049:2054] CHIP:TOO: } - [1659422360.480165][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0001 DataVersion: 3949809681 - [1659422360.480197][2049:2054] CHIP:TOO: Extension: 0 entries - [1659422360.480225][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0002 DataVersion: 3949809681 - [1659422360.480251][2049:2054] CHIP:TOO: SubjectsPerAccessControlEntry: 4 - [1659422360.480311][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0003 DataVersion: 3949809681 - [1659422360.480337][2049:2054] CHIP:TOO: TargetsPerAccessControlEntry: 3 - [1659422360.480395][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0004 DataVersion: 3949809681 - [1659422360.480421][2049:2054] CHIP:TOO: AccessControlEntriesPerFabric: 3 - [1659422360.480479][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFC DataVersion: 3949809681 - [1659422360.480505][2049:2054] CHIP:TOO: FeatureMap: 0 - [1659422360.480563][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFD DataVersion: 3949809681 - [1659422360.480588][2049:2054] CHIP:TOO: ClusterRevision: 1 - [1659422360.480690][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFF8 DataVersion: 3949809681 - [1659422360.480721][2049:2054] CHIP:TOO: GeneratedCommandList: 0 entries - [1659422360.480789][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFF9 DataVersion: 3949809681 - [1659422360.480818][2049:2054] CHIP:TOO: AcceptedCommandList: 0 entries - [1659422360.481269][2049:2054] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFB DataVersion: 3949809681 - [1659422360.481307][2049:2054] CHIP:TOO: AttributeList: 10 entries - [1659422360.481334][2049:2054] CHIP:TOO: [1]: 0 - [1659422360.481359][2049:2054] CHIP:TOO: [2]: 1 - [1659422360.481383][2049:2054] CHIP:TOO: [3]: 2 - [1659422360.481408][2049:2054] CHIP:TOO: [4]: 3 - [1659422360.481432][2049:2054] CHIP:TOO: [5]: 4 - [1659422360.481457][2049:2054] CHIP:TOO: [6]: 65528 - [1659422360.481482][2049:2054] CHIP:TOO: [7]: 65529 - [1659422360.481506][2049:2054] CHIP:TOO: [8]: 65531 - [1659422360.481531][2049:2054] CHIP:TOO: [9]: 65532 - [1659422360.481556][2049:2054] CHIP:TOO: [10]: 65533 - [1659422360.481706][2049:2054] CHIP:EM: Sending Standalone Ack for MessageCounter:183166533 on exchange 17693i - + [1659422360.478947][2049:2054] [DMG] } + [1659422360.479556][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0000 DataVersion: 3949809681 + [1659422360.479619][2049:2054] [TOO] ACL: 1 entries + [1659422360.479679][2049:2054] [TOO] [1]: { + [1659422360.479706][2049:2054] [TOO] Privilege: 5 + [1659422360.479729][2049:2054] [TOO] AuthMode: 2 + [1659422360.479768][2049:2054] [TOO] Subjects: 2 entries + [1659422360.479819][2049:2054] [TOO] [1]: 1 + [1659422360.479847][2049:2054] [TOO] [2]: 112233 + [1659422360.479876][2049:2054] [TOO] Targets: 1 entries + [1659422360.479925][2049:2054] [TOO] [1]: { + [1659422360.479969][2049:2054] [TOO] Cluster: 31 + [1659422360.479993][2049:2054] [TOO] Endpoint: 0 + [1659422360.480016][2049:2054] [TOO] DeviceType: null + [1659422360.480038][2049:2054] [TOO] } + [1659422360.480062][2049:2054] [TOO] FabricIndex: 1 + [1659422360.480085][2049:2054] [TOO] } + [1659422360.480165][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0001 DataVersion: 3949809681 + [1659422360.480197][2049:2054] [TOO] Extension: 0 entries + [1659422360.480225][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0002 DataVersion: 3949809681 + [1659422360.480251][2049:2054] [TOO] SubjectsPerAccessControlEntry: 4 + [1659422360.480311][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0003 DataVersion: 3949809681 + [1659422360.480337][2049:2054] [TOO] TargetsPerAccessControlEntry: 3 + [1659422360.480395][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0004 DataVersion: 3949809681 + [1659422360.480421][2049:2054] [TOO] AccessControlEntriesPerFabric: 3 + [1659422360.480479][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFC DataVersion: 3949809681 + [1659422360.480505][2049:2054] [TOO] FeatureMap: 0 + [1659422360.480563][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFD DataVersion: 3949809681 + [1659422360.480588][2049:2054] [TOO] ClusterRevision: 1 + [1659422360.480690][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFF8 DataVersion: 3949809681 + [1659422360.480721][2049:2054] [TOO] GeneratedCommandList: 0 entries + [1659422360.480789][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFF9 DataVersion: 3949809681 + [1659422360.480818][2049:2054] [TOO] AcceptedCommandList: 0 entries + [1659422360.481269][2049:2054] [TOO] Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_FFFB DataVersion: 3949809681 + [1659422360.481307][2049:2054] [TOO] AttributeList: 10 entries + [1659422360.481334][2049:2054] [TOO] [1]: 0 (NOCs) + [1659422360.481359][2049:2054] [TOO] [2]: 1 (Fabrics) + [1659422360.481383][2049:2054] [TOO] [3]: 2 (SupportedFabrics) + [1659422360.481408][2049:2054] [TOO] [4]: 3 (CommissionedFabrics) + [1659422360.481432][2049:2054] [TOO] [5]: 4 (TrustedRootCertificates) + [1659422360.481457][2049:2054] [TOO] [6]: 65528 (GeneratedCommandList) + [1659422360.481482][2049:2054] [TOO] [7]: 65529 (AcceptedCommandList) + [1659422360.481506][2049:2054] [TOO] [8]: 65531 (AttributeList) + [1659422360.481531][2049:2054] [TOO] [9]: 65532 (FeatureMap) + [1659422360.481556][2049:2054] [TOO] [10]: 65533 (ClusterRevision) + [1659422360.481706][2049:2054] [EM] Sending Standalone Ack for MessageCounter:183166533 on exchange 17693i With the above command, we are overwriting the default privilege that chip-tool has as an admin. After this test step you need to send below mentioned command to Grant access to all clusters again. diff --git a/src/app/tests/suites/certification/Test_TC_WAKEONLAN_4_1.yaml b/src/app/tests/suites/certification/Test_TC_WAKEONLAN_4_1.yaml index eb36c1a41801d4..fc3f6674683683 100644 --- a/src/app/tests/suites/certification/Test_TC_WAKEONLAN_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_WAKEONLAN_4_1.yaml @@ -55,10 +55,10 @@ tests: ./chip-tv-casting-app lowpower read accepted-command-list 1 1 On TH Verify that the DUT is no longer in a low-power state by sending above command - [1654248854.491911][3652:3657] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0508 Attribute 0x0000_FFF9 DataVersion: 2125568804 - [1654248854.491994][3652:3657] CHIP:TOO: AcceptedCommandList: 1 entries - [1654248854.492040][3652:3657] CHIP:TOO: [1]: 0 - [1654248854.492157][3652:3657] CHIP:EM: Sending Standalone Ack for MessageCounter:15063522 on exchange 51389i + [1654248854.491911][3652:3657] [TOO] Endpoint: 1 Cluster: 0x0000_0508 Attribute 0x0000_FFF9 DataVersion: 2125568804 + [1654248854.491994][3652:3657] [TOO] AcceptedCommandList: 1 entries + [1654248854.492040][3652:3657] [TOO] [1]: 0 (Sleep) + [1654248854.492157][3652:3657] [EM] Sending Standalone Ack for MessageCounter:15063522 on exchange 51389i cluster: "LogCommands" command: "UserPrompt" PICS: PICS_USER_PROMPT diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 12382e3cb41495..3d40f3897e852b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -8952,12 +8952,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Identify::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Identify::Id); } case Identify::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Identify::Id); } case Identify::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -8967,7 +8967,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Identify::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Identify::Id); } case Identify::Attributes::FeatureMap::Id: { uint32_t value; @@ -8993,12 +8993,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Groups::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Groups::Id); } case Groups::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Groups::Id); } case Groups::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9008,7 +9008,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Groups::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Groups::Id); } case Groups::Attributes::FeatureMap::Id: { uint32_t value; @@ -9054,12 +9054,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OnOff::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OnOff::Id); } case OnOff::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OnOff::Id); } case OnOff::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9069,7 +9069,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OnOff::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OnOff::Id); } case OnOff::Attributes::FeatureMap::Id: { uint32_t value; @@ -9100,12 +9100,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OnOffSwitchConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OnOffSwitchConfiguration::Id); } case OnOffSwitchConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OnOffSwitchConfiguration::Id); } case OnOffSwitchConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9115,7 +9115,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OnOffSwitchConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OnOffSwitchConfiguration::Id); } case OnOffSwitchConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -9206,12 +9206,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LevelControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LevelControl::Id); } case LevelControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LevelControl::Id); } case LevelControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9221,7 +9221,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LevelControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LevelControl::Id); } case LevelControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -9287,12 +9287,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BinaryInputBasic::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BinaryInputBasic::Id); } case BinaryInputBasic::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BinaryInputBasic::Id); } case BinaryInputBasic::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9302,7 +9302,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BinaryInputBasic::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BinaryInputBasic::Id); } case BinaryInputBasic::Attributes::FeatureMap::Id: { uint32_t value; @@ -9323,12 +9323,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PulseWidthModulation::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PulseWidthModulation::Id); } case PulseWidthModulation::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PulseWidthModulation::Id); } case PulseWidthModulation::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9338,7 +9338,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PulseWidthModulation::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PulseWidthModulation::Id); } case PulseWidthModulation::Attributes::FeatureMap::Id: { uint32_t value; @@ -9364,12 +9364,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Descriptor::Attributes::ServerList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("ServerList", 1, value); + return DataModelLogger::LogClusterId("ServerList", 1, value); } case Descriptor::Attributes::ClientList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("ClientList", 1, value); + return DataModelLogger::LogClusterId("ClientList", 1, value); } case Descriptor::Attributes::PartsList::Id: { chip::app::DataModel::DecodableList value; @@ -9384,12 +9384,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Descriptor::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Descriptor::Id); } case Descriptor::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Descriptor::Id); } case Descriptor::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9399,7 +9399,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Descriptor::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Descriptor::Id); } case Descriptor::Attributes::FeatureMap::Id: { uint32_t value; @@ -9425,12 +9425,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Binding::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Binding::Id); } case Binding::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Binding::Id); } case Binding::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9440,7 +9440,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Binding::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Binding::Id); } case Binding::Attributes::FeatureMap::Id: { uint32_t value; @@ -9504,12 +9504,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AccessControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, AccessControl::Id); } case AccessControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, AccessControl::Id); } case AccessControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9519,7 +9519,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AccessControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, AccessControl::Id); } case AccessControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -9555,12 +9555,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Actions::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Actions::Id); } case Actions::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Actions::Id); } case Actions::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9570,7 +9570,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Actions::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Actions::Id); } case Actions::Attributes::FeatureMap::Id: { uint32_t value; @@ -9706,12 +9706,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BasicInformation::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BasicInformation::Id); } case BasicInformation::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BasicInformation::Id); } case BasicInformation::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9721,7 +9721,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BasicInformation::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BasicInformation::Id); } case BasicInformation::Attributes::FeatureMap::Id: { uint32_t value; @@ -9742,12 +9742,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OtaSoftwareUpdateProvider::Id); } case OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OtaSoftwareUpdateProvider::Id); } case OtaSoftwareUpdateProvider::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9757,7 +9757,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OtaSoftwareUpdateProvider::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OtaSoftwareUpdateProvider::Id); } case OtaSoftwareUpdateProvider::Attributes::FeatureMap::Id: { uint32_t value; @@ -9800,12 +9800,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OtaSoftwareUpdateRequestor::Id); } case OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OtaSoftwareUpdateRequestor::Id); } case OtaSoftwareUpdateRequestor::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9815,7 +9815,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OtaSoftwareUpdateRequestor::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OtaSoftwareUpdateRequestor::Id); } case OtaSoftwareUpdateRequestor::Attributes::FeatureMap::Id: { uint32_t value; @@ -9846,12 +9846,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LocalizationConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LocalizationConfiguration::Id); } case LocalizationConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LocalizationConfiguration::Id); } case LocalizationConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9861,7 +9861,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LocalizationConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LocalizationConfiguration::Id); } case LocalizationConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -9897,12 +9897,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TimeFormatLocalization::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, TimeFormatLocalization::Id); } case TimeFormatLocalization::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, TimeFormatLocalization::Id); } case TimeFormatLocalization::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9912,7 +9912,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TimeFormatLocalization::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, TimeFormatLocalization::Id); } case TimeFormatLocalization::Attributes::FeatureMap::Id: { uint32_t value; @@ -9938,12 +9938,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UnitLocalization::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, UnitLocalization::Id); } case UnitLocalization::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, UnitLocalization::Id); } case UnitLocalization::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9953,7 +9953,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UnitLocalization::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, UnitLocalization::Id); } case UnitLocalization::Attributes::FeatureMap::Id: { uint32_t value; @@ -9979,12 +9979,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerSourceConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PowerSourceConfiguration::Id); } case PowerSourceConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PowerSourceConfiguration::Id); } case PowerSourceConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -9994,7 +9994,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerSourceConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PowerSourceConfiguration::Id); } case PowerSourceConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -10175,12 +10175,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerSource::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PowerSource::Id); } case PowerSource::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PowerSource::Id); } case PowerSource::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10190,7 +10190,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerSource::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PowerSource::Id); } case PowerSource::Attributes::FeatureMap::Id: { uint32_t value; @@ -10256,12 +10256,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GeneralCommissioning::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, GeneralCommissioning::Id); } case GeneralCommissioning::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, GeneralCommissioning::Id); } case GeneralCommissioning::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10271,7 +10271,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GeneralCommissioning::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, GeneralCommissioning::Id); } case GeneralCommissioning::Attributes::FeatureMap::Id: { uint32_t value; @@ -10349,12 +10349,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case NetworkCommissioning::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, NetworkCommissioning::Id); } case NetworkCommissioning::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, NetworkCommissioning::Id); } case NetworkCommissioning::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10364,7 +10364,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case NetworkCommissioning::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, NetworkCommissioning::Id); } case NetworkCommissioning::Attributes::FeatureMap::Id: { uint32_t value; @@ -10385,12 +10385,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DiagnosticLogs::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DiagnosticLogs::Id); } case DiagnosticLogs::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DiagnosticLogs::Id); } case DiagnosticLogs::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10400,7 +10400,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DiagnosticLogs::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DiagnosticLogs::Id); } case DiagnosticLogs::Attributes::FeatureMap::Id: { uint32_t value; @@ -10467,12 +10467,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GeneralDiagnostics::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, GeneralDiagnostics::Id); } case GeneralDiagnostics::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, GeneralDiagnostics::Id); } case GeneralDiagnostics::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10482,7 +10482,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GeneralDiagnostics::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, GeneralDiagnostics::Id); } case GeneralDiagnostics::Attributes::FeatureMap::Id: { uint32_t value; @@ -10525,12 +10525,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SoftwareDiagnostics::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, SoftwareDiagnostics::Id); } case SoftwareDiagnostics::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, SoftwareDiagnostics::Id); } case SoftwareDiagnostics::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10540,7 +10540,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SoftwareDiagnostics::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, SoftwareDiagnostics::Id); } case SoftwareDiagnostics::Attributes::FeatureMap::Id: { uint32_t value; @@ -10883,12 +10883,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ThreadNetworkDiagnostics::Id); } case ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ThreadNetworkDiagnostics::Id); } case ThreadNetworkDiagnostics::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10898,7 +10898,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadNetworkDiagnostics::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ThreadNetworkDiagnostics::Id); } case ThreadNetworkDiagnostics::Attributes::FeatureMap::Id: { uint32_t value; @@ -10984,12 +10984,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WiFiNetworkDiagnostics::Id); } case WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WiFiNetworkDiagnostics::Id); } case WiFiNetworkDiagnostics::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -10999,7 +10999,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WiFiNetworkDiagnostics::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WiFiNetworkDiagnostics::Id); } case WiFiNetworkDiagnostics::Attributes::FeatureMap::Id: { uint32_t value; @@ -11065,12 +11065,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EthernetNetworkDiagnostics::Id); } case EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EthernetNetworkDiagnostics::Id); } case EthernetNetworkDiagnostics::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11080,7 +11080,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EthernetNetworkDiagnostics::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EthernetNetworkDiagnostics::Id); } case EthernetNetworkDiagnostics::Attributes::FeatureMap::Id: { uint32_t value; @@ -11170,12 +11170,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TimeSynchronization::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, TimeSynchronization::Id); } case TimeSynchronization::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, TimeSynchronization::Id); } case TimeSynchronization::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11185,7 +11185,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TimeSynchronization::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, TimeSynchronization::Id); } case TimeSynchronization::Attributes::FeatureMap::Id: { uint32_t value; @@ -11291,12 +11291,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BridgedDeviceBasicInformation::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BridgedDeviceBasicInformation::Id); } case BridgedDeviceBasicInformation::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BridgedDeviceBasicInformation::Id); } case BridgedDeviceBasicInformation::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11306,7 +11306,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BridgedDeviceBasicInformation::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BridgedDeviceBasicInformation::Id); } case BridgedDeviceBasicInformation::Attributes::FeatureMap::Id: { uint32_t value; @@ -11342,12 +11342,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Switch::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Switch::Id); } case Switch::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Switch::Id); } case Switch::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11357,7 +11357,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Switch::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Switch::Id); } case Switch::Attributes::FeatureMap::Id: { uint32_t value; @@ -11393,12 +11393,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AdministratorCommissioning::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, AdministratorCommissioning::Id); } case AdministratorCommissioning::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, AdministratorCommissioning::Id); } case AdministratorCommissioning::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11408,7 +11408,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AdministratorCommissioning::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, AdministratorCommissioning::Id); } case AdministratorCommissioning::Attributes::FeatureMap::Id: { uint32_t value; @@ -11462,12 +11462,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OperationalCredentials::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OperationalCredentials::Id); } case OperationalCredentials::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OperationalCredentials::Id); } case OperationalCredentials::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11477,7 +11477,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OperationalCredentials::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OperationalCredentials::Id); } case OperationalCredentials::Attributes::FeatureMap::Id: { uint32_t value; @@ -11520,12 +11520,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GroupKeyManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, GroupKeyManagement::Id); } case GroupKeyManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, GroupKeyManagement::Id); } case GroupKeyManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11535,7 +11535,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case GroupKeyManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, GroupKeyManagement::Id); } case GroupKeyManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -11561,12 +11561,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FixedLabel::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, FixedLabel::Id); } case FixedLabel::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, FixedLabel::Id); } case FixedLabel::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11576,7 +11576,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FixedLabel::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, FixedLabel::Id); } case FixedLabel::Attributes::FeatureMap::Id: { uint32_t value; @@ -11602,12 +11602,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UserLabel::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, UserLabel::Id); } case UserLabel::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, UserLabel::Id); } case UserLabel::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11617,7 +11617,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UserLabel::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, UserLabel::Id); } case UserLabel::Attributes::FeatureMap::Id: { uint32_t value; @@ -11638,12 +11638,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ProxyConfiguration::Id); } case ProxyConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ProxyConfiguration::Id); } case ProxyConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11653,7 +11653,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ProxyConfiguration::Id); } case ProxyConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -11674,12 +11674,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyDiscovery::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ProxyDiscovery::Id); } case ProxyDiscovery::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ProxyDiscovery::Id); } case ProxyDiscovery::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11689,7 +11689,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyDiscovery::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ProxyDiscovery::Id); } case ProxyDiscovery::Attributes::FeatureMap::Id: { uint32_t value; @@ -11710,12 +11710,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyValid::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ProxyValid::Id); } case ProxyValid::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ProxyValid::Id); } case ProxyValid::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11725,7 +11725,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ProxyValid::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ProxyValid::Id); } case ProxyValid::Attributes::FeatureMap::Id: { uint32_t value; @@ -11751,12 +11751,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BooleanState::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BooleanState::Id); } case BooleanState::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BooleanState::Id); } case BooleanState::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11766,7 +11766,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BooleanState::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BooleanState::Id); } case BooleanState::Attributes::FeatureMap::Id: { uint32_t value; @@ -11839,12 +11839,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case IcdManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, IcdManagement::Id); } case IcdManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, IcdManagement::Id); } case IcdManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11854,7 +11854,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case IcdManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, IcdManagement::Id); } case IcdManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -11890,12 +11890,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Timer::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Timer::Id); } case Timer::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Timer::Id); } case Timer::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11905,7 +11905,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Timer::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Timer::Id); } case Timer::Attributes::FeatureMap::Id: { uint32_t value; @@ -11958,12 +11958,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OvenCavityOperationalState::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OvenCavityOperationalState::Id); } case OvenCavityOperationalState::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OvenCavityOperationalState::Id); } case OvenCavityOperationalState::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -11973,7 +11973,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OvenCavityOperationalState::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OvenCavityOperationalState::Id); } case OvenCavityOperationalState::Attributes::FeatureMap::Id: { uint32_t value; @@ -12014,12 +12014,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OvenMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OvenMode::Id); } case OvenMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OvenMode::Id); } case OvenMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12029,7 +12029,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OvenMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OvenMode::Id); } case OvenMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12060,12 +12060,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryDryerControls::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LaundryDryerControls::Id); } case LaundryDryerControls::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LaundryDryerControls::Id); } case LaundryDryerControls::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12075,7 +12075,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryDryerControls::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LaundryDryerControls::Id); } case LaundryDryerControls::Attributes::FeatureMap::Id: { uint32_t value; @@ -12126,12 +12126,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ModeSelect::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ModeSelect::Id); } case ModeSelect::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ModeSelect::Id); } case ModeSelect::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12141,7 +12141,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ModeSelect::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ModeSelect::Id); } case ModeSelect::Attributes::FeatureMap::Id: { uint32_t value; @@ -12183,12 +12183,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryWasherMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LaundryWasherMode::Id); } case LaundryWasherMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LaundryWasherMode::Id); } case LaundryWasherMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12198,7 +12198,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryWasherMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LaundryWasherMode::Id); } case LaundryWasherMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12241,12 +12241,14 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RefrigeratorAndTemperatureControlledCabinetMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + RefrigeratorAndTemperatureControlledCabinetMode::Id); } case RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, + RefrigeratorAndTemperatureControlledCabinetMode::Id); } case RefrigeratorAndTemperatureControlledCabinetMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12256,7 +12258,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RefrigeratorAndTemperatureControlledCabinetMode::Id); } case RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12297,12 +12299,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryWasherControls::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LaundryWasherControls::Id); } case LaundryWasherControls::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LaundryWasherControls::Id); } case LaundryWasherControls::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12312,7 +12314,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LaundryWasherControls::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LaundryWasherControls::Id); } case LaundryWasherControls::Attributes::FeatureMap::Id: { uint32_t value; @@ -12343,12 +12345,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcRunMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RvcRunMode::Id); } case RvcRunMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RvcRunMode::Id); } case RvcRunMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12358,7 +12360,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcRunMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RvcRunMode::Id); } case RvcRunMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12389,12 +12391,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcCleanMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RvcCleanMode::Id); } case RvcCleanMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RvcCleanMode::Id); } case RvcCleanMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12404,7 +12406,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcCleanMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RvcCleanMode::Id); } case RvcCleanMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12455,12 +12457,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TemperatureControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, TemperatureControl::Id); } case TemperatureControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, TemperatureControl::Id); } case TemperatureControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12470,7 +12472,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TemperatureControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, TemperatureControl::Id); } case TemperatureControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -12506,12 +12508,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RefrigeratorAlarm::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RefrigeratorAlarm::Id); } case RefrigeratorAlarm::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RefrigeratorAlarm::Id); } case RefrigeratorAlarm::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12521,7 +12523,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RefrigeratorAlarm::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RefrigeratorAlarm::Id); } case RefrigeratorAlarm::Attributes::FeatureMap::Id: { uint32_t value; @@ -12563,12 +12565,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DishwasherMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DishwasherMode::Id); } case DishwasherMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DishwasherMode::Id); } case DishwasherMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12578,7 +12580,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DishwasherMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DishwasherMode::Id); } case DishwasherMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12604,12 +12606,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AirQuality::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, AirQuality::Id); } case AirQuality::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, AirQuality::Id); } case AirQuality::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12619,7 +12621,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AirQuality::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, AirQuality::Id); } case AirQuality::Attributes::FeatureMap::Id: { uint32_t value; @@ -12705,12 +12707,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SmokeCoAlarm::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, SmokeCoAlarm::Id); } case SmokeCoAlarm::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, SmokeCoAlarm::Id); } case SmokeCoAlarm::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12720,7 +12722,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SmokeCoAlarm::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, SmokeCoAlarm::Id); } case SmokeCoAlarm::Attributes::FeatureMap::Id: { uint32_t value; @@ -12761,12 +12763,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DishwasherAlarm::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DishwasherAlarm::Id); } case DishwasherAlarm::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DishwasherAlarm::Id); } case DishwasherAlarm::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12776,7 +12778,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DishwasherAlarm::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DishwasherAlarm::Id); } case DishwasherAlarm::Attributes::FeatureMap::Id: { uint32_t value; @@ -12808,12 +12810,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MicrowaveOvenMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, MicrowaveOvenMode::Id); } case MicrowaveOvenMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, MicrowaveOvenMode::Id); } case MicrowaveOvenMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12823,7 +12825,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MicrowaveOvenMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, MicrowaveOvenMode::Id); } case MicrowaveOvenMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -12889,12 +12891,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MicrowaveOvenControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, MicrowaveOvenControl::Id); } case MicrowaveOvenControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, MicrowaveOvenControl::Id); } case MicrowaveOvenControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12904,7 +12906,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MicrowaveOvenControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, MicrowaveOvenControl::Id); } case MicrowaveOvenControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -12957,12 +12959,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OperationalState::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OperationalState::Id); } case OperationalState::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OperationalState::Id); } case OperationalState::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -12972,7 +12974,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OperationalState::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OperationalState::Id); } case OperationalState::Attributes::FeatureMap::Id: { uint32_t value; @@ -13025,12 +13027,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcOperationalState::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RvcOperationalState::Id); } case RvcOperationalState::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RvcOperationalState::Id); } case RvcOperationalState::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13040,7 +13042,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RvcOperationalState::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RvcOperationalState::Id); } case RvcOperationalState::Attributes::FeatureMap::Id: { uint32_t value; @@ -13077,12 +13079,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ScenesManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ScenesManagement::Id); } case ScenesManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ScenesManagement::Id); } case ScenesManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13092,7 +13094,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ScenesManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ScenesManagement::Id); } case ScenesManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -13145,12 +13147,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case HepaFilterMonitoring::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, HepaFilterMonitoring::Id); } case HepaFilterMonitoring::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, HepaFilterMonitoring::Id); } case HepaFilterMonitoring::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13160,7 +13162,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case HepaFilterMonitoring::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, HepaFilterMonitoring::Id); } case HepaFilterMonitoring::Attributes::FeatureMap::Id: { uint32_t value; @@ -13213,12 +13215,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ActivatedCarbonFilterMonitoring::Id); } case ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ActivatedCarbonFilterMonitoring::Id); } case ActivatedCarbonFilterMonitoring::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13228,7 +13230,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ActivatedCarbonFilterMonitoring::Id); } case ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id: { uint32_t value; @@ -13289,12 +13291,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BooleanStateConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BooleanStateConfiguration::Id); } case BooleanStateConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BooleanStateConfiguration::Id); } case BooleanStateConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13304,7 +13306,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BooleanStateConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BooleanStateConfiguration::Id); } case BooleanStateConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -13380,12 +13382,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ValveConfigurationAndControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ValveConfigurationAndControl::Id); } case ValveConfigurationAndControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ValveConfigurationAndControl::Id); } case ValveConfigurationAndControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13395,7 +13397,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ValveConfigurationAndControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ValveConfigurationAndControl::Id); } case ValveConfigurationAndControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -13519,12 +13521,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalPowerMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ElectricalPowerMeasurement::Id); } case ElectricalPowerMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ElectricalPowerMeasurement::Id); } case ElectricalPowerMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13534,7 +13536,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalPowerMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ElectricalPowerMeasurement::Id); } case ElectricalPowerMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -13595,12 +13597,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ElectricalEnergyMeasurement::Id); } case ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ElectricalEnergyMeasurement::Id); } case ElectricalEnergyMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13610,7 +13612,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalEnergyMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ElectricalEnergyMeasurement::Id); } case ElectricalEnergyMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -13661,12 +13663,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WaterHeaterManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WaterHeaterManagement::Id); } case WaterHeaterManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WaterHeaterManagement::Id); } case WaterHeaterManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13676,7 +13678,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WaterHeaterManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WaterHeaterManagement::Id); } case WaterHeaterManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -13743,12 +13745,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DemandResponseLoadControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DemandResponseLoadControl::Id); } case DemandResponseLoadControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DemandResponseLoadControl::Id); } case DemandResponseLoadControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13758,7 +13760,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DemandResponseLoadControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DemandResponseLoadControl::Id); } case DemandResponseLoadControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -13789,12 +13791,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Messages::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Messages::Id); } case Messages::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Messages::Id); } case Messages::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13804,7 +13806,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Messages::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Messages::Id); } case Messages::Attributes::FeatureMap::Id: { uint32_t value; @@ -13868,12 +13870,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DeviceEnergyManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DeviceEnergyManagement::Id); } case DeviceEnergyManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DeviceEnergyManagement::Id); } case DeviceEnergyManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -13883,7 +13885,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DeviceEnergyManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DeviceEnergyManagement::Id); } case DeviceEnergyManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -14019,12 +14021,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyEvse::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EnergyEvse::Id); } case EnergyEvse::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EnergyEvse::Id); } case EnergyEvse::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14034,7 +14036,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyEvse::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EnergyEvse::Id); } case EnergyEvse::Attributes::FeatureMap::Id: { uint32_t value; @@ -14080,12 +14082,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyPreference::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EnergyPreference::Id); } case EnergyPreference::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EnergyPreference::Id); } case EnergyPreference::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14095,7 +14097,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyPreference::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EnergyPreference::Id); } case EnergyPreference::Attributes::FeatureMap::Id: { uint32_t value; @@ -14126,12 +14128,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerTopology::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PowerTopology::Id); } case PowerTopology::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PowerTopology::Id); } case PowerTopology::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14141,7 +14143,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PowerTopology::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PowerTopology::Id); } case PowerTopology::Attributes::FeatureMap::Id: { uint32_t value; @@ -14183,12 +14185,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyEvseMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EnergyEvseMode::Id); } case EnergyEvseMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EnergyEvseMode::Id); } case EnergyEvseMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14198,7 +14200,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EnergyEvseMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EnergyEvseMode::Id); } case EnergyEvseMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -14240,12 +14242,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WaterHeaterMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WaterHeaterMode::Id); } case WaterHeaterMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WaterHeaterMode::Id); } case WaterHeaterMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14255,7 +14257,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WaterHeaterMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WaterHeaterMode::Id); } case WaterHeaterMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -14298,12 +14300,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DeviceEnergyManagementMode::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DeviceEnergyManagementMode::Id); } case DeviceEnergyManagementMode::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DeviceEnergyManagementMode::Id); } case DeviceEnergyManagementMode::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14313,7 +14315,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DeviceEnergyManagementMode::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DeviceEnergyManagementMode::Id); } case DeviceEnergyManagementMode::Attributes::FeatureMap::Id: { uint32_t value; @@ -14559,12 +14561,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DoorLock::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, DoorLock::Id); } case DoorLock::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, DoorLock::Id); } case DoorLock::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14574,7 +14576,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case DoorLock::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, DoorLock::Id); } case DoorLock::Attributes::FeatureMap::Id: { uint32_t value; @@ -14705,12 +14707,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WindowCovering::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WindowCovering::Id); } case WindowCovering::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WindowCovering::Id); } case WindowCovering::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14720,7 +14722,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WindowCovering::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WindowCovering::Id); } case WindowCovering::Attributes::FeatureMap::Id: { uint32_t value; @@ -14791,12 +14793,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BarrierControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BarrierControl::Id); } case BarrierControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BarrierControl::Id); } case BarrierControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14806,7 +14808,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BarrierControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BarrierControl::Id); } case BarrierControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -14857,12 +14859,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ServiceArea::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ServiceArea::Id); } case ServiceArea::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ServiceArea::Id); } case ServiceArea::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -14872,7 +14874,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ServiceArea::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ServiceArea::Id); } case ServiceArea::Attributes::FeatureMap::Id: { uint32_t value; @@ -15008,12 +15010,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PumpConfigurationAndControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PumpConfigurationAndControl::Id); } case PumpConfigurationAndControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PumpConfigurationAndControl::Id); } case PumpConfigurationAndControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15023,7 +15025,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PumpConfigurationAndControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PumpConfigurationAndControl::Id); } case PumpConfigurationAndControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -15344,12 +15346,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Thermostat::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Thermostat::Id); } case Thermostat::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Thermostat::Id); } case Thermostat::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15359,7 +15361,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Thermostat::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Thermostat::Id); } case Thermostat::Attributes::FeatureMap::Id: { uint32_t value; @@ -15440,12 +15442,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FanControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, FanControl::Id); } case FanControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, FanControl::Id); } case FanControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15455,7 +15457,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FanControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, FanControl::Id); } case FanControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -15491,12 +15493,13 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + ThermostatUserInterfaceConfiguration::Id); } case ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ThermostatUserInterfaceConfiguration::Id); } case ThermostatUserInterfaceConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15506,7 +15509,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ThermostatUserInterfaceConfiguration::Id); } case ThermostatUserInterfaceConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -15787,12 +15790,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ColorControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ColorControl::Id); } case ColorControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ColorControl::Id); } case ColorControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15802,7 +15805,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ColorControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ColorControl::Id); } case ColorControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -15893,12 +15896,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BallastConfiguration::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, BallastConfiguration::Id); } case BallastConfiguration::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, BallastConfiguration::Id); } case BallastConfiguration::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15908,7 +15911,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case BallastConfiguration::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, BallastConfiguration::Id); } case BallastConfiguration::Attributes::FeatureMap::Id: { uint32_t value; @@ -15954,12 +15957,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case IlluminanceMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, IlluminanceMeasurement::Id); } case IlluminanceMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, IlluminanceMeasurement::Id); } case IlluminanceMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -15969,7 +15972,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case IlluminanceMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, IlluminanceMeasurement::Id); } case IlluminanceMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16010,12 +16013,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TemperatureMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, TemperatureMeasurement::Id); } case TemperatureMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, TemperatureMeasurement::Id); } case TemperatureMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16025,7 +16028,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TemperatureMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, TemperatureMeasurement::Id); } case TemperatureMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16091,12 +16094,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PressureMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, PressureMeasurement::Id); } case PressureMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, PressureMeasurement::Id); } case PressureMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16106,7 +16109,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case PressureMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, PressureMeasurement::Id); } case PressureMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16147,12 +16150,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FlowMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, FlowMeasurement::Id); } case FlowMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, FlowMeasurement::Id); } case FlowMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16162,7 +16165,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FlowMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, FlowMeasurement::Id); } case FlowMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16203,12 +16206,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RelativeHumidityMeasurement::Id); } case RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RelativeHumidityMeasurement::Id); } case RelativeHumidityMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16218,7 +16221,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RelativeHumidityMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RelativeHumidityMeasurement::Id); } case RelativeHumidityMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16309,12 +16312,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OccupancySensing::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OccupancySensing::Id); } case OccupancySensing::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OccupancySensing::Id); } case OccupancySensing::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16324,7 +16327,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OccupancySensing::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OccupancySensing::Id); } case OccupancySensing::Attributes::FeatureMap::Id: { uint32_t value; @@ -16400,12 +16403,14 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + CarbonMonoxideConcentrationMeasurement::Id); } case CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, + CarbonMonoxideConcentrationMeasurement::Id); } case CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16415,7 +16420,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, CarbonMonoxideConcentrationMeasurement::Id); } case CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16491,12 +16496,14 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + CarbonDioxideConcentrationMeasurement::Id); } case CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, + CarbonDioxideConcentrationMeasurement::Id); } case CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16506,7 +16513,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, CarbonDioxideConcentrationMeasurement::Id); } case CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16582,12 +16589,14 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + NitrogenDioxideConcentrationMeasurement::Id); } case NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, + NitrogenDioxideConcentrationMeasurement::Id); } case NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16597,7 +16606,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, NitrogenDioxideConcentrationMeasurement::Id); } case NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16673,12 +16682,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, OzoneConcentrationMeasurement::Id); } case OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, OzoneConcentrationMeasurement::Id); } case OzoneConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16688,7 +16697,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case OzoneConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, OzoneConcentrationMeasurement::Id); } case OzoneConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16764,12 +16773,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Pm25ConcentrationMeasurement::Id); } case Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Pm25ConcentrationMeasurement::Id); } case Pm25ConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16779,7 +16788,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm25ConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Pm25ConcentrationMeasurement::Id); } case Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16855,12 +16864,13 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + FormaldehydeConcentrationMeasurement::Id); } case FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, FormaldehydeConcentrationMeasurement::Id); } case FormaldehydeConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16870,7 +16880,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, FormaldehydeConcentrationMeasurement::Id); } case FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -16946,12 +16956,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Pm1ConcentrationMeasurement::Id); } case Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Pm1ConcentrationMeasurement::Id); } case Pm1ConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -16961,7 +16971,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm1ConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Pm1ConcentrationMeasurement::Id); } case Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17037,12 +17047,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Pm10ConcentrationMeasurement::Id); } case Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Pm10ConcentrationMeasurement::Id); } case Pm10ConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17052,7 +17062,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Pm10ConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Pm10ConcentrationMeasurement::Id); } case Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17128,12 +17138,14 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Id); } case TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Id); } case TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17143,7 +17155,8 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Id); } case TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17219,12 +17232,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, RadonConcentrationMeasurement::Id); } case RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, RadonConcentrationMeasurement::Id); } case RadonConcentrationMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17234,7 +17247,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case RadonConcentrationMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, RadonConcentrationMeasurement::Id); } case RadonConcentrationMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17265,12 +17278,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WiFiNetworkManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WiFiNetworkManagement::Id); } case WiFiNetworkManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WiFiNetworkManagement::Id); } case WiFiNetworkManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17280,7 +17293,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WiFiNetworkManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WiFiNetworkManagement::Id); } case WiFiNetworkManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17331,12 +17344,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadBorderRouterManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ThreadBorderRouterManagement::Id); } case ThreadBorderRouterManagement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ThreadBorderRouterManagement::Id); } case ThreadBorderRouterManagement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17346,7 +17359,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadBorderRouterManagement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ThreadBorderRouterManagement::Id); } case ThreadBorderRouterManagement::Attributes::FeatureMap::Id: { uint32_t value; @@ -17384,12 +17397,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ThreadNetworkDirectory::Id); } case ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ThreadNetworkDirectory::Id); } case ThreadNetworkDirectory::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17399,7 +17412,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ThreadNetworkDirectory::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ThreadNetworkDirectory::Id); } case ThreadNetworkDirectory::Attributes::FeatureMap::Id: { uint32_t value; @@ -17430,12 +17443,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WakeOnLan::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, WakeOnLan::Id); } case WakeOnLan::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, WakeOnLan::Id); } case WakeOnLan::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17445,7 +17458,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case WakeOnLan::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, WakeOnLan::Id); } case WakeOnLan::Attributes::FeatureMap::Id: { uint32_t value; @@ -17481,12 +17494,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Channel::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, Channel::Id); } case Channel::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, Channel::Id); } case Channel::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17496,7 +17509,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case Channel::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, Channel::Id); } case Channel::Attributes::FeatureMap::Id: { uint32_t value; @@ -17528,12 +17541,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TargetNavigator::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, TargetNavigator::Id); } case TargetNavigator::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, TargetNavigator::Id); } case TargetNavigator::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17543,7 +17556,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case TargetNavigator::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, TargetNavigator::Id); } case TargetNavigator::Attributes::FeatureMap::Id: { uint32_t value; @@ -17624,12 +17637,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MediaPlayback::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, MediaPlayback::Id); } case MediaPlayback::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, MediaPlayback::Id); } case MediaPlayback::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17639,7 +17652,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MediaPlayback::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, MediaPlayback::Id); } case MediaPlayback::Attributes::FeatureMap::Id: { uint32_t value; @@ -17670,12 +17683,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MediaInput::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, MediaInput::Id); } case MediaInput::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, MediaInput::Id); } case MediaInput::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17685,7 +17698,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case MediaInput::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, MediaInput::Id); } case MediaInput::Attributes::FeatureMap::Id: { uint32_t value; @@ -17706,12 +17719,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LowPower::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, LowPower::Id); } case LowPower::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, LowPower::Id); } case LowPower::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17721,7 +17734,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case LowPower::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, LowPower::Id); } case LowPower::Attributes::FeatureMap::Id: { uint32_t value; @@ -17742,12 +17755,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case KeypadInput::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, KeypadInput::Id); } case KeypadInput::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, KeypadInput::Id); } case KeypadInput::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17757,7 +17770,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case KeypadInput::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, KeypadInput::Id); } case KeypadInput::Attributes::FeatureMap::Id: { uint32_t value; @@ -17788,12 +17801,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentLauncher::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ContentLauncher::Id); } case ContentLauncher::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ContentLauncher::Id); } case ContentLauncher::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17803,7 +17816,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentLauncher::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ContentLauncher::Id); } case ContentLauncher::Attributes::FeatureMap::Id: { uint32_t value; @@ -17834,12 +17847,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AudioOutput::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, AudioOutput::Id); } case AudioOutput::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, AudioOutput::Id); } case AudioOutput::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17849,7 +17862,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AudioOutput::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, AudioOutput::Id); } case AudioOutput::Attributes::FeatureMap::Id: { uint32_t value; @@ -17881,12 +17894,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ApplicationLauncher::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ApplicationLauncher::Id); } case ApplicationLauncher::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ApplicationLauncher::Id); } case ApplicationLauncher::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17896,7 +17909,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ApplicationLauncher::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ApplicationLauncher::Id); } case ApplicationLauncher::Attributes::FeatureMap::Id: { uint32_t value; @@ -17957,12 +17970,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ApplicationBasic::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ApplicationBasic::Id); } case ApplicationBasic::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ApplicationBasic::Id); } case ApplicationBasic::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -17972,7 +17985,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ApplicationBasic::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ApplicationBasic::Id); } case ApplicationBasic::Attributes::FeatureMap::Id: { uint32_t value; @@ -17993,12 +18006,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AccountLogin::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, AccountLogin::Id); } case AccountLogin::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, AccountLogin::Id); } case AccountLogin::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18008,7 +18021,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case AccountLogin::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, AccountLogin::Id); } case AccountLogin::Attributes::FeatureMap::Id: { uint32_t value; @@ -18071,12 +18084,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ContentControl::Id); } case ContentControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ContentControl::Id); } case ContentControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18086,7 +18099,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ContentControl::Id); } case ContentControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -18107,12 +18120,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentAppObserver::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ContentAppObserver::Id); } case ContentAppObserver::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ContentAppObserver::Id); } case ContentAppObserver::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18122,7 +18135,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ContentAppObserver::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ContentAppObserver::Id); } case ContentAppObserver::Attributes::FeatureMap::Id: { uint32_t value; @@ -18162,12 +18175,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EcosystemInformation::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, EcosystemInformation::Id); } case EcosystemInformation::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, EcosystemInformation::Id); } case EcosystemInformation::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18177,7 +18190,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case EcosystemInformation::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, EcosystemInformation::Id); } case EcosystemInformation::Attributes::FeatureMap::Id: { uint32_t value; @@ -18203,12 +18216,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CommissionerControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, CommissionerControl::Id); } case CommissionerControl::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, CommissionerControl::Id); } case CommissionerControl::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18218,7 +18231,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case CommissionerControl::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, CommissionerControl::Id); } case CommissionerControl::Attributes::FeatureMap::Id: { uint32_t value; @@ -18879,12 +18892,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, ElectricalMeasurement::Id); } case ElectricalMeasurement::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, ElectricalMeasurement::Id); } case ElectricalMeasurement::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -18894,7 +18907,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ElectricalMeasurement::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, ElectricalMeasurement::Id); } case ElectricalMeasurement::Attributes::FeatureMap::Id: { uint32_t value; @@ -19348,12 +19361,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UnitTesting::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, UnitTesting::Id); } case UnitTesting::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, UnitTesting::Id); } case UnitTesting::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -19363,7 +19376,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case UnitTesting::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, UnitTesting::Id); } case UnitTesting::Attributes::FeatureMap::Id: { uint32_t value; @@ -19389,12 +19402,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FaultInjection::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, FaultInjection::Id); } case FaultInjection::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, FaultInjection::Id); } case FaultInjection::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -19404,7 +19417,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case FaultInjection::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, FaultInjection::Id); } case FaultInjection::Attributes::FeatureMap::Id: { uint32_t value; @@ -19430,12 +19443,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SampleMei::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + return DataModelLogger::LogGeneratedCommandId("GeneratedCommandList", 1, value, SampleMei::Id); } case SampleMei::Attributes::AcceptedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + return DataModelLogger::LogAcceptedCommandId("AcceptedCommandList", 1, value, SampleMei::Id); } case SampleMei::Attributes::EventList::Id: { chip::app::DataModel::DecodableList value; @@ -19445,7 +19458,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case SampleMei::Attributes::AttributeList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("AttributeList", 1, value); + return DataModelLogger::LogAttributeId("AttributeList", 1, value, SampleMei::Id); } case SampleMei::Attributes::FeatureMap::Id: { uint32_t value; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp new file mode 100644 index 00000000000000..c97ff2590fa60b --- /dev/null +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.cpp @@ -0,0 +1,6700 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include + +char const * ClusterIdToText(chip::ClusterId id) +{ + switch (id) + { + case chip::app::Clusters::Identify::Id: + return "Identify"; + case chip::app::Clusters::Groups::Id: + return "Groups"; + case chip::app::Clusters::OnOff::Id: + return "OnOff"; + case chip::app::Clusters::OnOffSwitchConfiguration::Id: + return "OnOffSwitchConfiguration"; + case chip::app::Clusters::LevelControl::Id: + return "LevelControl"; + case chip::app::Clusters::BinaryInputBasic::Id: + return "BinaryInputBasic"; + case chip::app::Clusters::PulseWidthModulation::Id: + return "PulseWidthModulation"; + case chip::app::Clusters::Descriptor::Id: + return "Descriptor"; + case chip::app::Clusters::Binding::Id: + return "Binding"; + case chip::app::Clusters::AccessControl::Id: + return "AccessControl"; + case chip::app::Clusters::Actions::Id: + return "Actions"; + case chip::app::Clusters::BasicInformation::Id: + return "BasicInformation"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Id: + return "OtaSoftwareUpdateProvider"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Id: + return "OtaSoftwareUpdateRequestor"; + case chip::app::Clusters::LocalizationConfiguration::Id: + return "LocalizationConfiguration"; + case chip::app::Clusters::TimeFormatLocalization::Id: + return "TimeFormatLocalization"; + case chip::app::Clusters::UnitLocalization::Id: + return "UnitLocalization"; + case chip::app::Clusters::PowerSourceConfiguration::Id: + return "PowerSourceConfiguration"; + case chip::app::Clusters::PowerSource::Id: + return "PowerSource"; + case chip::app::Clusters::GeneralCommissioning::Id: + return "GeneralCommissioning"; + case chip::app::Clusters::NetworkCommissioning::Id: + return "NetworkCommissioning"; + case chip::app::Clusters::DiagnosticLogs::Id: + return "DiagnosticLogs"; + case chip::app::Clusters::GeneralDiagnostics::Id: + return "GeneralDiagnostics"; + case chip::app::Clusters::SoftwareDiagnostics::Id: + return "SoftwareDiagnostics"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Id: + return "ThreadNetworkDiagnostics"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Id: + return "WiFiNetworkDiagnostics"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Id: + return "EthernetNetworkDiagnostics"; + case chip::app::Clusters::TimeSynchronization::Id: + return "TimeSynchronization"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Id: + return "BridgedDeviceBasicInformation"; + case chip::app::Clusters::Switch::Id: + return "Switch"; + case chip::app::Clusters::AdministratorCommissioning::Id: + return "AdministratorCommissioning"; + case chip::app::Clusters::OperationalCredentials::Id: + return "OperationalCredentials"; + case chip::app::Clusters::GroupKeyManagement::Id: + return "GroupKeyManagement"; + case chip::app::Clusters::FixedLabel::Id: + return "FixedLabel"; + case chip::app::Clusters::UserLabel::Id: + return "UserLabel"; + case chip::app::Clusters::ProxyConfiguration::Id: + return "ProxyConfiguration"; + case chip::app::Clusters::ProxyDiscovery::Id: + return "ProxyDiscovery"; + case chip::app::Clusters::ProxyValid::Id: + return "ProxyValid"; + case chip::app::Clusters::BooleanState::Id: + return "BooleanState"; + case chip::app::Clusters::IcdManagement::Id: + return "IcdManagement"; + case chip::app::Clusters::Timer::Id: + return "Timer"; + case chip::app::Clusters::OvenCavityOperationalState::Id: + return "OvenCavityOperationalState"; + case chip::app::Clusters::OvenMode::Id: + return "OvenMode"; + case chip::app::Clusters::LaundryDryerControls::Id: + return "LaundryDryerControls"; + case chip::app::Clusters::ModeSelect::Id: + return "ModeSelect"; + case chip::app::Clusters::LaundryWasherMode::Id: + return "LaundryWasherMode"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id: + return "RefrigeratorAndTemperatureControlledCabinetMode"; + case chip::app::Clusters::LaundryWasherControls::Id: + return "LaundryWasherControls"; + case chip::app::Clusters::RvcRunMode::Id: + return "RvcRunMode"; + case chip::app::Clusters::RvcCleanMode::Id: + return "RvcCleanMode"; + case chip::app::Clusters::TemperatureControl::Id: + return "TemperatureControl"; + case chip::app::Clusters::RefrigeratorAlarm::Id: + return "RefrigeratorAlarm"; + case chip::app::Clusters::DishwasherMode::Id: + return "DishwasherMode"; + case chip::app::Clusters::AirQuality::Id: + return "AirQuality"; + case chip::app::Clusters::SmokeCoAlarm::Id: + return "SmokeCoAlarm"; + case chip::app::Clusters::DishwasherAlarm::Id: + return "DishwasherAlarm"; + case chip::app::Clusters::MicrowaveOvenMode::Id: + return "MicrowaveOvenMode"; + case chip::app::Clusters::MicrowaveOvenControl::Id: + return "MicrowaveOvenControl"; + case chip::app::Clusters::OperationalState::Id: + return "OperationalState"; + case chip::app::Clusters::RvcOperationalState::Id: + return "RvcOperationalState"; + case chip::app::Clusters::ScenesManagement::Id: + return "ScenesManagement"; + case chip::app::Clusters::HepaFilterMonitoring::Id: + return "HepaFilterMonitoring"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id: + return "ActivatedCarbonFilterMonitoring"; + case chip::app::Clusters::BooleanStateConfiguration::Id: + return "BooleanStateConfiguration"; + case chip::app::Clusters::ValveConfigurationAndControl::Id: + return "ValveConfigurationAndControl"; + case chip::app::Clusters::ElectricalPowerMeasurement::Id: + return "ElectricalPowerMeasurement"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Id: + return "ElectricalEnergyMeasurement"; + case chip::app::Clusters::WaterHeaterManagement::Id: + return "WaterHeaterManagement"; + case chip::app::Clusters::DemandResponseLoadControl::Id: + return "DemandResponseLoadControl"; + case chip::app::Clusters::Messages::Id: + return "Messages"; + case chip::app::Clusters::DeviceEnergyManagement::Id: + return "DeviceEnergyManagement"; + case chip::app::Clusters::EnergyEvse::Id: + return "EnergyEvse"; + case chip::app::Clusters::EnergyPreference::Id: + return "EnergyPreference"; + case chip::app::Clusters::PowerTopology::Id: + return "PowerTopology"; + case chip::app::Clusters::EnergyEvseMode::Id: + return "EnergyEvseMode"; + case chip::app::Clusters::WaterHeaterMode::Id: + return "WaterHeaterMode"; + case chip::app::Clusters::DeviceEnergyManagementMode::Id: + return "DeviceEnergyManagementMode"; + case chip::app::Clusters::DoorLock::Id: + return "DoorLock"; + case chip::app::Clusters::WindowCovering::Id: + return "WindowCovering"; + case chip::app::Clusters::BarrierControl::Id: + return "BarrierControl"; + case chip::app::Clusters::ServiceArea::Id: + return "ServiceArea"; + case chip::app::Clusters::PumpConfigurationAndControl::Id: + return "PumpConfigurationAndControl"; + case chip::app::Clusters::Thermostat::Id: + return "Thermostat"; + case chip::app::Clusters::FanControl::Id: + return "FanControl"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id: + return "ThermostatUserInterfaceConfiguration"; + case chip::app::Clusters::ColorControl::Id: + return "ColorControl"; + case chip::app::Clusters::BallastConfiguration::Id: + return "BallastConfiguration"; + case chip::app::Clusters::IlluminanceMeasurement::Id: + return "IlluminanceMeasurement"; + case chip::app::Clusters::TemperatureMeasurement::Id: + return "TemperatureMeasurement"; + case chip::app::Clusters::PressureMeasurement::Id: + return "PressureMeasurement"; + case chip::app::Clusters::FlowMeasurement::Id: + return "FlowMeasurement"; + case chip::app::Clusters::RelativeHumidityMeasurement::Id: + return "RelativeHumidityMeasurement"; + case chip::app::Clusters::OccupancySensing::Id: + return "OccupancySensing"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id: + return "CarbonMonoxideConcentrationMeasurement"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id: + return "CarbonDioxideConcentrationMeasurement"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id: + return "NitrogenDioxideConcentrationMeasurement"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Id: + return "OzoneConcentrationMeasurement"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Id: + return "Pm25ConcentrationMeasurement"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id: + return "FormaldehydeConcentrationMeasurement"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Id: + return "Pm1ConcentrationMeasurement"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Id: + return "Pm10ConcentrationMeasurement"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: + return "TotalVolatileOrganicCompoundsConcentrationMeasurement"; + case chip::app::Clusters::RadonConcentrationMeasurement::Id: + return "RadonConcentrationMeasurement"; + case chip::app::Clusters::WiFiNetworkManagement::Id: + return "WiFiNetworkManagement"; + case chip::app::Clusters::ThreadBorderRouterManagement::Id: + return "ThreadBorderRouterManagement"; + case chip::app::Clusters::ThreadNetworkDirectory::Id: + return "ThreadNetworkDirectory"; + case chip::app::Clusters::WakeOnLan::Id: + return "WakeOnLan"; + case chip::app::Clusters::Channel::Id: + return "Channel"; + case chip::app::Clusters::TargetNavigator::Id: + return "TargetNavigator"; + case chip::app::Clusters::MediaPlayback::Id: + return "MediaPlayback"; + case chip::app::Clusters::MediaInput::Id: + return "MediaInput"; + case chip::app::Clusters::LowPower::Id: + return "LowPower"; + case chip::app::Clusters::KeypadInput::Id: + return "KeypadInput"; + case chip::app::Clusters::ContentLauncher::Id: + return "ContentLauncher"; + case chip::app::Clusters::AudioOutput::Id: + return "AudioOutput"; + case chip::app::Clusters::ApplicationLauncher::Id: + return "ApplicationLauncher"; + case chip::app::Clusters::ApplicationBasic::Id: + return "ApplicationBasic"; + case chip::app::Clusters::AccountLogin::Id: + return "AccountLogin"; + case chip::app::Clusters::ContentControl::Id: + return "ContentControl"; + case chip::app::Clusters::ContentAppObserver::Id: + return "ContentAppObserver"; + case chip::app::Clusters::EcosystemInformation::Id: + return "EcosystemInformation"; + case chip::app::Clusters::CommissionerControl::Id: + return "CommissionerControl"; + case chip::app::Clusters::ElectricalMeasurement::Id: + return "ElectricalMeasurement"; + case chip::app::Clusters::UnitTesting::Id: + return "UnitTesting"; + case chip::app::Clusters::FaultInjection::Id: + return "FaultInjection"; + case chip::app::Clusters::SampleMei::Id: + return "SampleMei"; + default: + return "Unknown"; + } +} + +char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) +{ + switch (cluster) + { + case chip::app::Clusters::Identify::Id: { + switch (id) + { + case chip::app::Clusters::Identify::Attributes::IdentifyTime::Id: + return "IdentifyTime"; + case chip::app::Clusters::Identify::Attributes::IdentifyType::Id: + return "IdentifyType"; + case chip::app::Clusters::Identify::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Identify::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Identify::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Identify::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Identify::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Identify::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Groups::Id: { + switch (id) + { + case chip::app::Clusters::Groups::Attributes::NameSupport::Id: + return "NameSupport"; + case chip::app::Clusters::Groups::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Groups::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Groups::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Groups::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Groups::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Groups::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OnOff::Id: { + switch (id) + { + case chip::app::Clusters::OnOff::Attributes::OnOff::Id: + return "OnOff"; + case chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::Id: + return "GlobalSceneControl"; + case chip::app::Clusters::OnOff::Attributes::OnTime::Id: + return "OnTime"; + case chip::app::Clusters::OnOff::Attributes::OffWaitTime::Id: + return "OffWaitTime"; + case chip::app::Clusters::OnOff::Attributes::StartUpOnOff::Id: + return "StartUpOnOff"; + case chip::app::Clusters::OnOff::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OnOff::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OnOff::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OnOff::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OnOff::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OnOff::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OnOffSwitchConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchType::Id: + return "SwitchType"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::SwitchActions::Id: + return "SwitchActions"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OnOffSwitchConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LevelControl::Id: { + switch (id) + { + case chip::app::Clusters::LevelControl::Attributes::CurrentLevel::Id: + return "CurrentLevel"; + case chip::app::Clusters::LevelControl::Attributes::RemainingTime::Id: + return "RemainingTime"; + case chip::app::Clusters::LevelControl::Attributes::MinLevel::Id: + return "MinLevel"; + case chip::app::Clusters::LevelControl::Attributes::MaxLevel::Id: + return "MaxLevel"; + case chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::Id: + return "CurrentFrequency"; + case chip::app::Clusters::LevelControl::Attributes::MinFrequency::Id: + return "MinFrequency"; + case chip::app::Clusters::LevelControl::Attributes::MaxFrequency::Id: + return "MaxFrequency"; + case chip::app::Clusters::LevelControl::Attributes::Options::Id: + return "Options"; + case chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::Id: + return "OnOffTransitionTime"; + case chip::app::Clusters::LevelControl::Attributes::OnLevel::Id: + return "OnLevel"; + case chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::Id: + return "OnTransitionTime"; + case chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::Id: + return "OffTransitionTime"; + case chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::Id: + return "DefaultMoveRate"; + case chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::Id: + return "StartUpCurrentLevel"; + case chip::app::Clusters::LevelControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LevelControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LevelControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LevelControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LevelControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LevelControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BinaryInputBasic::Id: { + switch (id) + { + case chip::app::Clusters::BinaryInputBasic::Attributes::ActiveText::Id: + return "ActiveText"; + case chip::app::Clusters::BinaryInputBasic::Attributes::Description::Id: + return "Description"; + case chip::app::Clusters::BinaryInputBasic::Attributes::InactiveText::Id: + return "InactiveText"; + case chip::app::Clusters::BinaryInputBasic::Attributes::OutOfService::Id: + return "OutOfService"; + case chip::app::Clusters::BinaryInputBasic::Attributes::Polarity::Id: + return "Polarity"; + case chip::app::Clusters::BinaryInputBasic::Attributes::PresentValue::Id: + return "PresentValue"; + case chip::app::Clusters::BinaryInputBasic::Attributes::Reliability::Id: + return "Reliability"; + case chip::app::Clusters::BinaryInputBasic::Attributes::StatusFlags::Id: + return "StatusFlags"; + case chip::app::Clusters::BinaryInputBasic::Attributes::ApplicationType::Id: + return "ApplicationType"; + case chip::app::Clusters::BinaryInputBasic::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BinaryInputBasic::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BinaryInputBasic::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BinaryInputBasic::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BinaryInputBasic::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BinaryInputBasic::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PulseWidthModulation::Id: { + switch (id) + { + case chip::app::Clusters::PulseWidthModulation::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PulseWidthModulation::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PulseWidthModulation::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PulseWidthModulation::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PulseWidthModulation::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PulseWidthModulation::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Descriptor::Id: { + switch (id) + { + case chip::app::Clusters::Descriptor::Attributes::DeviceTypeList::Id: + return "DeviceTypeList"; + case chip::app::Clusters::Descriptor::Attributes::ServerList::Id: + return "ServerList"; + case chip::app::Clusters::Descriptor::Attributes::ClientList::Id: + return "ClientList"; + case chip::app::Clusters::Descriptor::Attributes::PartsList::Id: + return "PartsList"; + case chip::app::Clusters::Descriptor::Attributes::TagList::Id: + return "TagList"; + case chip::app::Clusters::Descriptor::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Descriptor::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Descriptor::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Descriptor::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Descriptor::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Descriptor::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Binding::Id: { + switch (id) + { + case chip::app::Clusters::Binding::Attributes::Binding::Id: + return "Binding"; + case chip::app::Clusters::Binding::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Binding::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Binding::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Binding::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Binding::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Binding::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccessControl::Id: { + switch (id) + { + case chip::app::Clusters::AccessControl::Attributes::Acl::Id: + return "Acl"; + case chip::app::Clusters::AccessControl::Attributes::Extension::Id: + return "Extension"; + case chip::app::Clusters::AccessControl::Attributes::SubjectsPerAccessControlEntry::Id: + return "SubjectsPerAccessControlEntry"; + case chip::app::Clusters::AccessControl::Attributes::TargetsPerAccessControlEntry::Id: + return "TargetsPerAccessControlEntry"; + case chip::app::Clusters::AccessControl::Attributes::AccessControlEntriesPerFabric::Id: + return "AccessControlEntriesPerFabric"; + case chip::app::Clusters::AccessControl::Attributes::CommissioningARL::Id: + return "CommissioningARL"; + case chip::app::Clusters::AccessControl::Attributes::Arl::Id: + return "Arl"; + case chip::app::Clusters::AccessControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::AccessControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::AccessControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::AccessControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::AccessControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::AccessControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Actions::Id: { + switch (id) + { + case chip::app::Clusters::Actions::Attributes::ActionList::Id: + return "ActionList"; + case chip::app::Clusters::Actions::Attributes::EndpointLists::Id: + return "EndpointLists"; + case chip::app::Clusters::Actions::Attributes::SetupURL::Id: + return "SetupURL"; + case chip::app::Clusters::Actions::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Actions::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Actions::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Actions::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Actions::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Actions::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BasicInformation::Id: { + switch (id) + { + case chip::app::Clusters::BasicInformation::Attributes::DataModelRevision::Id: + return "DataModelRevision"; + case chip::app::Clusters::BasicInformation::Attributes::VendorName::Id: + return "VendorName"; + case chip::app::Clusters::BasicInformation::Attributes::VendorID::Id: + return "VendorID"; + case chip::app::Clusters::BasicInformation::Attributes::ProductName::Id: + return "ProductName"; + case chip::app::Clusters::BasicInformation::Attributes::ProductID::Id: + return "ProductID"; + case chip::app::Clusters::BasicInformation::Attributes::NodeLabel::Id: + return "NodeLabel"; + case chip::app::Clusters::BasicInformation::Attributes::Location::Id: + return "Location"; + case chip::app::Clusters::BasicInformation::Attributes::HardwareVersion::Id: + return "HardwareVersion"; + case chip::app::Clusters::BasicInformation::Attributes::HardwareVersionString::Id: + return "HardwareVersionString"; + case chip::app::Clusters::BasicInformation::Attributes::SoftwareVersion::Id: + return "SoftwareVersion"; + case chip::app::Clusters::BasicInformation::Attributes::SoftwareVersionString::Id: + return "SoftwareVersionString"; + case chip::app::Clusters::BasicInformation::Attributes::ManufacturingDate::Id: + return "ManufacturingDate"; + case chip::app::Clusters::BasicInformation::Attributes::PartNumber::Id: + return "PartNumber"; + case chip::app::Clusters::BasicInformation::Attributes::ProductURL::Id: + return "ProductURL"; + case chip::app::Clusters::BasicInformation::Attributes::ProductLabel::Id: + return "ProductLabel"; + case chip::app::Clusters::BasicInformation::Attributes::SerialNumber::Id: + return "SerialNumber"; + case chip::app::Clusters::BasicInformation::Attributes::LocalConfigDisabled::Id: + return "LocalConfigDisabled"; + case chip::app::Clusters::BasicInformation::Attributes::Reachable::Id: + return "Reachable"; + case chip::app::Clusters::BasicInformation::Attributes::UniqueID::Id: + return "UniqueID"; + case chip::app::Clusters::BasicInformation::Attributes::CapabilityMinima::Id: + return "CapabilityMinima"; + case chip::app::Clusters::BasicInformation::Attributes::ProductAppearance::Id: + return "ProductAppearance"; + case chip::app::Clusters::BasicInformation::Attributes::SpecificationVersion::Id: + return "SpecificationVersion"; + case chip::app::Clusters::BasicInformation::Attributes::MaxPathsPerInvoke::Id: + return "MaxPathsPerInvoke"; + case chip::app::Clusters::BasicInformation::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BasicInformation::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BasicInformation::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BasicInformation::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BasicInformation::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BasicInformation::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OtaSoftwareUpdateProvider::Id: { + switch (id) + { + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Id: { + switch (id) + { + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOTAProviders::Id: + return "DefaultOTAProviders"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::Id: + return "UpdatePossible"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateState::Id: + return "UpdateState"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id: + return "UpdateStateProgress"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LocalizationConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::LocalizationConfiguration::Attributes::ActiveLocale::Id: + return "ActiveLocale"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::SupportedLocales::Id: + return "SupportedLocales"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LocalizationConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TimeFormatLocalization::Id: { + switch (id) + { + case chip::app::Clusters::TimeFormatLocalization::Attributes::HourFormat::Id: + return "HourFormat"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::ActiveCalendarType::Id: + return "ActiveCalendarType"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::SupportedCalendarTypes::Id: + return "SupportedCalendarTypes"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TimeFormatLocalization::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::UnitLocalization::Id: { + switch (id) + { + case chip::app::Clusters::UnitLocalization::Attributes::TemperatureUnit::Id: + return "TemperatureUnit"; + case chip::app::Clusters::UnitLocalization::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::UnitLocalization::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::UnitLocalization::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::UnitLocalization::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::UnitLocalization::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::UnitLocalization::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PowerSourceConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::PowerSourceConfiguration::Attributes::Sources::Id: + return "Sources"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PowerSourceConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PowerSource::Id: { + switch (id) + { + case chip::app::Clusters::PowerSource::Attributes::Status::Id: + return "Status"; + case chip::app::Clusters::PowerSource::Attributes::Order::Id: + return "Order"; + case chip::app::Clusters::PowerSource::Attributes::Description::Id: + return "Description"; + case chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputVoltage::Id: + return "WiredAssessedInputVoltage"; + case chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputFrequency::Id: + return "WiredAssessedInputFrequency"; + case chip::app::Clusters::PowerSource::Attributes::WiredCurrentType::Id: + return "WiredCurrentType"; + case chip::app::Clusters::PowerSource::Attributes::WiredAssessedCurrent::Id: + return "WiredAssessedCurrent"; + case chip::app::Clusters::PowerSource::Attributes::WiredNominalVoltage::Id: + return "WiredNominalVoltage"; + case chip::app::Clusters::PowerSource::Attributes::WiredMaximumCurrent::Id: + return "WiredMaximumCurrent"; + case chip::app::Clusters::PowerSource::Attributes::WiredPresent::Id: + return "WiredPresent"; + case chip::app::Clusters::PowerSource::Attributes::ActiveWiredFaults::Id: + return "ActiveWiredFaults"; + case chip::app::Clusters::PowerSource::Attributes::BatVoltage::Id: + return "BatVoltage"; + case chip::app::Clusters::PowerSource::Attributes::BatPercentRemaining::Id: + return "BatPercentRemaining"; + case chip::app::Clusters::PowerSource::Attributes::BatTimeRemaining::Id: + return "BatTimeRemaining"; + case chip::app::Clusters::PowerSource::Attributes::BatChargeLevel::Id: + return "BatChargeLevel"; + case chip::app::Clusters::PowerSource::Attributes::BatReplacementNeeded::Id: + return "BatReplacementNeeded"; + case chip::app::Clusters::PowerSource::Attributes::BatReplaceability::Id: + return "BatReplaceability"; + case chip::app::Clusters::PowerSource::Attributes::BatPresent::Id: + return "BatPresent"; + case chip::app::Clusters::PowerSource::Attributes::ActiveBatFaults::Id: + return "ActiveBatFaults"; + case chip::app::Clusters::PowerSource::Attributes::BatReplacementDescription::Id: + return "BatReplacementDescription"; + case chip::app::Clusters::PowerSource::Attributes::BatCommonDesignation::Id: + return "BatCommonDesignation"; + case chip::app::Clusters::PowerSource::Attributes::BatANSIDesignation::Id: + return "BatANSIDesignation"; + case chip::app::Clusters::PowerSource::Attributes::BatIECDesignation::Id: + return "BatIECDesignation"; + case chip::app::Clusters::PowerSource::Attributes::BatApprovedChemistry::Id: + return "BatApprovedChemistry"; + case chip::app::Clusters::PowerSource::Attributes::BatCapacity::Id: + return "BatCapacity"; + case chip::app::Clusters::PowerSource::Attributes::BatQuantity::Id: + return "BatQuantity"; + case chip::app::Clusters::PowerSource::Attributes::BatChargeState::Id: + return "BatChargeState"; + case chip::app::Clusters::PowerSource::Attributes::BatTimeToFullCharge::Id: + return "BatTimeToFullCharge"; + case chip::app::Clusters::PowerSource::Attributes::BatFunctionalWhileCharging::Id: + return "BatFunctionalWhileCharging"; + case chip::app::Clusters::PowerSource::Attributes::BatChargingCurrent::Id: + return "BatChargingCurrent"; + case chip::app::Clusters::PowerSource::Attributes::ActiveBatChargeFaults::Id: + return "ActiveBatChargeFaults"; + case chip::app::Clusters::PowerSource::Attributes::EndpointList::Id: + return "EndpointList"; + case chip::app::Clusters::PowerSource::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PowerSource::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PowerSource::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PowerSource::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PowerSource::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PowerSource::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::Id: + return "Breadcrumb"; + case chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfo::Id: + return "BasicCommissioningInfo"; + case chip::app::Clusters::GeneralCommissioning::Attributes::RegulatoryConfig::Id: + return "RegulatoryConfig"; + case chip::app::Clusters::GeneralCommissioning::Attributes::LocationCapability::Id: + return "LocationCapability"; + case chip::app::Clusters::GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id: + return "SupportsConcurrentConnection"; + case chip::app::Clusters::GeneralCommissioning::Attributes::TCAcceptedVersion::Id: + return "TCAcceptedVersion"; + case chip::app::Clusters::GeneralCommissioning::Attributes::TCMinRequiredVersion::Id: + return "TCMinRequiredVersion"; + case chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgements::Id: + return "TCAcknowledgements"; + case chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgementsRequired::Id: + return "TCAcknowledgementsRequired"; + case chip::app::Clusters::GeneralCommissioning::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::GeneralCommissioning::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::GeneralCommissioning::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::GeneralCommissioning::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::GeneralCommissioning::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::NetworkCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::NetworkCommissioning::Attributes::MaxNetworks::Id: + return "MaxNetworks"; + case chip::app::Clusters::NetworkCommissioning::Attributes::Networks::Id: + return "Networks"; + case chip::app::Clusters::NetworkCommissioning::Attributes::ScanMaxTimeSeconds::Id: + return "ScanMaxTimeSeconds"; + case chip::app::Clusters::NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::Id: + return "ConnectMaxTimeSeconds"; + case chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Id: + return "InterfaceEnabled"; + case chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkingStatus::Id: + return "LastNetworkingStatus"; + case chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkID::Id: + return "LastNetworkID"; + case chip::app::Clusters::NetworkCommissioning::Attributes::LastConnectErrorValue::Id: + return "LastConnectErrorValue"; + case chip::app::Clusters::NetworkCommissioning::Attributes::SupportedWiFiBands::Id: + return "SupportedWiFiBands"; + case chip::app::Clusters::NetworkCommissioning::Attributes::SupportedThreadFeatures::Id: + return "SupportedThreadFeatures"; + case chip::app::Clusters::NetworkCommissioning::Attributes::ThreadVersion::Id: + return "ThreadVersion"; + case chip::app::Clusters::NetworkCommissioning::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::NetworkCommissioning::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::NetworkCommissioning::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::NetworkCommissioning::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::NetworkCommissioning::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::NetworkCommissioning::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DiagnosticLogs::Id: { + switch (id) + { + case chip::app::Clusters::DiagnosticLogs::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DiagnosticLogs::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DiagnosticLogs::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DiagnosticLogs::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DiagnosticLogs::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::Id: + return "NetworkInterfaces"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::Id: + return "RebootCount"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::UpTime::Id: + return "UpTime"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::TotalOperationalHours::Id: + return "TotalOperationalHours"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::BootReason::Id: + return "BootReason"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveHardwareFaults::Id: + return "ActiveHardwareFaults"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveRadioFaults::Id: + return "ActiveRadioFaults"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveNetworkFaults::Id: + return "ActiveNetworkFaults"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id: + return "TestEventTriggersEnabled"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SoftwareDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::SoftwareDiagnostics::Attributes::ThreadMetrics::Id: + return "ThreadMetrics"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapFree::Id: + return "CurrentHeapFree"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id: + return "CurrentHeapUsed"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::Id: + return "CurrentHeapHighWatermark"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::SoftwareDiagnostics::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::Id: + return "Channel"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::Id: + return "RoutingRole"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::Id: + return "NetworkName"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::Id: + return "PanId"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id: + return "ExtendedPanId"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::Id: + return "MeshLocalPrefix"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::Id: + return "OverrunCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTable::Id: + return "NeighborTable"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTable::Id: + return "RouteTable"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::Id: + return "PartitionId"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::Id: + return "Weighting"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::Id: + return "DataVersion"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id: + return "StableDataVersion"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id: + return "LeaderRouterId"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id: + return "DetachedRoleCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id: + return "ChildRoleCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id: + return "RouterRoleCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id: + return "LeaderRoleCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id: + return "AttachAttemptCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id: + return "PartitionIdChangeCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id: + return "BetterPartitionAttachAttemptCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id: + return "ParentChangeCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id: + return "TxTotalCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id: + return "TxUnicastCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id: + return "TxBroadcastCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id: + return "TxAckRequestedCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id: + return "TxAckedCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id: + return "TxNoAckRequestedCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::Id: + return "TxDataCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id: + return "TxDataPollCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id: + return "TxBeaconCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id: + return "TxBeaconRequestCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id: + return "TxOtherCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id: + return "TxRetryCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id: + return "TxDirectMaxRetryExpiryCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id: + return "TxIndirectMaxRetryExpiryCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id: + return "TxErrCcaCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id: + return "TxErrAbortCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id: + return "TxErrBusyChannelCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id: + return "RxTotalCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id: + return "RxUnicastCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id: + return "RxBroadcastCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::Id: + return "RxDataCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id: + return "RxDataPollCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id: + return "RxBeaconCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id: + return "RxBeaconRequestCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id: + return "RxOtherCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id: + return "RxAddressFilteredCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id: + return "RxDestAddrFilteredCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id: + return "RxDuplicatedCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id: + return "RxErrNoFrameCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id: + return "RxErrUnknownNeighborCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id: + return "RxErrInvalidSrcAddrCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id: + return "RxErrSecCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id: + return "RxErrFcsCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id: + return "RxErrOtherCount"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id: + return "ActiveTimestamp"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id: + return "PendingTimestamp"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::Id: + return "Delay"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::Id: + return "SecurityPolicy"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::Id: + return "ChannelPage0Mask"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::Id: + return "OperationalDatasetComponents"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::Id: + return "ActiveNetworkFaultsList"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WiFiNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Bssid::Id: + return "Bssid"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::SecurityType::Id: + return "SecurityType"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id: + return "WiFiVersion"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id: + return "ChannelNumber"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Rssi::Id: + return "Rssi"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id: + return "BeaconLostCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id: + return "BeaconRxCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id: + return "PacketMulticastRxCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id: + return "PacketMulticastTxCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id: + return "PacketUnicastRxCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id: + return "PacketUnicastTxCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id: + return "CurrentMaxRate"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::OverrunCount::Id: + return "OverrunCount"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EthernetNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PHYRate::Id: + return "PHYRate"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FullDuplex::Id: + return "FullDuplex"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id: + return "PacketRxCount"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id: + return "PacketTxCount"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TxErrCount::Id: + return "TxErrCount"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CollisionCount::Id: + return "CollisionCount"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::OverrunCount::Id: + return "OverrunCount"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id: + return "CarrierDetect"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id: + return "TimeSinceReset"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TimeSynchronization::Id: { + switch (id) + { + case chip::app::Clusters::TimeSynchronization::Attributes::UTCTime::Id: + return "UTCTime"; + case chip::app::Clusters::TimeSynchronization::Attributes::Granularity::Id: + return "Granularity"; + case chip::app::Clusters::TimeSynchronization::Attributes::TimeSource::Id: + return "TimeSource"; + case chip::app::Clusters::TimeSynchronization::Attributes::TrustedTimeSource::Id: + return "TrustedTimeSource"; + case chip::app::Clusters::TimeSynchronization::Attributes::DefaultNTP::Id: + return "DefaultNTP"; + case chip::app::Clusters::TimeSynchronization::Attributes::TimeZone::Id: + return "TimeZone"; + case chip::app::Clusters::TimeSynchronization::Attributes::DSTOffset::Id: + return "DSTOffset"; + case chip::app::Clusters::TimeSynchronization::Attributes::LocalTime::Id: + return "LocalTime"; + case chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneDatabase::Id: + return "TimeZoneDatabase"; + case chip::app::Clusters::TimeSynchronization::Attributes::NTPServerAvailable::Id: + return "NTPServerAvailable"; + case chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneListMaxSize::Id: + return "TimeZoneListMaxSize"; + case chip::app::Clusters::TimeSynchronization::Attributes::DSTOffsetListMaxSize::Id: + return "DSTOffsetListMaxSize"; + case chip::app::Clusters::TimeSynchronization::Attributes::SupportsDNSResolve::Id: + return "SupportsDNSResolve"; + case chip::app::Clusters::TimeSynchronization::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TimeSynchronization::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TimeSynchronization::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TimeSynchronization::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TimeSynchronization::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TimeSynchronization::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BridgedDeviceBasicInformation::Id: { + switch (id) + { + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorName::Id: + return "VendorName"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorID::Id: + return "VendorID"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductName::Id: + return "ProductName"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductID::Id: + return "ProductID"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::NodeLabel::Id: + return "NodeLabel"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersion::Id: + return "HardwareVersion"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersionString::Id: + return "HardwareVersionString"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersion::Id: + return "SoftwareVersion"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersionString::Id: + return "SoftwareVersionString"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ManufacturingDate::Id: + return "ManufacturingDate"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::PartNumber::Id: + return "PartNumber"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductURL::Id: + return "ProductURL"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductLabel::Id: + return "ProductLabel"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SerialNumber::Id: + return "SerialNumber"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::Reachable::Id: + return "Reachable"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::UniqueID::Id: + return "UniqueID"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductAppearance::Id: + return "ProductAppearance"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Switch::Id: { + switch (id) + { + case chip::app::Clusters::Switch::Attributes::NumberOfPositions::Id: + return "NumberOfPositions"; + case chip::app::Clusters::Switch::Attributes::CurrentPosition::Id: + return "CurrentPosition"; + case chip::app::Clusters::Switch::Attributes::MultiPressMax::Id: + return "MultiPressMax"; + case chip::app::Clusters::Switch::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Switch::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Switch::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Switch::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Switch::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Switch::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AdministratorCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::Id: + return "WindowStatus"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::Id: + return "AdminFabricIndex"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id: + return "AdminVendorId"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::AdministratorCommissioning::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalCredentials::Id: { + switch (id) + { + case chip::app::Clusters::OperationalCredentials::Attributes::NOCs::Id: + return "NOCs"; + case chip::app::Clusters::OperationalCredentials::Attributes::Fabrics::Id: + return "Fabrics"; + case chip::app::Clusters::OperationalCredentials::Attributes::SupportedFabrics::Id: + return "SupportedFabrics"; + case chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::Id: + return "CommissionedFabrics"; + case chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::Id: + return "TrustedRootCertificates"; + case chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::Id: + return "CurrentFabricIndex"; + case chip::app::Clusters::OperationalCredentials::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OperationalCredentials::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OperationalCredentials::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OperationalCredentials::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OperationalCredentials::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OperationalCredentials::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GroupKeyManagement::Id: { + switch (id) + { + case chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::Id: + return "GroupKeyMap"; + case chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::Id: + return "GroupTable"; + case chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id: + return "MaxGroupsPerFabric"; + case chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id: + return "MaxGroupKeysPerFabric"; + case chip::app::Clusters::GroupKeyManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::GroupKeyManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::GroupKeyManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::GroupKeyManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::GroupKeyManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FixedLabel::Id: { + switch (id) + { + case chip::app::Clusters::FixedLabel::Attributes::LabelList::Id: + return "LabelList"; + case chip::app::Clusters::FixedLabel::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::FixedLabel::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::FixedLabel::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::FixedLabel::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::FixedLabel::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::FixedLabel::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::UserLabel::Id: { + switch (id) + { + case chip::app::Clusters::UserLabel::Attributes::LabelList::Id: + return "LabelList"; + case chip::app::Clusters::UserLabel::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::UserLabel::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::UserLabel::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::UserLabel::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::UserLabel::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::UserLabel::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ProxyConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::ProxyConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ProxyConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ProxyConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ProxyConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ProxyConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ProxyConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ProxyDiscovery::Id: { + switch (id) + { + case chip::app::Clusters::ProxyDiscovery::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ProxyDiscovery::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ProxyDiscovery::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ProxyDiscovery::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ProxyDiscovery::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ProxyDiscovery::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ProxyValid::Id: { + switch (id) + { + case chip::app::Clusters::ProxyValid::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ProxyValid::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ProxyValid::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ProxyValid::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ProxyValid::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ProxyValid::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BooleanState::Id: { + switch (id) + { + case chip::app::Clusters::BooleanState::Attributes::StateValue::Id: + return "StateValue"; + case chip::app::Clusters::BooleanState::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BooleanState::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BooleanState::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BooleanState::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BooleanState::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BooleanState::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::IcdManagement::Id: { + switch (id) + { + case chip::app::Clusters::IcdManagement::Attributes::IdleModeDuration::Id: + return "IdleModeDuration"; + case chip::app::Clusters::IcdManagement::Attributes::ActiveModeDuration::Id: + return "ActiveModeDuration"; + case chip::app::Clusters::IcdManagement::Attributes::ActiveModeThreshold::Id: + return "ActiveModeThreshold"; + case chip::app::Clusters::IcdManagement::Attributes::RegisteredClients::Id: + return "RegisteredClients"; + case chip::app::Clusters::IcdManagement::Attributes::ICDCounter::Id: + return "ICDCounter"; + case chip::app::Clusters::IcdManagement::Attributes::ClientsSupportedPerFabric::Id: + return "ClientsSupportedPerFabric"; + case chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Id: + return "UserActiveModeTriggerHint"; + case chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Id: + return "UserActiveModeTriggerInstruction"; + case chip::app::Clusters::IcdManagement::Attributes::OperatingMode::Id: + return "OperatingMode"; + case chip::app::Clusters::IcdManagement::Attributes::MaximumCheckInBackOff::Id: + return "MaximumCheckInBackOff"; + case chip::app::Clusters::IcdManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::IcdManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::IcdManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::IcdManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::IcdManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::IcdManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Timer::Id: { + switch (id) + { + case chip::app::Clusters::Timer::Attributes::SetTime::Id: + return "SetTime"; + case chip::app::Clusters::Timer::Attributes::TimeRemaining::Id: + return "TimeRemaining"; + case chip::app::Clusters::Timer::Attributes::TimerState::Id: + return "TimerState"; + case chip::app::Clusters::Timer::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Timer::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Timer::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Timer::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Timer::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Timer::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenCavityOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OvenCavityOperationalState::Attributes::PhaseList::Id: + return "PhaseList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::CurrentPhase::Id: + return "CurrentPhase"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::CountdownTime::Id: + return "CountdownTime"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalStateList::Id: + return "OperationalStateList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalState::Id: + return "OperationalState"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalError::Id: + return "OperationalError"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OvenCavityOperationalState::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenMode::Id: { + switch (id) + { + case chip::app::Clusters::OvenMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::OvenMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::OvenMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::OvenMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::OvenMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OvenMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OvenMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OvenMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OvenMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OvenMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LaundryDryerControls::Id: { + switch (id) + { + case chip::app::Clusters::LaundryDryerControls::Attributes::SupportedDrynessLevels::Id: + return "SupportedDrynessLevels"; + case chip::app::Clusters::LaundryDryerControls::Attributes::SelectedDrynessLevel::Id: + return "SelectedDrynessLevel"; + case chip::app::Clusters::LaundryDryerControls::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LaundryDryerControls::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LaundryDryerControls::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LaundryDryerControls::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LaundryDryerControls::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LaundryDryerControls::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ModeSelect::Id: { + switch (id) + { + case chip::app::Clusters::ModeSelect::Attributes::Description::Id: + return "Description"; + case chip::app::Clusters::ModeSelect::Attributes::StandardNamespace::Id: + return "StandardNamespace"; + case chip::app::Clusters::ModeSelect::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::ModeSelect::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::ModeSelect::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::ModeSelect::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::ModeSelect::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ModeSelect::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ModeSelect::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ModeSelect::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ModeSelect::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LaundryWasherMode::Id: { + switch (id) + { + case chip::app::Clusters::LaundryWasherMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::LaundryWasherMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::LaundryWasherMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::LaundryWasherMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::LaundryWasherMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LaundryWasherMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LaundryWasherMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LaundryWasherMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LaundryWasherMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LaundryWasherMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id: { + switch (id) + { + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LaundryWasherControls::Id: { + switch (id) + { + case chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeeds::Id: + return "SpinSpeeds"; + case chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeedCurrent::Id: + return "SpinSpeedCurrent"; + case chip::app::Clusters::LaundryWasherControls::Attributes::NumberOfRinses::Id: + return "NumberOfRinses"; + case chip::app::Clusters::LaundryWasherControls::Attributes::SupportedRinses::Id: + return "SupportedRinses"; + case chip::app::Clusters::LaundryWasherControls::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LaundryWasherControls::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LaundryWasherControls::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LaundryWasherControls::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LaundryWasherControls::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LaundryWasherControls::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcRunMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcRunMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::RvcRunMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RvcRunMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RvcRunMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RvcRunMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RvcRunMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RvcRunMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcCleanMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcCleanMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::RvcCleanMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RvcCleanMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RvcCleanMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RvcCleanMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RvcCleanMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RvcCleanMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TemperatureControl::Id: { + switch (id) + { + case chip::app::Clusters::TemperatureControl::Attributes::TemperatureSetpoint::Id: + return "TemperatureSetpoint"; + case chip::app::Clusters::TemperatureControl::Attributes::MinTemperature::Id: + return "MinTemperature"; + case chip::app::Clusters::TemperatureControl::Attributes::MaxTemperature::Id: + return "MaxTemperature"; + case chip::app::Clusters::TemperatureControl::Attributes::Step::Id: + return "Step"; + case chip::app::Clusters::TemperatureControl::Attributes::SelectedTemperatureLevel::Id: + return "SelectedTemperatureLevel"; + case chip::app::Clusters::TemperatureControl::Attributes::SupportedTemperatureLevels::Id: + return "SupportedTemperatureLevels"; + case chip::app::Clusters::TemperatureControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TemperatureControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TemperatureControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TemperatureControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TemperatureControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TemperatureControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RefrigeratorAlarm::Id: { + switch (id) + { + case chip::app::Clusters::RefrigeratorAlarm::Attributes::Mask::Id: + return "Mask"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::State::Id: + return "State"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::Supported::Id: + return "Supported"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RefrigeratorAlarm::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DishwasherMode::Id: { + switch (id) + { + case chip::app::Clusters::DishwasherMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::DishwasherMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::DishwasherMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::DishwasherMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::DishwasherMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DishwasherMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DishwasherMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DishwasherMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DishwasherMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DishwasherMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AirQuality::Id: { + switch (id) + { + case chip::app::Clusters::AirQuality::Attributes::AirQuality::Id: + return "AirQuality"; + case chip::app::Clusters::AirQuality::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::AirQuality::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::AirQuality::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::AirQuality::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::AirQuality::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::AirQuality::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SmokeCoAlarm::Id: { + switch (id) + { + case chip::app::Clusters::SmokeCoAlarm::Attributes::ExpressedState::Id: + return "ExpressedState"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeState::Id: + return "SmokeState"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::COState::Id: + return "COState"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::BatteryAlert::Id: + return "BatteryAlert"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::DeviceMuted::Id: + return "DeviceMuted"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::TestInProgress::Id: + return "TestInProgress"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::HardwareFaultAlert::Id: + return "HardwareFaultAlert"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::EndOfServiceAlert::Id: + return "EndOfServiceAlert"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id: + return "InterconnectSmokeAlarm"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id: + return "InterconnectCOAlarm"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::ContaminationState::Id: + return "ContaminationState"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id: + return "SmokeSensitivityLevel"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::ExpiryDate::Id: + return "ExpiryDate"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::SmokeCoAlarm::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DishwasherAlarm::Id: { + switch (id) + { + case chip::app::Clusters::DishwasherAlarm::Attributes::Mask::Id: + return "Mask"; + case chip::app::Clusters::DishwasherAlarm::Attributes::Latch::Id: + return "Latch"; + case chip::app::Clusters::DishwasherAlarm::Attributes::State::Id: + return "State"; + case chip::app::Clusters::DishwasherAlarm::Attributes::Supported::Id: + return "Supported"; + case chip::app::Clusters::DishwasherAlarm::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DishwasherAlarm::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DishwasherAlarm::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DishwasherAlarm::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DishwasherAlarm::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DishwasherAlarm::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MicrowaveOvenMode::Id: { + switch (id) + { + case chip::app::Clusters::MicrowaveOvenMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::MicrowaveOvenMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MicrowaveOvenControl::Id: { + switch (id) + { + case chip::app::Clusters::MicrowaveOvenControl::Attributes::CookTime::Id: + return "CookTime"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxCookTime::Id: + return "MaxCookTime"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerSetting::Id: + return "PowerSetting"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::MinPower::Id: + return "MinPower"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxPower::Id: + return "MaxPower"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerStep::Id: + return "PowerStep"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::SupportedWatts::Id: + return "SupportedWatts"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::SelectedWattIndex::Id: + return "SelectedWattIndex"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::WattRating::Id: + return "WattRating"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::MicrowaveOvenControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OperationalState::Attributes::PhaseList::Id: + return "PhaseList"; + case chip::app::Clusters::OperationalState::Attributes::CurrentPhase::Id: + return "CurrentPhase"; + case chip::app::Clusters::OperationalState::Attributes::CountdownTime::Id: + return "CountdownTime"; + case chip::app::Clusters::OperationalState::Attributes::OperationalStateList::Id: + return "OperationalStateList"; + case chip::app::Clusters::OperationalState::Attributes::OperationalState::Id: + return "OperationalState"; + case chip::app::Clusters::OperationalState::Attributes::OperationalError::Id: + return "OperationalError"; + case chip::app::Clusters::OperationalState::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OperationalState::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OperationalState::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OperationalState::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OperationalState::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OperationalState::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::RvcOperationalState::Attributes::PhaseList::Id: + return "PhaseList"; + case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: + return "CurrentPhase"; + case chip::app::Clusters::RvcOperationalState::Attributes::CountdownTime::Id: + return "CountdownTime"; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalStateList::Id: + return "OperationalStateList"; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: + return "OperationalState"; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalError::Id: + return "OperationalError"; + case chip::app::Clusters::RvcOperationalState::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RvcOperationalState::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RvcOperationalState::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RvcOperationalState::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RvcOperationalState::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RvcOperationalState::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ScenesManagement::Id: { + switch (id) + { + case chip::app::Clusters::ScenesManagement::Attributes::LastConfiguredBy::Id: + return "LastConfiguredBy"; + case chip::app::Clusters::ScenesManagement::Attributes::SceneTableSize::Id: + return "SceneTableSize"; + case chip::app::Clusters::ScenesManagement::Attributes::FabricSceneInfo::Id: + return "FabricSceneInfo"; + case chip::app::Clusters::ScenesManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ScenesManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ScenesManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ScenesManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ScenesManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ScenesManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::HepaFilterMonitoring::Id: { + switch (id) + { + case chip::app::Clusters::HepaFilterMonitoring::Attributes::Condition::Id: + return "Condition"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::DegradationDirection::Id: + return "DegradationDirection"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::ChangeIndication::Id: + return "ChangeIndication"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::InPlaceIndicator::Id: + return "InPlaceIndicator"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::LastChangedTime::Id: + return "LastChangedTime"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::ReplacementProductList::Id: + return "ReplacementProductList"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::HepaFilterMonitoring::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id: { + switch (id) + { + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::Condition::Id: + return "Condition"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id: + return "DegradationDirection"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ChangeIndication::Id: + return "ChangeIndication"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::InPlaceIndicator::Id: + return "InPlaceIndicator"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::LastChangedTime::Id: + return "LastChangedTime"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id: + return "ReplacementProductList"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BooleanStateConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::BooleanStateConfiguration::Attributes::CurrentSensitivityLevel::Id: + return "CurrentSensitivityLevel"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::SupportedSensitivityLevels::Id: + return "SupportedSensitivityLevels"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::DefaultSensitivityLevel::Id: + return "DefaultSensitivityLevel"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsActive::Id: + return "AlarmsActive"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSuppressed::Id: + return "AlarmsSuppressed"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsEnabled::Id: + return "AlarmsEnabled"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSupported::Id: + return "AlarmsSupported"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::SensorFault::Id: + return "SensorFault"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BooleanStateConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ValveConfigurationAndControl::Id: { + switch (id) + { + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id: + return "OpenDuration"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::Id: + return "DefaultOpenDuration"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::AutoCloseTime::Id: + return "AutoCloseTime"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::RemainingDuration::Id: + return "RemainingDuration"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentState::Id: + return "CurrentState"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetState::Id: + return "TargetState"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentLevel::Id: + return "CurrentLevel"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetLevel::Id: + return "TargetLevel"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::Id: + return "DefaultOpenLevel"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::ValveFault::Id: + return "ValveFault"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::LevelStep::Id: + return "LevelStep"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ValveConfigurationAndControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ElectricalPowerMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerMode::Id: + return "PowerMode"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::Id: + return "NumberOfMeasurementTypes"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Accuracy::Id: + return "Accuracy"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Ranges::Id: + return "Ranges"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Voltage::Id: + return "Voltage"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id: + return "ActiveCurrent"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id: + return "ReactiveCurrent"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id: + return "ApparentCurrent"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActivePower::Id: + return "ActivePower"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactivePower::Id: + return "ReactivePower"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentPower::Id: + return "ApparentPower"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSVoltage::Id: + return "RMSVoltage"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSCurrent::Id: + return "RMSCurrent"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSPower::Id: + return "RMSPower"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Frequency::Id: + return "Frequency"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicCurrents::Id: + return "HarmonicCurrents"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicPhases::Id: + return "HarmonicPhases"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerFactor::Id: + return "PowerFactor"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id: + return "NeutralCurrent"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ElectricalEnergyMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::Accuracy::Id: + return "Accuracy"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id: + return "CumulativeEnergyImported"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id: + return "CumulativeEnergyExported"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id: + return "PeriodicEnergyImported"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id: + return "PeriodicEnergyExported"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::Id: + return "CumulativeEnergyReset"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WaterHeaterManagement::Id: { + switch (id) + { + case chip::app::Clusters::WaterHeaterManagement::Attributes::HeaterTypes::Id: + return "HeaterTypes"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::HeatDemand::Id: + return "HeatDemand"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::TankVolume::Id: + return "TankVolume"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::EstimatedHeatRequired::Id: + return "EstimatedHeatRequired"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::TankPercentage::Id: + return "TankPercentage"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::BoostState::Id: + return "BoostState"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WaterHeaterManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DemandResponseLoadControl::Id: { + switch (id) + { + case chip::app::Clusters::DemandResponseLoadControl::Attributes::LoadControlPrograms::Id: + return "LoadControlPrograms"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::Id: + return "NumberOfLoadControlPrograms"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::Events::Id: + return "Events"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::ActiveEvents::Id: + return "ActiveEvents"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::Id: + return "NumberOfEventsPerProgram"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfTransitions::Id: + return "NumberOfTransitions"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::Id: + return "DefaultRandomStart"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id: + return "DefaultRandomDuration"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DemandResponseLoadControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Messages::Id: { + switch (id) + { + case chip::app::Clusters::Messages::Attributes::Messages::Id: + return "Messages"; + case chip::app::Clusters::Messages::Attributes::ActiveMessageIDs::Id: + return "ActiveMessageIDs"; + case chip::app::Clusters::Messages::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Messages::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Messages::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Messages::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Messages::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Messages::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DeviceEnergyManagement::Id: { + switch (id) + { + case chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAType::Id: + return "ESAType"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::ESACanGenerate::Id: + return "ESACanGenerate"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAState::Id: + return "ESAState"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMinPower::Id: + return "AbsMinPower"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMaxPower::Id: + return "AbsMaxPower"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::Id: + return "PowerAdjustmentCapability"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::Forecast::Id: + return "Forecast"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::OptOutState::Id: + return "OptOutState"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DeviceEnergyManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvse::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvse::Attributes::State::Id: + return "State"; + case chip::app::Clusters::EnergyEvse::Attributes::SupplyState::Id: + return "SupplyState"; + case chip::app::Clusters::EnergyEvse::Attributes::FaultState::Id: + return "FaultState"; + case chip::app::Clusters::EnergyEvse::Attributes::ChargingEnabledUntil::Id: + return "ChargingEnabledUntil"; + case chip::app::Clusters::EnergyEvse::Attributes::DischargingEnabledUntil::Id: + return "DischargingEnabledUntil"; + case chip::app::Clusters::EnergyEvse::Attributes::CircuitCapacity::Id: + return "CircuitCapacity"; + case chip::app::Clusters::EnergyEvse::Attributes::MinimumChargeCurrent::Id: + return "MinimumChargeCurrent"; + case chip::app::Clusters::EnergyEvse::Attributes::MaximumChargeCurrent::Id: + return "MaximumChargeCurrent"; + case chip::app::Clusters::EnergyEvse::Attributes::MaximumDischargeCurrent::Id: + return "MaximumDischargeCurrent"; + case chip::app::Clusters::EnergyEvse::Attributes::UserMaximumChargeCurrent::Id: + return "UserMaximumChargeCurrent"; + case chip::app::Clusters::EnergyEvse::Attributes::RandomizationDelayWindow::Id: + return "RandomizationDelayWindow"; + case chip::app::Clusters::EnergyEvse::Attributes::NextChargeStartTime::Id: + return "NextChargeStartTime"; + case chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetTime::Id: + return "NextChargeTargetTime"; + case chip::app::Clusters::EnergyEvse::Attributes::NextChargeRequiredEnergy::Id: + return "NextChargeRequiredEnergy"; + case chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetSoC::Id: + return "NextChargeTargetSoC"; + case chip::app::Clusters::EnergyEvse::Attributes::ApproximateEVEfficiency::Id: + return "ApproximateEVEfficiency"; + case chip::app::Clusters::EnergyEvse::Attributes::StateOfCharge::Id: + return "StateOfCharge"; + case chip::app::Clusters::EnergyEvse::Attributes::BatteryCapacity::Id: + return "BatteryCapacity"; + case chip::app::Clusters::EnergyEvse::Attributes::VehicleID::Id: + return "VehicleID"; + case chip::app::Clusters::EnergyEvse::Attributes::SessionID::Id: + return "SessionID"; + case chip::app::Clusters::EnergyEvse::Attributes::SessionDuration::Id: + return "SessionDuration"; + case chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyCharged::Id: + return "SessionEnergyCharged"; + case chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyDischarged::Id: + return "SessionEnergyDischarged"; + case chip::app::Clusters::EnergyEvse::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EnergyEvse::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EnergyEvse::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EnergyEvse::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EnergyEvse::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EnergyEvse::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyPreference::Id: { + switch (id) + { + case chip::app::Clusters::EnergyPreference::Attributes::EnergyBalances::Id: + return "EnergyBalances"; + case chip::app::Clusters::EnergyPreference::Attributes::CurrentEnergyBalance::Id: + return "CurrentEnergyBalance"; + case chip::app::Clusters::EnergyPreference::Attributes::EnergyPriorities::Id: + return "EnergyPriorities"; + case chip::app::Clusters::EnergyPreference::Attributes::LowPowerModeSensitivities::Id: + return "LowPowerModeSensitivities"; + case chip::app::Clusters::EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::Id: + return "CurrentLowPowerModeSensitivity"; + case chip::app::Clusters::EnergyPreference::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EnergyPreference::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EnergyPreference::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EnergyPreference::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EnergyPreference::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EnergyPreference::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PowerTopology::Id: { + switch (id) + { + case chip::app::Clusters::PowerTopology::Attributes::AvailableEndpoints::Id: + return "AvailableEndpoints"; + case chip::app::Clusters::PowerTopology::Attributes::ActiveEndpoints::Id: + return "ActiveEndpoints"; + case chip::app::Clusters::PowerTopology::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PowerTopology::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PowerTopology::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PowerTopology::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PowerTopology::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PowerTopology::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvseMode::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvseMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::EnergyEvseMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::EnergyEvseMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::EnergyEvseMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::EnergyEvseMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EnergyEvseMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EnergyEvseMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EnergyEvseMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EnergyEvseMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EnergyEvseMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WaterHeaterMode::Id: { + switch (id) + { + case chip::app::Clusters::WaterHeaterMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::WaterHeaterMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::WaterHeaterMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WaterHeaterMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WaterHeaterMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WaterHeaterMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WaterHeaterMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WaterHeaterMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DeviceEnergyManagementMode::Id: { + switch (id) + { + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::SupportedModes::Id: + return "SupportedModes"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::CurrentMode::Id: + return "CurrentMode"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::StartUpMode::Id: + return "StartUpMode"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::OnMode::Id: + return "OnMode"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DeviceEnergyManagementMode::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DoorLock::Id: { + switch (id) + { + case chip::app::Clusters::DoorLock::Attributes::LockState::Id: + return "LockState"; + case chip::app::Clusters::DoorLock::Attributes::LockType::Id: + return "LockType"; + case chip::app::Clusters::DoorLock::Attributes::ActuatorEnabled::Id: + return "ActuatorEnabled"; + case chip::app::Clusters::DoorLock::Attributes::DoorState::Id: + return "DoorState"; + case chip::app::Clusters::DoorLock::Attributes::DoorOpenEvents::Id: + return "DoorOpenEvents"; + case chip::app::Clusters::DoorLock::Attributes::DoorClosedEvents::Id: + return "DoorClosedEvents"; + case chip::app::Clusters::DoorLock::Attributes::OpenPeriod::Id: + return "OpenPeriod"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfTotalUsersSupported::Id: + return "NumberOfTotalUsersSupported"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfPINUsersSupported::Id: + return "NumberOfPINUsersSupported"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfRFIDUsersSupported::Id: + return "NumberOfRFIDUsersSupported"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id: + return "NumberOfWeekDaySchedulesSupportedPerUser"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id: + return "NumberOfYearDaySchedulesSupportedPerUser"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id: + return "NumberOfHolidaySchedulesSupported"; + case chip::app::Clusters::DoorLock::Attributes::MaxPINCodeLength::Id: + return "MaxPINCodeLength"; + case chip::app::Clusters::DoorLock::Attributes::MinPINCodeLength::Id: + return "MinPINCodeLength"; + case chip::app::Clusters::DoorLock::Attributes::MaxRFIDCodeLength::Id: + return "MaxRFIDCodeLength"; + case chip::app::Clusters::DoorLock::Attributes::MinRFIDCodeLength::Id: + return "MinRFIDCodeLength"; + case chip::app::Clusters::DoorLock::Attributes::CredentialRulesSupport::Id: + return "CredentialRulesSupport"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Id: + return "NumberOfCredentialsSupportedPerUser"; + case chip::app::Clusters::DoorLock::Attributes::Language::Id: + return "Language"; + case chip::app::Clusters::DoorLock::Attributes::LEDSettings::Id: + return "LEDSettings"; + case chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::Id: + return "AutoRelockTime"; + case chip::app::Clusters::DoorLock::Attributes::SoundVolume::Id: + return "SoundVolume"; + case chip::app::Clusters::DoorLock::Attributes::OperatingMode::Id: + return "OperatingMode"; + case chip::app::Clusters::DoorLock::Attributes::SupportedOperatingModes::Id: + return "SupportedOperatingModes"; + case chip::app::Clusters::DoorLock::Attributes::DefaultConfigurationRegister::Id: + return "DefaultConfigurationRegister"; + case chip::app::Clusters::DoorLock::Attributes::EnableLocalProgramming::Id: + return "EnableLocalProgramming"; + case chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::Id: + return "EnableOneTouchLocking"; + case chip::app::Clusters::DoorLock::Attributes::EnableInsideStatusLED::Id: + return "EnableInsideStatusLED"; + case chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::Id: + return "EnablePrivacyModeButton"; + case chip::app::Clusters::DoorLock::Attributes::LocalProgrammingFeatures::Id: + return "LocalProgrammingFeatures"; + case chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::Id: + return "WrongCodeEntryLimit"; + case chip::app::Clusters::DoorLock::Attributes::UserCodeTemporaryDisableTime::Id: + return "UserCodeTemporaryDisableTime"; + case chip::app::Clusters::DoorLock::Attributes::SendPINOverTheAir::Id: + return "SendPINOverTheAir"; + case chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Id: + return "RequirePINforRemoteOperation"; + case chip::app::Clusters::DoorLock::Attributes::ExpiringUserTimeout::Id: + return "ExpiringUserTimeout"; + case chip::app::Clusters::DoorLock::Attributes::AliroReaderVerificationKey::Id: + return "AliroReaderVerificationKey"; + case chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupIdentifier::Id: + return "AliroReaderGroupIdentifier"; + case chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupSubIdentifier::Id: + return "AliroReaderGroupSubIdentifier"; + case chip::app::Clusters::DoorLock::Attributes::AliroExpeditedTransactionSupportedProtocolVersions::Id: + return "AliroExpeditedTransactionSupportedProtocolVersions"; + case chip::app::Clusters::DoorLock::Attributes::AliroGroupResolvingKey::Id: + return "AliroGroupResolvingKey"; + case chip::app::Clusters::DoorLock::Attributes::AliroSupportedBLEUWBProtocolVersions::Id: + return "AliroSupportedBLEUWBProtocolVersions"; + case chip::app::Clusters::DoorLock::Attributes::AliroBLEAdvertisingVersion::Id: + return "AliroBLEAdvertisingVersion"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfAliroCredentialIssuerKeysSupported::Id: + return "NumberOfAliroCredentialIssuerKeysSupported"; + case chip::app::Clusters::DoorLock::Attributes::NumberOfAliroEndpointKeysSupported::Id: + return "NumberOfAliroEndpointKeysSupported"; + case chip::app::Clusters::DoorLock::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::DoorLock::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::DoorLock::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::DoorLock::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::DoorLock::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::DoorLock::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WindowCovering::Id: { + switch (id) + { + case chip::app::Clusters::WindowCovering::Attributes::Type::Id: + return "Type"; + case chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitLift::Id: + return "PhysicalClosedLimitLift"; + case chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitTilt::Id: + return "PhysicalClosedLimitTilt"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLift::Id: + return "CurrentPositionLift"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTilt::Id: + return "CurrentPositionTilt"; + case chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsLift::Id: + return "NumberOfActuationsLift"; + case chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsTilt::Id: + return "NumberOfActuationsTilt"; + case chip::app::Clusters::WindowCovering::Attributes::ConfigStatus::Id: + return "ConfigStatus"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercentage::Id: + return "CurrentPositionLiftPercentage"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercentage::Id: + return "CurrentPositionTiltPercentage"; + case chip::app::Clusters::WindowCovering::Attributes::OperationalStatus::Id: + return "OperationalStatus"; + case chip::app::Clusters::WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id: + return "TargetPositionLiftPercent100ths"; + case chip::app::Clusters::WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id: + return "TargetPositionTiltPercent100ths"; + case chip::app::Clusters::WindowCovering::Attributes::EndProductType::Id: + return "EndProductType"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id: + return "CurrentPositionLiftPercent100ths"; + case chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id: + return "CurrentPositionTiltPercent100ths"; + case chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitLift::Id: + return "InstalledOpenLimitLift"; + case chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitLift::Id: + return "InstalledClosedLimitLift"; + case chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitTilt::Id: + return "InstalledOpenLimitTilt"; + case chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitTilt::Id: + return "InstalledClosedLimitTilt"; + case chip::app::Clusters::WindowCovering::Attributes::Mode::Id: + return "Mode"; + case chip::app::Clusters::WindowCovering::Attributes::SafetyStatus::Id: + return "SafetyStatus"; + case chip::app::Clusters::WindowCovering::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WindowCovering::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WindowCovering::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WindowCovering::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WindowCovering::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WindowCovering::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BarrierControl::Id: { + switch (id) + { + case chip::app::Clusters::BarrierControl::Attributes::BarrierMovingState::Id: + return "BarrierMovingState"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierSafetyStatus::Id: + return "BarrierSafetyStatus"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierCapabilities::Id: + return "BarrierCapabilities"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierOpenEvents::Id: + return "BarrierOpenEvents"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierCloseEvents::Id: + return "BarrierCloseEvents"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierCommandOpenEvents::Id: + return "BarrierCommandOpenEvents"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierCommandCloseEvents::Id: + return "BarrierCommandCloseEvents"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierOpenPeriod::Id: + return "BarrierOpenPeriod"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierClosePeriod::Id: + return "BarrierClosePeriod"; + case chip::app::Clusters::BarrierControl::Attributes::BarrierPosition::Id: + return "BarrierPosition"; + case chip::app::Clusters::BarrierControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BarrierControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BarrierControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BarrierControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BarrierControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BarrierControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ServiceArea::Id: { + switch (id) + { + case chip::app::Clusters::ServiceArea::Attributes::SupportedAreas::Id: + return "SupportedAreas"; + case chip::app::Clusters::ServiceArea::Attributes::SupportedMaps::Id: + return "SupportedMaps"; + case chip::app::Clusters::ServiceArea::Attributes::SelectedAreas::Id: + return "SelectedAreas"; + case chip::app::Clusters::ServiceArea::Attributes::CurrentArea::Id: + return "CurrentArea"; + case chip::app::Clusters::ServiceArea::Attributes::EstimatedEndTime::Id: + return "EstimatedEndTime"; + case chip::app::Clusters::ServiceArea::Attributes::Progress::Id: + return "Progress"; + case chip::app::Clusters::ServiceArea::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ServiceArea::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ServiceArea::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ServiceArea::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ServiceArea::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ServiceArea::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PumpConfigurationAndControl::Id: { + switch (id) + { + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxPressure::Id: + return "MaxPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxSpeed::Id: + return "MaxSpeed"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxFlow::Id: + return "MaxFlow"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstPressure::Id: + return "MinConstPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstPressure::Id: + return "MaxConstPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinCompPressure::Id: + return "MinCompPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxCompPressure::Id: + return "MaxCompPressure"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstSpeed::Id: + return "MinConstSpeed"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id: + return "MaxConstSpeed"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstFlow::Id: + return "MinConstFlow"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstFlow::Id: + return "MaxConstFlow"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstTemp::Id: + return "MinConstTemp"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstTemp::Id: + return "MaxConstTemp"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::PumpStatus::Id: + return "PumpStatus"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id: + return "EffectiveOperationMode"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id: + return "EffectiveControlMode"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::Capacity::Id: + return "Capacity"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::Speed::Id: + return "Speed"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id: + return "LifetimeRunningHours"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::Power::Id: + return "Power"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id: + return "LifetimeEnergyConsumed"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::Id: + return "OperationMode"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::Id: + return "ControlMode"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PumpConfigurationAndControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Thermostat::Id: { + switch (id) + { + case chip::app::Clusters::Thermostat::Attributes::LocalTemperature::Id: + return "LocalTemperature"; + case chip::app::Clusters::Thermostat::Attributes::OutdoorTemperature::Id: + return "OutdoorTemperature"; + case chip::app::Clusters::Thermostat::Attributes::Occupancy::Id: + return "Occupancy"; + case chip::app::Clusters::Thermostat::Attributes::AbsMinHeatSetpointLimit::Id: + return "AbsMinHeatSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id: + return "AbsMaxHeatSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::AbsMinCoolSetpointLimit::Id: + return "AbsMinCoolSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id: + return "AbsMaxCoolSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::PICoolingDemand::Id: + return "PICoolingDemand"; + case chip::app::Clusters::Thermostat::Attributes::PIHeatingDemand::Id: + return "PIHeatingDemand"; + case chip::app::Clusters::Thermostat::Attributes::HVACSystemTypeConfiguration::Id: + return "HVACSystemTypeConfiguration"; + case chip::app::Clusters::Thermostat::Attributes::LocalTemperatureCalibration::Id: + return "LocalTemperatureCalibration"; + case chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::Id: + return "OccupiedCoolingSetpoint"; + case chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Id: + return "OccupiedHeatingSetpoint"; + case chip::app::Clusters::Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id: + return "UnoccupiedCoolingSetpoint"; + case chip::app::Clusters::Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id: + return "UnoccupiedHeatingSetpoint"; + case chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::Id: + return "MinHeatSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::Id: + return "MaxHeatSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::Id: + return "MinCoolSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::Id: + return "MaxCoolSetpointLimit"; + case chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::Id: + return "MinSetpointDeadBand"; + case chip::app::Clusters::Thermostat::Attributes::RemoteSensing::Id: + return "RemoteSensing"; + case chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::Id: + return "ControlSequenceOfOperation"; + case chip::app::Clusters::Thermostat::Attributes::SystemMode::Id: + return "SystemMode"; + case chip::app::Clusters::Thermostat::Attributes::ThermostatRunningMode::Id: + return "ThermostatRunningMode"; + case chip::app::Clusters::Thermostat::Attributes::StartOfWeek::Id: + return "StartOfWeek"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfWeeklyTransitions::Id: + return "NumberOfWeeklyTransitions"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfDailyTransitions::Id: + return "NumberOfDailyTransitions"; + case chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHold::Id: + return "TemperatureSetpointHold"; + case chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldDuration::Id: + return "TemperatureSetpointHoldDuration"; + case chip::app::Clusters::Thermostat::Attributes::ThermostatProgrammingOperationMode::Id: + return "ThermostatProgrammingOperationMode"; + case chip::app::Clusters::Thermostat::Attributes::ThermostatRunningState::Id: + return "ThermostatRunningState"; + case chip::app::Clusters::Thermostat::Attributes::SetpointChangeSource::Id: + return "SetpointChangeSource"; + case chip::app::Clusters::Thermostat::Attributes::SetpointChangeAmount::Id: + return "SetpointChangeAmount"; + case chip::app::Clusters::Thermostat::Attributes::SetpointChangeSourceTimestamp::Id: + return "SetpointChangeSourceTimestamp"; + case chip::app::Clusters::Thermostat::Attributes::OccupiedSetback::Id: + return "OccupiedSetback"; + case chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMin::Id: + return "OccupiedSetbackMin"; + case chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMax::Id: + return "OccupiedSetbackMax"; + case chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetback::Id: + return "UnoccupiedSetback"; + case chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMin::Id: + return "UnoccupiedSetbackMin"; + case chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMax::Id: + return "UnoccupiedSetbackMax"; + case chip::app::Clusters::Thermostat::Attributes::EmergencyHeatDelta::Id: + return "EmergencyHeatDelta"; + case chip::app::Clusters::Thermostat::Attributes::ACType::Id: + return "ACType"; + case chip::app::Clusters::Thermostat::Attributes::ACCapacity::Id: + return "ACCapacity"; + case chip::app::Clusters::Thermostat::Attributes::ACRefrigerantType::Id: + return "ACRefrigerantType"; + case chip::app::Clusters::Thermostat::Attributes::ACCompressorType::Id: + return "ACCompressorType"; + case chip::app::Clusters::Thermostat::Attributes::ACErrorCode::Id: + return "ACErrorCode"; + case chip::app::Clusters::Thermostat::Attributes::ACLouverPosition::Id: + return "ACLouverPosition"; + case chip::app::Clusters::Thermostat::Attributes::ACCoilTemperature::Id: + return "ACCoilTemperature"; + case chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id: + return "ACCapacityformat"; + case chip::app::Clusters::Thermostat::Attributes::PresetTypes::Id: + return "PresetTypes"; + case chip::app::Clusters::Thermostat::Attributes::ScheduleTypes::Id: + return "ScheduleTypes"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfPresets::Id: + return "NumberOfPresets"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfSchedules::Id: + return "NumberOfSchedules"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitions::Id: + return "NumberOfScheduleTransitions"; + case chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitionPerDay::Id: + return "NumberOfScheduleTransitionPerDay"; + case chip::app::Clusters::Thermostat::Attributes::ActivePresetHandle::Id: + return "ActivePresetHandle"; + case chip::app::Clusters::Thermostat::Attributes::ActiveScheduleHandle::Id: + return "ActiveScheduleHandle"; + case chip::app::Clusters::Thermostat::Attributes::Presets::Id: + return "Presets"; + case chip::app::Clusters::Thermostat::Attributes::Schedules::Id: + return "Schedules"; + case chip::app::Clusters::Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id: + return "SetpointHoldExpiryTimestamp"; + case chip::app::Clusters::Thermostat::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Thermostat::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Thermostat::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Thermostat::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Thermostat::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Thermostat::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FanControl::Id: { + switch (id) + { + case chip::app::Clusters::FanControl::Attributes::FanMode::Id: + return "FanMode"; + case chip::app::Clusters::FanControl::Attributes::FanModeSequence::Id: + return "FanModeSequence"; + case chip::app::Clusters::FanControl::Attributes::PercentSetting::Id: + return "PercentSetting"; + case chip::app::Clusters::FanControl::Attributes::PercentCurrent::Id: + return "PercentCurrent"; + case chip::app::Clusters::FanControl::Attributes::SpeedMax::Id: + return "SpeedMax"; + case chip::app::Clusters::FanControl::Attributes::SpeedSetting::Id: + return "SpeedSetting"; + case chip::app::Clusters::FanControl::Attributes::SpeedCurrent::Id: + return "SpeedCurrent"; + case chip::app::Clusters::FanControl::Attributes::RockSupport::Id: + return "RockSupport"; + case chip::app::Clusters::FanControl::Attributes::RockSetting::Id: + return "RockSetting"; + case chip::app::Clusters::FanControl::Attributes::WindSupport::Id: + return "WindSupport"; + case chip::app::Clusters::FanControl::Attributes::WindSetting::Id: + return "WindSetting"; + case chip::app::Clusters::FanControl::Attributes::AirflowDirection::Id: + return "AirflowDirection"; + case chip::app::Clusters::FanControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::FanControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::FanControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::FanControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::FanControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::FanControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id: + return "TemperatureDisplayMode"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id: + return "KeypadLockout"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id: + return "ScheduleProgrammingVisibility"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ColorControl::Id: { + switch (id) + { + case chip::app::Clusters::ColorControl::Attributes::CurrentHue::Id: + return "CurrentHue"; + case chip::app::Clusters::ColorControl::Attributes::CurrentSaturation::Id: + return "CurrentSaturation"; + case chip::app::Clusters::ColorControl::Attributes::RemainingTime::Id: + return "RemainingTime"; + case chip::app::Clusters::ColorControl::Attributes::CurrentX::Id: + return "CurrentX"; + case chip::app::Clusters::ColorControl::Attributes::CurrentY::Id: + return "CurrentY"; + case chip::app::Clusters::ColorControl::Attributes::DriftCompensation::Id: + return "DriftCompensation"; + case chip::app::Clusters::ColorControl::Attributes::CompensationText::Id: + return "CompensationText"; + case chip::app::Clusters::ColorControl::Attributes::ColorTemperatureMireds::Id: + return "ColorTemperatureMireds"; + case chip::app::Clusters::ColorControl::Attributes::ColorMode::Id: + return "ColorMode"; + case chip::app::Clusters::ColorControl::Attributes::Options::Id: + return "Options"; + case chip::app::Clusters::ColorControl::Attributes::NumberOfPrimaries::Id: + return "NumberOfPrimaries"; + case chip::app::Clusters::ColorControl::Attributes::Primary1X::Id: + return "Primary1X"; + case chip::app::Clusters::ColorControl::Attributes::Primary1Y::Id: + return "Primary1Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary1Intensity::Id: + return "Primary1Intensity"; + case chip::app::Clusters::ColorControl::Attributes::Primary2X::Id: + return "Primary2X"; + case chip::app::Clusters::ColorControl::Attributes::Primary2Y::Id: + return "Primary2Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary2Intensity::Id: + return "Primary2Intensity"; + case chip::app::Clusters::ColorControl::Attributes::Primary3X::Id: + return "Primary3X"; + case chip::app::Clusters::ColorControl::Attributes::Primary3Y::Id: + return "Primary3Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary3Intensity::Id: + return "Primary3Intensity"; + case chip::app::Clusters::ColorControl::Attributes::Primary4X::Id: + return "Primary4X"; + case chip::app::Clusters::ColorControl::Attributes::Primary4Y::Id: + return "Primary4Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary4Intensity::Id: + return "Primary4Intensity"; + case chip::app::Clusters::ColorControl::Attributes::Primary5X::Id: + return "Primary5X"; + case chip::app::Clusters::ColorControl::Attributes::Primary5Y::Id: + return "Primary5Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary5Intensity::Id: + return "Primary5Intensity"; + case chip::app::Clusters::ColorControl::Attributes::Primary6X::Id: + return "Primary6X"; + case chip::app::Clusters::ColorControl::Attributes::Primary6Y::Id: + return "Primary6Y"; + case chip::app::Clusters::ColorControl::Attributes::Primary6Intensity::Id: + return "Primary6Intensity"; + case chip::app::Clusters::ColorControl::Attributes::WhitePointX::Id: + return "WhitePointX"; + case chip::app::Clusters::ColorControl::Attributes::WhitePointY::Id: + return "WhitePointY"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointRX::Id: + return "ColorPointRX"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointRY::Id: + return "ColorPointRY"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::Id: + return "ColorPointRIntensity"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointGX::Id: + return "ColorPointGX"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointGY::Id: + return "ColorPointGY"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::Id: + return "ColorPointGIntensity"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointBX::Id: + return "ColorPointBX"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointBY::Id: + return "ColorPointBY"; + case chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::Id: + return "ColorPointBIntensity"; + case chip::app::Clusters::ColorControl::Attributes::EnhancedCurrentHue::Id: + return "EnhancedCurrentHue"; + case chip::app::Clusters::ColorControl::Attributes::EnhancedColorMode::Id: + return "EnhancedColorMode"; + case chip::app::Clusters::ColorControl::Attributes::ColorLoopActive::Id: + return "ColorLoopActive"; + case chip::app::Clusters::ColorControl::Attributes::ColorLoopDirection::Id: + return "ColorLoopDirection"; + case chip::app::Clusters::ColorControl::Attributes::ColorLoopTime::Id: + return "ColorLoopTime"; + case chip::app::Clusters::ColorControl::Attributes::ColorLoopStartEnhancedHue::Id: + return "ColorLoopStartEnhancedHue"; + case chip::app::Clusters::ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id: + return "ColorLoopStoredEnhancedHue"; + case chip::app::Clusters::ColorControl::Attributes::ColorCapabilities::Id: + return "ColorCapabilities"; + case chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMinMireds::Id: + return "ColorTempPhysicalMinMireds"; + case chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id: + return "ColorTempPhysicalMaxMireds"; + case chip::app::Clusters::ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id: + return "CoupleColorTempToLevelMinMireds"; + case chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::Id: + return "StartUpColorTemperatureMireds"; + case chip::app::Clusters::ColorControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ColorControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ColorControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ColorControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ColorControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ColorControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BallastConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMinLevel::Id: + return "PhysicalMinLevel"; + case chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMaxLevel::Id: + return "PhysicalMaxLevel"; + case chip::app::Clusters::BallastConfiguration::Attributes::BallastStatus::Id: + return "BallastStatus"; + case chip::app::Clusters::BallastConfiguration::Attributes::MinLevel::Id: + return "MinLevel"; + case chip::app::Clusters::BallastConfiguration::Attributes::MaxLevel::Id: + return "MaxLevel"; + case chip::app::Clusters::BallastConfiguration::Attributes::IntrinsicBallastFactor::Id: + return "IntrinsicBallastFactor"; + case chip::app::Clusters::BallastConfiguration::Attributes::BallastFactorAdjustment::Id: + return "BallastFactorAdjustment"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampQuantity::Id: + return "LampQuantity"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampType::Id: + return "LampType"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampManufacturer::Id: + return "LampManufacturer"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampRatedHours::Id: + return "LampRatedHours"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHours::Id: + return "LampBurnHours"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampAlarmMode::Id: + return "LampAlarmMode"; + case chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHoursTripPoint::Id: + return "LampBurnHoursTripPoint"; + case chip::app::Clusters::BallastConfiguration::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::BallastConfiguration::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::BallastConfiguration::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::BallastConfiguration::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::BallastConfiguration::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::BallastConfiguration::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::IlluminanceMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::Tolerance::Id: + return "Tolerance"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::Id: + return "LightSensorType"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::IlluminanceMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TemperatureMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::Tolerance::Id: + return "Tolerance"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TemperatureMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::PressureMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::PressureMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::Tolerance::Id: + return "Tolerance"; + case chip::app::Clusters::PressureMeasurement::Attributes::ScaledValue::Id: + return "ScaledValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::MinScaledValue::Id: + return "MinScaledValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::MaxScaledValue::Id: + return "MaxScaledValue"; + case chip::app::Clusters::PressureMeasurement::Attributes::ScaledTolerance::Id: + return "ScaledTolerance"; + case chip::app::Clusters::PressureMeasurement::Attributes::Scale::Id: + return "Scale"; + case chip::app::Clusters::PressureMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::PressureMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::PressureMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::PressureMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::PressureMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FlowMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::FlowMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::FlowMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::FlowMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::FlowMeasurement::Attributes::Tolerance::Id: + return "Tolerance"; + case chip::app::Clusters::FlowMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::FlowMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::FlowMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::FlowMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::FlowMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::FlowMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RelativeHumidityMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::Id: + return "Tolerance"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RelativeHumidityMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OccupancySensing::Id: { + switch (id) + { + case chip::app::Clusters::OccupancySensing::Attributes::Occupancy::Id: + return "Occupancy"; + case chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorType::Id: + return "OccupancySensorType"; + case chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id: + return "OccupancySensorTypeBitmap"; + case chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id: + return "HoldTime"; + case chip::app::Clusters::OccupancySensing::Attributes::HoldTimeLimits::Id: + return "HoldTimeLimits"; + case chip::app::Clusters::OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id: + return "PIROccupiedToUnoccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id: + return "PIRUnoccupiedToOccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id: + return "PIRUnoccupiedToOccupiedThreshold"; + case chip::app::Clusters::OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id: + return "UltrasonicOccupiedToUnoccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id: + return "UltrasonicUnoccupiedToOccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id: + return "UltrasonicUnoccupiedToOccupiedThreshold"; + case chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id: + return "PhysicalContactOccupiedToUnoccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id: + return "PhysicalContactUnoccupiedToOccupiedDelay"; + case chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id: + return "PhysicalContactUnoccupiedToOccupiedThreshold"; + case chip::app::Clusters::OccupancySensing::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OccupancySensing::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OccupancySensing::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OccupancySensing::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OccupancySensing::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OccupancySensing::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OzoneConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Pm25ConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Pm1ConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Pm10ConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RadonConcentrationMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasuredValue::Id: + return "MeasuredValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MinMeasuredValue::Id: + return "MinMeasuredValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MaxMeasuredValue::Id: + return "MaxMeasuredValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValue::Id: + return "PeakMeasuredValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id: + return "PeakMeasuredValueWindow"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValue::Id: + return "AverageMeasuredValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id: + return "AverageMeasuredValueWindow"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::Uncertainty::Id: + return "Uncertainty"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementUnit::Id: + return "MeasurementUnit"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementMedium::Id: + return "MeasurementMedium"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::LevelValue::Id: + return "LevelValue"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::RadonConcentrationMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WiFiNetworkManagement::Id: { + switch (id) + { + case chip::app::Clusters::WiFiNetworkManagement::Attributes::Ssid::Id: + return "Ssid"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::PassphraseSurrogate::Id: + return "PassphraseSurrogate"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WiFiNetworkManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadBorderRouterManagement::Id: { + switch (id) + { + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderRouterName::Id: + return "BorderRouterName"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderAgentID::Id: + return "BorderAgentID"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ThreadVersion::Id: + return "ThreadVersion"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::InterfaceEnabled::Id: + return "InterfaceEnabled"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ActiveDatasetTimestamp::Id: + return "ActiveDatasetTimestamp"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::PendingDatasetTimestamp::Id: + return "PendingDatasetTimestamp"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadNetworkDirectory::Id: { + switch (id) + { + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id: + return "PreferredExtendedPanID"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworks::Id: + return "ThreadNetworks"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id: + return "ThreadNetworkTableSize"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ThreadNetworkDirectory::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WakeOnLan::Id: { + switch (id) + { + case chip::app::Clusters::WakeOnLan::Attributes::MACAddress::Id: + return "MACAddress"; + case chip::app::Clusters::WakeOnLan::Attributes::LinkLocalAddress::Id: + return "LinkLocalAddress"; + case chip::app::Clusters::WakeOnLan::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::WakeOnLan::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::WakeOnLan::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::WakeOnLan::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::WakeOnLan::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Channel::Id: { + switch (id) + { + case chip::app::Clusters::Channel::Attributes::ChannelList::Id: + return "ChannelList"; + case chip::app::Clusters::Channel::Attributes::Lineup::Id: + return "Lineup"; + case chip::app::Clusters::Channel::Attributes::CurrentChannel::Id: + return "CurrentChannel"; + case chip::app::Clusters::Channel::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::Channel::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::Channel::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::Channel::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::Channel::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::Channel::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TargetNavigator::Id: { + switch (id) + { + case chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id: + return "TargetList"; + case chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::Id: + return "CurrentTarget"; + case chip::app::Clusters::TargetNavigator::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::TargetNavigator::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::TargetNavigator::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::TargetNavigator::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::TargetNavigator::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MediaPlayback::Id: { + switch (id) + { + case chip::app::Clusters::MediaPlayback::Attributes::CurrentState::Id: + return "CurrentState"; + case chip::app::Clusters::MediaPlayback::Attributes::StartTime::Id: + return "StartTime"; + case chip::app::Clusters::MediaPlayback::Attributes::Duration::Id: + return "Duration"; + case chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id: + return "SampledPosition"; + case chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::Id: + return "PlaybackSpeed"; + case chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::Id: + return "SeekRangeEnd"; + case chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::Id: + return "SeekRangeStart"; + case chip::app::Clusters::MediaPlayback::Attributes::ActiveAudioTrack::Id: + return "ActiveAudioTrack"; + case chip::app::Clusters::MediaPlayback::Attributes::AvailableAudioTracks::Id: + return "AvailableAudioTracks"; + case chip::app::Clusters::MediaPlayback::Attributes::ActiveTextTrack::Id: + return "ActiveTextTrack"; + case chip::app::Clusters::MediaPlayback::Attributes::AvailableTextTracks::Id: + return "AvailableTextTracks"; + case chip::app::Clusters::MediaPlayback::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::MediaPlayback::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::MediaPlayback::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::MediaPlayback::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::MediaPlayback::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MediaInput::Id: { + switch (id) + { + case chip::app::Clusters::MediaInput::Attributes::InputList::Id: + return "InputList"; + case chip::app::Clusters::MediaInput::Attributes::CurrentInput::Id: + return "CurrentInput"; + case chip::app::Clusters::MediaInput::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::MediaInput::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::MediaInput::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::MediaInput::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::MediaInput::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::MediaInput::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LowPower::Id: { + switch (id) + { + case chip::app::Clusters::LowPower::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::LowPower::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::LowPower::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::LowPower::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::LowPower::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::LowPower::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::KeypadInput::Id: { + switch (id) + { + case chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::KeypadInput::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::KeypadInput::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::KeypadInput::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id: + return "AcceptHeader"; + case chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id: + return "SupportedStreamingProtocols"; + case chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ContentLauncher::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ContentLauncher::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AudioOutput::Id: { + switch (id) + { + case chip::app::Clusters::AudioOutput::Attributes::OutputList::Id: + return "OutputList"; + case chip::app::Clusters::AudioOutput::Attributes::CurrentOutput::Id: + return "CurrentOutput"; + case chip::app::Clusters::AudioOutput::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::AudioOutput::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::AudioOutput::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::AudioOutput::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::AudioOutput::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::AudioOutput::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ApplicationLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ApplicationLauncher::Attributes::CatalogList::Id: + return "CatalogList"; + case chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::Id: + return "CurrentApp"; + case chip::app::Clusters::ApplicationLauncher::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ApplicationLauncher::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ApplicationLauncher::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ApplicationLauncher::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ApplicationBasic::Id: { + switch (id) + { + case chip::app::Clusters::ApplicationBasic::Attributes::VendorName::Id: + return "VendorName"; + case chip::app::Clusters::ApplicationBasic::Attributes::VendorID::Id: + return "VendorID"; + case chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::Id: + return "ApplicationName"; + case chip::app::Clusters::ApplicationBasic::Attributes::ProductID::Id: + return "ProductID"; + case chip::app::Clusters::ApplicationBasic::Attributes::Application::Id: + return "Application"; + case chip::app::Clusters::ApplicationBasic::Attributes::Status::Id: + return "Status"; + case chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::Id: + return "ApplicationVersion"; + case chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::Id: + return "AllowedVendorList"; + case chip::app::Clusters::ApplicationBasic::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ApplicationBasic::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ApplicationBasic::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ApplicationBasic::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccountLogin::Id: { + switch (id) + { + case chip::app::Clusters::AccountLogin::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::AccountLogin::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::AccountLogin::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::AccountLogin::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::AccountLogin::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::AccountLogin::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentControl::Id: { + switch (id) + { + case chip::app::Clusters::ContentControl::Attributes::Enabled::Id: + return "Enabled"; + case chip::app::Clusters::ContentControl::Attributes::OnDemandRatings::Id: + return "OnDemandRatings"; + case chip::app::Clusters::ContentControl::Attributes::OnDemandRatingThreshold::Id: + return "OnDemandRatingThreshold"; + case chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatings::Id: + return "ScheduledContentRatings"; + case chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatingThreshold::Id: + return "ScheduledContentRatingThreshold"; + case chip::app::Clusters::ContentControl::Attributes::ScreenDailyTime::Id: + return "ScreenDailyTime"; + case chip::app::Clusters::ContentControl::Attributes::RemainingScreenTime::Id: + return "RemainingScreenTime"; + case chip::app::Clusters::ContentControl::Attributes::BlockUnrated::Id: + return "BlockUnrated"; + case chip::app::Clusters::ContentControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ContentControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ContentControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ContentControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ContentControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ContentControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentAppObserver::Id: { + switch (id) + { + case chip::app::Clusters::ContentAppObserver::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ContentAppObserver::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ContentAppObserver::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ContentAppObserver::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ContentAppObserver::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ContentAppObserver::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EcosystemInformation::Id: { + switch (id) + { + case chip::app::Clusters::EcosystemInformation::Attributes::RemovedOn::Id: + return "RemovedOn"; + case chip::app::Clusters::EcosystemInformation::Attributes::DeviceDirectory::Id: + return "DeviceDirectory"; + case chip::app::Clusters::EcosystemInformation::Attributes::LocationDirectory::Id: + return "LocationDirectory"; + case chip::app::Clusters::EcosystemInformation::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::EcosystemInformation::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::EcosystemInformation::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::EcosystemInformation::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::EcosystemInformation::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::EcosystemInformation::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::CommissionerControl::Id: { + switch (id) + { + case chip::app::Clusters::CommissionerControl::Attributes::SupportedDeviceCategories::Id: + return "SupportedDeviceCategories"; + case chip::app::Clusters::CommissionerControl::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::CommissionerControl::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::CommissionerControl::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::CommissionerControl::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::CommissionerControl::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::CommissionerControl::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ElectricalMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasurementType::Id: + return "MeasurementType"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcVoltage::Id: + return "DcVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcVoltageMin::Id: + return "DcVoltageMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcVoltageMax::Id: + return "DcVoltageMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcCurrent::Id: + return "DcCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcCurrentMin::Id: + return "DcCurrentMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcCurrentMax::Id: + return "DcCurrentMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcPower::Id: + return "DcPower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcPowerMin::Id: + return "DcPowerMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcPowerMax::Id: + return "DcPowerMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcVoltageMultiplier::Id: + return "DcVoltageMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcVoltageDivisor::Id: + return "DcVoltageDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcCurrentMultiplier::Id: + return "DcCurrentMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcCurrentDivisor::Id: + return "DcCurrentDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcPowerMultiplier::Id: + return "DcPowerMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::DcPowerDivisor::Id: + return "DcPowerDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcFrequency::Id: + return "AcFrequency"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcFrequencyMin::Id: + return "AcFrequencyMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcFrequencyMax::Id: + return "AcFrequencyMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::NeutralCurrent::Id: + return "NeutralCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::TotalActivePower::Id: + return "TotalActivePower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::TotalReactivePower::Id: + return "TotalReactivePower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::TotalApparentPower::Id: + return "TotalApparentPower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured1stHarmonicCurrent::Id: + return "Measured1stHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured3rdHarmonicCurrent::Id: + return "Measured3rdHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured5thHarmonicCurrent::Id: + return "Measured5thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured7thHarmonicCurrent::Id: + return "Measured7thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured9thHarmonicCurrent::Id: + return "Measured9thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::Measured11thHarmonicCurrent::Id: + return "Measured11thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase1stHarmonicCurrent::Id: + return "MeasuredPhase1stHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase3rdHarmonicCurrent::Id: + return "MeasuredPhase3rdHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase5thHarmonicCurrent::Id: + return "MeasuredPhase5thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase7thHarmonicCurrent::Id: + return "MeasuredPhase7thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase9thHarmonicCurrent::Id: + return "MeasuredPhase9thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::MeasuredPhase11thHarmonicCurrent::Id: + return "MeasuredPhase11thHarmonicCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcFrequencyMultiplier::Id: + return "AcFrequencyMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcFrequencyDivisor::Id: + return "AcFrequencyDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PowerMultiplier::Id: + return "PowerMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PowerDivisor::Id: + return "PowerDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::HarmonicCurrentMultiplier::Id: + return "HarmonicCurrentMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PhaseHarmonicCurrentMultiplier::Id: + return "PhaseHarmonicCurrentMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::InstantaneousVoltage::Id: + return "InstantaneousVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::InstantaneousLineCurrent::Id: + return "InstantaneousLineCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::InstantaneousActiveCurrent::Id: + return "InstantaneousActiveCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::InstantaneousReactiveCurrent::Id: + return "InstantaneousReactiveCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::InstantaneousPower::Id: + return "InstantaneousPower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltage::Id: + return "RmsVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMin::Id: + return "RmsVoltageMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMax::Id: + return "RmsVoltageMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrent::Id: + return "RmsCurrent"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMin::Id: + return "RmsCurrentMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMax::Id: + return "RmsCurrentMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePower::Id: + return "ActivePower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMin::Id: + return "ActivePowerMin"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMax::Id: + return "ActivePowerMax"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ReactivePower::Id: + return "ReactivePower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ApparentPower::Id: + return "ApparentPower"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PowerFactor::Id: + return "PowerFactor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsVoltageMeasurementPeriod::Id: + return "AverageRmsVoltageMeasurementPeriod"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsUnderVoltageCounter::Id: + return "AverageRmsUnderVoltageCounter"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeOverVoltagePeriod::Id: + return "RmsExtremeOverVoltagePeriod"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeUnderVoltagePeriod::Id: + return "RmsExtremeUnderVoltagePeriod"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSagPeriod::Id: + return "RmsVoltageSagPeriod"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSwellPeriod::Id: + return "RmsVoltageSwellPeriod"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcVoltageMultiplier::Id: + return "AcVoltageMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcVoltageDivisor::Id: + return "AcVoltageDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcCurrentMultiplier::Id: + return "AcCurrentMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcCurrentDivisor::Id: + return "AcCurrentDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcPowerMultiplier::Id: + return "AcPowerMultiplier"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcPowerDivisor::Id: + return "AcPowerDivisor"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::OverloadAlarmsMask::Id: + return "OverloadAlarmsMask"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::VoltageOverload::Id: + return "VoltageOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::CurrentOverload::Id: + return "CurrentOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcOverloadAlarmsMask::Id: + return "AcOverloadAlarmsMask"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcVoltageOverload::Id: + return "AcVoltageOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcCurrentOverload::Id: + return "AcCurrentOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcActivePowerOverload::Id: + return "AcActivePowerOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcReactivePowerOverload::Id: + return "AcReactivePowerOverload"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsOverVoltage::Id: + return "AverageRmsOverVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsUnderVoltage::Id: + return "AverageRmsUnderVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeOverVoltage::Id: + return "RmsExtremeOverVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeUnderVoltage::Id: + return "RmsExtremeUnderVoltage"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSag::Id: + return "RmsVoltageSag"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSwell::Id: + return "RmsVoltageSwell"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::LineCurrentPhaseB::Id: + return "LineCurrentPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActiveCurrentPhaseB::Id: + return "ActiveCurrentPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ReactiveCurrentPhaseB::Id: + return "ReactiveCurrentPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltagePhaseB::Id: + return "RmsVoltagePhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMinPhaseB::Id: + return "RmsVoltageMinPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMaxPhaseB::Id: + return "RmsVoltageMaxPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentPhaseB::Id: + return "RmsCurrentPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMinPhaseB::Id: + return "RmsCurrentMinPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMaxPhaseB::Id: + return "RmsCurrentMaxPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerPhaseB::Id: + return "ActivePowerPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMinPhaseB::Id: + return "ActivePowerMinPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMaxPhaseB::Id: + return "ActivePowerMaxPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ReactivePowerPhaseB::Id: + return "ReactivePowerPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ApparentPowerPhaseB::Id: + return "ApparentPowerPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PowerFactorPhaseB::Id: + return "PowerFactorPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::Id: + return "AverageRmsVoltageMeasurementPeriodPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsOverVoltageCounterPhaseB::Id: + return "AverageRmsOverVoltageCounterPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsUnderVoltageCounterPhaseB::Id: + return "AverageRmsUnderVoltageCounterPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeOverVoltagePeriodPhaseB::Id: + return "RmsExtremeOverVoltagePeriodPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeUnderVoltagePeriodPhaseB::Id: + return "RmsExtremeUnderVoltagePeriodPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSagPeriodPhaseB::Id: + return "RmsVoltageSagPeriodPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSwellPeriodPhaseB::Id: + return "RmsVoltageSwellPeriodPhaseB"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::LineCurrentPhaseC::Id: + return "LineCurrentPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActiveCurrentPhaseC::Id: + return "ActiveCurrentPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ReactiveCurrentPhaseC::Id: + return "ReactiveCurrentPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltagePhaseC::Id: + return "RmsVoltagePhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMinPhaseC::Id: + return "RmsVoltageMinPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageMaxPhaseC::Id: + return "RmsVoltageMaxPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentPhaseC::Id: + return "RmsCurrentPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMinPhaseC::Id: + return "RmsCurrentMinPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsCurrentMaxPhaseC::Id: + return "RmsCurrentMaxPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerPhaseC::Id: + return "ActivePowerPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMinPhaseC::Id: + return "ActivePowerMinPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ActivePowerMaxPhaseC::Id: + return "ActivePowerMaxPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ReactivePowerPhaseC::Id: + return "ReactivePowerPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ApparentPowerPhaseC::Id: + return "ApparentPowerPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::PowerFactorPhaseC::Id: + return "PowerFactorPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::Id: + return "AverageRmsVoltageMeasurementPeriodPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsOverVoltageCounterPhaseC::Id: + return "AverageRmsOverVoltageCounterPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AverageRmsUnderVoltageCounterPhaseC::Id: + return "AverageRmsUnderVoltageCounterPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeOverVoltagePeriodPhaseC::Id: + return "RmsExtremeOverVoltagePeriodPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsExtremeUnderVoltagePeriodPhaseC::Id: + return "RmsExtremeUnderVoltagePeriodPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSagPeriodPhaseC::Id: + return "RmsVoltageSagPeriodPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::RmsVoltageSwellPeriodPhaseC::Id: + return "RmsVoltageSwellPeriodPhaseC"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::ElectricalMeasurement::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::UnitTesting::Id: { + switch (id) + { + case chip::app::Clusters::UnitTesting::Attributes::Boolean::Id: + return "Boolean"; + case chip::app::Clusters::UnitTesting::Attributes::Bitmap8::Id: + return "Bitmap8"; + case chip::app::Clusters::UnitTesting::Attributes::Bitmap16::Id: + return "Bitmap16"; + case chip::app::Clusters::UnitTesting::Attributes::Bitmap32::Id: + return "Bitmap32"; + case chip::app::Clusters::UnitTesting::Attributes::Bitmap64::Id: + return "Bitmap64"; + case chip::app::Clusters::UnitTesting::Attributes::Int8u::Id: + return "Int8u"; + case chip::app::Clusters::UnitTesting::Attributes::Int16u::Id: + return "Int16u"; + case chip::app::Clusters::UnitTesting::Attributes::Int24u::Id: + return "Int24u"; + case chip::app::Clusters::UnitTesting::Attributes::Int32u::Id: + return "Int32u"; + case chip::app::Clusters::UnitTesting::Attributes::Int40u::Id: + return "Int40u"; + case chip::app::Clusters::UnitTesting::Attributes::Int48u::Id: + return "Int48u"; + case chip::app::Clusters::UnitTesting::Attributes::Int56u::Id: + return "Int56u"; + case chip::app::Clusters::UnitTesting::Attributes::Int64u::Id: + return "Int64u"; + case chip::app::Clusters::UnitTesting::Attributes::Int8s::Id: + return "Int8s"; + case chip::app::Clusters::UnitTesting::Attributes::Int16s::Id: + return "Int16s"; + case chip::app::Clusters::UnitTesting::Attributes::Int24s::Id: + return "Int24s"; + case chip::app::Clusters::UnitTesting::Attributes::Int32s::Id: + return "Int32s"; + case chip::app::Clusters::UnitTesting::Attributes::Int40s::Id: + return "Int40s"; + case chip::app::Clusters::UnitTesting::Attributes::Int48s::Id: + return "Int48s"; + case chip::app::Clusters::UnitTesting::Attributes::Int56s::Id: + return "Int56s"; + case chip::app::Clusters::UnitTesting::Attributes::Int64s::Id: + return "Int64s"; + case chip::app::Clusters::UnitTesting::Attributes::Enum8::Id: + return "Enum8"; + case chip::app::Clusters::UnitTesting::Attributes::Enum16::Id: + return "Enum16"; + case chip::app::Clusters::UnitTesting::Attributes::FloatSingle::Id: + return "FloatSingle"; + case chip::app::Clusters::UnitTesting::Attributes::FloatDouble::Id: + return "FloatDouble"; + case chip::app::Clusters::UnitTesting::Attributes::OctetString::Id: + return "OctetString"; + case chip::app::Clusters::UnitTesting::Attributes::ListInt8u::Id: + return "ListInt8u"; + case chip::app::Clusters::UnitTesting::Attributes::ListOctetString::Id: + return "ListOctetString"; + case chip::app::Clusters::UnitTesting::Attributes::ListStructOctetString::Id: + return "ListStructOctetString"; + case chip::app::Clusters::UnitTesting::Attributes::LongOctetString::Id: + return "LongOctetString"; + case chip::app::Clusters::UnitTesting::Attributes::CharString::Id: + return "CharString"; + case chip::app::Clusters::UnitTesting::Attributes::LongCharString::Id: + return "LongCharString"; + case chip::app::Clusters::UnitTesting::Attributes::EpochUs::Id: + return "EpochUs"; + case chip::app::Clusters::UnitTesting::Attributes::EpochS::Id: + return "EpochS"; + case chip::app::Clusters::UnitTesting::Attributes::VendorId::Id: + return "VendorId"; + case chip::app::Clusters::UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id: + return "ListNullablesAndOptionalsStruct"; + case chip::app::Clusters::UnitTesting::Attributes::EnumAttr::Id: + return "EnumAttr"; + case chip::app::Clusters::UnitTesting::Attributes::StructAttr::Id: + return "StructAttr"; + case chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8u::Id: + return "RangeRestrictedInt8u"; + case chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8s::Id: + return "RangeRestrictedInt8s"; + case chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16u::Id: + return "RangeRestrictedInt16u"; + case chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16s::Id: + return "RangeRestrictedInt16s"; + case chip::app::Clusters::UnitTesting::Attributes::ListLongOctetString::Id: + return "ListLongOctetString"; + case chip::app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id: + return "ListFabricScoped"; + case chip::app::Clusters::UnitTesting::Attributes::TimedWriteBoolean::Id: + return "TimedWriteBoolean"; + case chip::app::Clusters::UnitTesting::Attributes::GeneralErrorBoolean::Id: + return "GeneralErrorBoolean"; + case chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id: + return "ClusterErrorBoolean"; + case chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::Id: + return "GlobalEnum"; + case chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::Id: + return "GlobalStruct"; + case chip::app::Clusters::UnitTesting::Attributes::Unsupported::Id: + return "Unsupported"; + case chip::app::Clusters::UnitTesting::Attributes::NullableBoolean::Id: + return "NullableBoolean"; + case chip::app::Clusters::UnitTesting::Attributes::NullableBitmap8::Id: + return "NullableBitmap8"; + case chip::app::Clusters::UnitTesting::Attributes::NullableBitmap16::Id: + return "NullableBitmap16"; + case chip::app::Clusters::UnitTesting::Attributes::NullableBitmap32::Id: + return "NullableBitmap32"; + case chip::app::Clusters::UnitTesting::Attributes::NullableBitmap64::Id: + return "NullableBitmap64"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt8u::Id: + return "NullableInt8u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt16u::Id: + return "NullableInt16u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt24u::Id: + return "NullableInt24u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt32u::Id: + return "NullableInt32u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt40u::Id: + return "NullableInt40u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt48u::Id: + return "NullableInt48u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt56u::Id: + return "NullableInt56u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt64u::Id: + return "NullableInt64u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt8s::Id: + return "NullableInt8s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt16s::Id: + return "NullableInt16s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt24s::Id: + return "NullableInt24s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt32s::Id: + return "NullableInt32s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt40s::Id: + return "NullableInt40s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt48s::Id: + return "NullableInt48s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt56s::Id: + return "NullableInt56s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableInt64s::Id: + return "NullableInt64s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableEnum8::Id: + return "NullableEnum8"; + case chip::app::Clusters::UnitTesting::Attributes::NullableEnum16::Id: + return "NullableEnum16"; + case chip::app::Clusters::UnitTesting::Attributes::NullableFloatSingle::Id: + return "NullableFloatSingle"; + case chip::app::Clusters::UnitTesting::Attributes::NullableFloatDouble::Id: + return "NullableFloatDouble"; + case chip::app::Clusters::UnitTesting::Attributes::NullableOctetString::Id: + return "NullableOctetString"; + case chip::app::Clusters::UnitTesting::Attributes::NullableCharString::Id: + return "NullableCharString"; + case chip::app::Clusters::UnitTesting::Attributes::NullableEnumAttr::Id: + return "NullableEnumAttr"; + case chip::app::Clusters::UnitTesting::Attributes::NullableStruct::Id: + return "NullableStruct"; + case chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id: + return "NullableRangeRestrictedInt8u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id: + return "NullableRangeRestrictedInt8s"; + case chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id: + return "NullableRangeRestrictedInt16u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id: + return "NullableRangeRestrictedInt16s"; + case chip::app::Clusters::UnitTesting::Attributes::WriteOnlyInt8u::Id: + return "WriteOnlyInt8u"; + case chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::Id: + return "NullableGlobalEnum"; + case chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::Id: + return "NullableGlobalStruct"; + case chip::app::Clusters::UnitTesting::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::UnitTesting::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::UnitTesting::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::UnitTesting::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::UnitTesting::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::UnitTesting::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + case chip::app::Clusters::UnitTesting::Attributes::MeiInt8u::Id: + return "MeiInt8u"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FaultInjection::Id: { + switch (id) + { + case chip::app::Clusters::FaultInjection::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::FaultInjection::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::FaultInjection::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::FaultInjection::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::FaultInjection::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::FaultInjection::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SampleMei::Id: { + switch (id) + { + case chip::app::Clusters::SampleMei::Attributes::FlipFlop::Id: + return "FlipFlop"; + case chip::app::Clusters::SampleMei::Attributes::GeneratedCommandList::Id: + return "GeneratedCommandList"; + case chip::app::Clusters::SampleMei::Attributes::AcceptedCommandList::Id: + return "AcceptedCommandList"; + case chip::app::Clusters::SampleMei::Attributes::EventList::Id: + return "EventList"; + case chip::app::Clusters::SampleMei::Attributes::AttributeList::Id: + return "AttributeList"; + case chip::app::Clusters::SampleMei::Attributes::FeatureMap::Id: + return "FeatureMap"; + case chip::app::Clusters::SampleMei::Attributes::ClusterRevision::Id: + return "ClusterRevision"; + default: + return "Unknown"; + } + } + default: + return "Unknown"; + } +} + +char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) +{ + switch (cluster) + { + case chip::app::Clusters::Identify::Id: { + switch (id) + { + case chip::app::Clusters::Identify::Commands::Identify::Id: + return "Identify"; + case chip::app::Clusters::Identify::Commands::TriggerEffect::Id: + return "TriggerEffect"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Groups::Id: { + switch (id) + { + case chip::app::Clusters::Groups::Commands::AddGroup::Id: + return "AddGroup"; + case chip::app::Clusters::Groups::Commands::ViewGroup::Id: + return "ViewGroup"; + case chip::app::Clusters::Groups::Commands::GetGroupMembership::Id: + return "GetGroupMembership"; + case chip::app::Clusters::Groups::Commands::RemoveGroup::Id: + return "RemoveGroup"; + case chip::app::Clusters::Groups::Commands::RemoveAllGroups::Id: + return "RemoveAllGroups"; + case chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Id: + return "AddGroupIfIdentifying"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OnOff::Id: { + switch (id) + { + case chip::app::Clusters::OnOff::Commands::Off::Id: + return "Off"; + case chip::app::Clusters::OnOff::Commands::On::Id: + return "On"; + case chip::app::Clusters::OnOff::Commands::Toggle::Id: + return "Toggle"; + case chip::app::Clusters::OnOff::Commands::OffWithEffect::Id: + return "OffWithEffect"; + case chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Id: + return "OnWithRecallGlobalScene"; + case chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Id: + return "OnWithTimedOff"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LevelControl::Id: { + switch (id) + { + case chip::app::Clusters::LevelControl::Commands::MoveToLevel::Id: + return "MoveToLevel"; + case chip::app::Clusters::LevelControl::Commands::Move::Id: + return "Move"; + case chip::app::Clusters::LevelControl::Commands::Step::Id: + return "Step"; + case chip::app::Clusters::LevelControl::Commands::Stop::Id: + return "Stop"; + case chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Id: + return "MoveToLevelWithOnOff"; + case chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Id: + return "MoveWithOnOff"; + case chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Id: + return "StepWithOnOff"; + case chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Id: + return "StopWithOnOff"; + case chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Id: + return "MoveToClosestFrequency"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccessControl::Id: { + switch (id) + { + case chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::Id: + return "ReviewFabricRestrictions"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Actions::Id: { + switch (id) + { + case chip::app::Clusters::Actions::Commands::InstantAction::Id: + return "InstantAction"; + case chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Id: + return "InstantActionWithTransition"; + case chip::app::Clusters::Actions::Commands::StartAction::Id: + return "StartAction"; + case chip::app::Clusters::Actions::Commands::StartActionWithDuration::Id: + return "StartActionWithDuration"; + case chip::app::Clusters::Actions::Commands::StopAction::Id: + return "StopAction"; + case chip::app::Clusters::Actions::Commands::PauseAction::Id: + return "PauseAction"; + case chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Id: + return "PauseActionWithDuration"; + case chip::app::Clusters::Actions::Commands::ResumeAction::Id: + return "ResumeAction"; + case chip::app::Clusters::Actions::Commands::EnableAction::Id: + return "EnableAction"; + case chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Id: + return "EnableActionWithDuration"; + case chip::app::Clusters::Actions::Commands::DisableAction::Id: + return "DisableAction"; + case chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Id: + return "DisableActionWithDuration"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BasicInformation::Id: { + switch (id) + { + case chip::app::Clusters::BasicInformation::Commands::MfgSpecificPing::Id: + return "MfgSpecificPing"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OtaSoftwareUpdateProvider::Id: { + switch (id) + { + case chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id: + return "QueryImage"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id: + return "ApplyUpdateRequest"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id: + return "NotifyUpdateApplied"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Id: { + switch (id) + { + case chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Id: + return "AnnounceOTAProvider"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Id: + return "ArmFailSafe"; + case chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Id: + return "SetRegulatoryConfig"; + case chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Id: + return "CommissioningComplete"; + case chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::Id: + return "SetTCAcknowledgements"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::NetworkCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Id: + return "ScanNetworks"; + case chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id: + return "AddOrUpdateWiFiNetwork"; + case chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id: + return "AddOrUpdateThreadNetwork"; + case chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Id: + return "RemoveNetwork"; + case chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Id: + return "ConnectNetwork"; + case chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Id: + return "ReorderNetwork"; + case chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentity::Id: + return "QueryIdentity"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DiagnosticLogs::Id: { + switch (id) + { + case chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Id: + return "RetrieveLogsRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Id: + return "TestEventTrigger"; + case chip::app::Clusters::GeneralDiagnostics::Commands::TimeSnapshot::Id: + return "TimeSnapshot"; + case chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestRequest::Id: + return "PayloadTestRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SoftwareDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Id: + return "ResetWatermarks"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Id: + return "ResetCounts"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WiFiNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::WiFiNetworkDiagnostics::Commands::ResetCounts::Id: + return "ResetCounts"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EthernetNetworkDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::Id: + return "ResetCounts"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TimeSynchronization::Id: { + switch (id) + { + case chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::Id: + return "SetUTCTime"; + case chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Id: + return "SetTrustedTimeSource"; + case chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Id: + return "SetTimeZone"; + case chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Id: + return "SetDSTOffset"; + case chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::Id: + return "SetDefaultNTP"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BridgedDeviceBasicInformation::Id: { + switch (id) + { + case chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::Id: + return "KeepActive"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AdministratorCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Id: + return "OpenCommissioningWindow"; + case chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id: + return "OpenBasicCommissioningWindow"; + case chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Id: + return "RevokeCommissioning"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalCredentials::Id: { + switch (id) + { + case chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Id: + return "AttestationRequest"; + case chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id: + return "CertificateChainRequest"; + case chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Id: + return "CSRRequest"; + case chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Id: + return "AddNOC"; + case chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Id: + return "UpdateNOC"; + case chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Id: + return "UpdateFabricLabel"; + case chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Id: + return "RemoveFabric"; + case chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Id: + return "AddTrustedRootCertificate"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GroupKeyManagement::Id: { + switch (id) + { + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Id: + return "KeySetWrite"; + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Id: + return "KeySetRead"; + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Id: + return "KeySetRemove"; + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Id: + return "KeySetReadAllIndices"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::IcdManagement::Id: { + switch (id) + { + case chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id: + return "RegisterClient"; + case chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id: + return "UnregisterClient"; + case chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Id: + return "StayActiveRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Timer::Id: { + switch (id) + { + case chip::app::Clusters::Timer::Commands::SetTimer::Id: + return "SetTimer"; + case chip::app::Clusters::Timer::Commands::ResetTimer::Id: + return "ResetTimer"; + case chip::app::Clusters::Timer::Commands::AddTime::Id: + return "AddTime"; + case chip::app::Clusters::Timer::Commands::ReduceTime::Id: + return "ReduceTime"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenCavityOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OvenCavityOperationalState::Commands::Pause::Id: + return "Pause"; + case chip::app::Clusters::OvenCavityOperationalState::Commands::Stop::Id: + return "Stop"; + case chip::app::Clusters::OvenCavityOperationalState::Commands::Start::Id: + return "Start"; + case chip::app::Clusters::OvenCavityOperationalState::Commands::Resume::Id: + return "Resume"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenMode::Id: { + switch (id) + { + case chip::app::Clusters::OvenMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ModeSelect::Id: { + switch (id) + { + case chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LaundryWasherMode::Id: { + switch (id) + { + case chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id: { + switch (id) + { + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcRunMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcRunMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcCleanMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcCleanMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TemperatureControl::Id: { + switch (id) + { + case chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Id: + return "SetTemperature"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DishwasherMode::Id: { + switch (id) + { + case chip::app::Clusters::DishwasherMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SmokeCoAlarm::Id: { + switch (id) + { + case chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Id: + return "SelfTestRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DishwasherAlarm::Id: { + switch (id) + { + case chip::app::Clusters::DishwasherAlarm::Commands::Reset::Id: + return "Reset"; + case chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Id: + return "ModifyEnabledAlarms"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MicrowaveOvenControl::Id: { + switch (id) + { + case chip::app::Clusters::MicrowaveOvenControl::Commands::SetCookingParameters::Id: + return "SetCookingParameters"; + case chip::app::Clusters::MicrowaveOvenControl::Commands::AddMoreTime::Id: + return "AddMoreTime"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OperationalState::Commands::Pause::Id: + return "Pause"; + case chip::app::Clusters::OperationalState::Commands::Stop::Id: + return "Stop"; + case chip::app::Clusters::OperationalState::Commands::Start::Id: + return "Start"; + case chip::app::Clusters::OperationalState::Commands::Resume::Id: + return "Resume"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::RvcOperationalState::Commands::Pause::Id: + return "Pause"; + case chip::app::Clusters::RvcOperationalState::Commands::Resume::Id: + return "Resume"; + case chip::app::Clusters::RvcOperationalState::Commands::GoHome::Id: + return "GoHome"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ScenesManagement::Id: { + switch (id) + { + case chip::app::Clusters::ScenesManagement::Commands::AddScene::Id: + return "AddScene"; + case chip::app::Clusters::ScenesManagement::Commands::ViewScene::Id: + return "ViewScene"; + case chip::app::Clusters::ScenesManagement::Commands::RemoveScene::Id: + return "RemoveScene"; + case chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenes::Id: + return "RemoveAllScenes"; + case chip::app::Clusters::ScenesManagement::Commands::StoreScene::Id: + return "StoreScene"; + case chip::app::Clusters::ScenesManagement::Commands::RecallScene::Id: + return "RecallScene"; + case chip::app::Clusters::ScenesManagement::Commands::GetSceneMembership::Id: + return "GetSceneMembership"; + case chip::app::Clusters::ScenesManagement::Commands::CopyScene::Id: + return "CopyScene"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::HepaFilterMonitoring::Id: { + switch (id) + { + case chip::app::Clusters::HepaFilterMonitoring::Commands::ResetCondition::Id: + return "ResetCondition"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id: { + switch (id) + { + case chip::app::Clusters::ActivatedCarbonFilterMonitoring::Commands::ResetCondition::Id: + return "ResetCondition"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BooleanStateConfiguration::Id: { + switch (id) + { + case chip::app::Clusters::BooleanStateConfiguration::Commands::SuppressAlarm::Id: + return "SuppressAlarm"; + case chip::app::Clusters::BooleanStateConfiguration::Commands::EnableDisableAlarm::Id: + return "EnableDisableAlarm"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ValveConfigurationAndControl::Id: { + switch (id) + { + case chip::app::Clusters::ValveConfigurationAndControl::Commands::Open::Id: + return "Open"; + case chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::Id: + return "Close"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WaterHeaterManagement::Id: { + switch (id) + { + case chip::app::Clusters::WaterHeaterManagement::Commands::Boost::Id: + return "Boost"; + case chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::Id: + return "CancelBoost"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DemandResponseLoadControl::Id: { + switch (id) + { + case chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Id: + return "RegisterLoadControlProgramRequest"; + case chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Id: + return "UnregisterLoadControlProgramRequest"; + case chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Id: + return "AddLoadControlEventRequest"; + case chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Id: + return "RemoveLoadControlEventRequest"; + case chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Id: + return "ClearLoadControlEventsRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Messages::Id: { + switch (id) + { + case chip::app::Clusters::Messages::Commands::PresentMessagesRequest::Id: + return "PresentMessagesRequest"; + case chip::app::Clusters::Messages::Commands::CancelMessagesRequest::Id: + return "CancelMessagesRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DeviceEnergyManagement::Id: { + switch (id) + { + case chip::app::Clusters::DeviceEnergyManagement::Commands::PowerAdjustRequest::Id: + return "PowerAdjustRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::CancelPowerAdjustRequest::Id: + return "CancelPowerAdjustRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::StartTimeAdjustRequest::Id: + return "StartTimeAdjustRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::PauseRequest::Id: + return "PauseRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::ResumeRequest::Id: + return "ResumeRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::ModifyForecastRequest::Id: + return "ModifyForecastRequest"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::Id: + return "RequestConstraintBasedForecast"; + case chip::app::Clusters::DeviceEnergyManagement::Commands::CancelRequest::Id: + return "CancelRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvse::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvse::Commands::Disable::Id: + return "Disable"; + case chip::app::Clusters::EnergyEvse::Commands::EnableCharging::Id: + return "EnableCharging"; + case chip::app::Clusters::EnergyEvse::Commands::EnableDischarging::Id: + return "EnableDischarging"; + case chip::app::Clusters::EnergyEvse::Commands::StartDiagnostics::Id: + return "StartDiagnostics"; + case chip::app::Clusters::EnergyEvse::Commands::SetTargets::Id: + return "SetTargets"; + case chip::app::Clusters::EnergyEvse::Commands::GetTargets::Id: + return "GetTargets"; + case chip::app::Clusters::EnergyEvse::Commands::ClearTargets::Id: + return "ClearTargets"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvseMode::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvseMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WaterHeaterMode::Id: { + switch (id) + { + case chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DeviceEnergyManagementMode::Id: { + switch (id) + { + case chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToMode::Id: + return "ChangeToMode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DoorLock::Id: { + switch (id) + { + case chip::app::Clusters::DoorLock::Commands::LockDoor::Id: + return "LockDoor"; + case chip::app::Clusters::DoorLock::Commands::UnlockDoor::Id: + return "UnlockDoor"; + case chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Id: + return "UnlockWithTimeout"; + case chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Id: + return "SetWeekDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Id: + return "GetWeekDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Id: + return "ClearWeekDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Id: + return "SetYearDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Id: + return "GetYearDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Id: + return "ClearYearDaySchedule"; + case chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Id: + return "SetHolidaySchedule"; + case chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Id: + return "GetHolidaySchedule"; + case chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Id: + return "ClearHolidaySchedule"; + case chip::app::Clusters::DoorLock::Commands::SetUser::Id: + return "SetUser"; + case chip::app::Clusters::DoorLock::Commands::GetUser::Id: + return "GetUser"; + case chip::app::Clusters::DoorLock::Commands::ClearUser::Id: + return "ClearUser"; + case chip::app::Clusters::DoorLock::Commands::SetCredential::Id: + return "SetCredential"; + case chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Id: + return "GetCredentialStatus"; + case chip::app::Clusters::DoorLock::Commands::ClearCredential::Id: + return "ClearCredential"; + case chip::app::Clusters::DoorLock::Commands::UnboltDoor::Id: + return "UnboltDoor"; + case chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::Id: + return "SetAliroReaderConfig"; + case chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::Id: + return "ClearAliroReaderConfig"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WindowCovering::Id: { + switch (id) + { + case chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Id: + return "UpOrOpen"; + case chip::app::Clusters::WindowCovering::Commands::DownOrClose::Id: + return "DownOrClose"; + case chip::app::Clusters::WindowCovering::Commands::StopMotion::Id: + return "StopMotion"; + case chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Id: + return "GoToLiftValue"; + case chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Id: + return "GoToLiftPercentage"; + case chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Id: + return "GoToTiltValue"; + case chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Id: + return "GoToTiltPercentage"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::BarrierControl::Id: { + switch (id) + { + case chip::app::Clusters::BarrierControl::Commands::BarrierControlGoToPercent::Id: + return "BarrierControlGoToPercent"; + case chip::app::Clusters::BarrierControl::Commands::BarrierControlStop::Id: + return "BarrierControlStop"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ServiceArea::Id: { + switch (id) + { + case chip::app::Clusters::ServiceArea::Commands::SelectAreas::Id: + return "SelectAreas"; + case chip::app::Clusters::ServiceArea::Commands::SkipArea::Id: + return "SkipArea"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Thermostat::Id: { + switch (id) + { + case chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Id: + return "SetpointRaiseLower"; + case chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Id: + return "SetWeeklySchedule"; + case chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Id: + return "GetWeeklySchedule"; + case chip::app::Clusters::Thermostat::Commands::ClearWeeklySchedule::Id: + return "ClearWeeklySchedule"; + case chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::Id: + return "SetActiveScheduleRequest"; + case chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::Id: + return "SetActivePresetRequest"; + case chip::app::Clusters::Thermostat::Commands::AtomicRequest::Id: + return "AtomicRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FanControl::Id: { + switch (id) + { + case chip::app::Clusters::FanControl::Commands::Step::Id: + return "Step"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ColorControl::Id: { + switch (id) + { + case chip::app::Clusters::ColorControl::Commands::MoveToHue::Id: + return "MoveToHue"; + case chip::app::Clusters::ColorControl::Commands::MoveHue::Id: + return "MoveHue"; + case chip::app::Clusters::ColorControl::Commands::StepHue::Id: + return "StepHue"; + case chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Id: + return "MoveToSaturation"; + case chip::app::Clusters::ColorControl::Commands::MoveSaturation::Id: + return "MoveSaturation"; + case chip::app::Clusters::ColorControl::Commands::StepSaturation::Id: + return "StepSaturation"; + case chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Id: + return "MoveToHueAndSaturation"; + case chip::app::Clusters::ColorControl::Commands::MoveToColor::Id: + return "MoveToColor"; + case chip::app::Clusters::ColorControl::Commands::MoveColor::Id: + return "MoveColor"; + case chip::app::Clusters::ColorControl::Commands::StepColor::Id: + return "StepColor"; + case chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Id: + return "MoveToColorTemperature"; + case chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Id: + return "EnhancedMoveToHue"; + case chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Id: + return "EnhancedMoveHue"; + case chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Id: + return "EnhancedStepHue"; + case chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Id: + return "EnhancedMoveToHueAndSaturation"; + case chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Id: + return "ColorLoopSet"; + case chip::app::Clusters::ColorControl::Commands::StopMoveStep::Id: + return "StopMoveStep"; + case chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Id: + return "MoveColorTemperature"; + case chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Id: + return "StepColorTemperature"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WiFiNetworkManagement::Id: { + switch (id) + { + case chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseRequest::Id: + return "NetworkPassphraseRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadBorderRouterManagement::Id: { + switch (id) + { + case chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id: + return "GetActiveDatasetRequest"; + case chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetPendingDatasetRequest::Id: + return "GetPendingDatasetRequest"; + case chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetActiveDatasetRequest::Id: + return "SetActiveDatasetRequest"; + case chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetPendingDatasetRequest::Id: + return "SetPendingDatasetRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadNetworkDirectory::Id: { + switch (id) + { + case chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id: + return "AddNetwork"; + case chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id: + return "RemoveNetwork"; + case chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id: + return "GetOperationalDataset"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Channel::Id: { + switch (id) + { + case chip::app::Clusters::Channel::Commands::ChangeChannel::Id: + return "ChangeChannel"; + case chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Id: + return "ChangeChannelByNumber"; + case chip::app::Clusters::Channel::Commands::SkipChannel::Id: + return "SkipChannel"; + case chip::app::Clusters::Channel::Commands::GetProgramGuide::Id: + return "GetProgramGuide"; + case chip::app::Clusters::Channel::Commands::RecordProgram::Id: + return "RecordProgram"; + case chip::app::Clusters::Channel::Commands::CancelRecordProgram::Id: + return "CancelRecordProgram"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TargetNavigator::Id: { + switch (id) + { + case chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Id: + return "NavigateTarget"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MediaPlayback::Id: { + switch (id) + { + case chip::app::Clusters::MediaPlayback::Commands::Play::Id: + return "Play"; + case chip::app::Clusters::MediaPlayback::Commands::Pause::Id: + return "Pause"; + case chip::app::Clusters::MediaPlayback::Commands::Stop::Id: + return "Stop"; + case chip::app::Clusters::MediaPlayback::Commands::StartOver::Id: + return "StartOver"; + case chip::app::Clusters::MediaPlayback::Commands::Previous::Id: + return "Previous"; + case chip::app::Clusters::MediaPlayback::Commands::Next::Id: + return "Next"; + case chip::app::Clusters::MediaPlayback::Commands::Rewind::Id: + return "Rewind"; + case chip::app::Clusters::MediaPlayback::Commands::FastForward::Id: + return "FastForward"; + case chip::app::Clusters::MediaPlayback::Commands::SkipForward::Id: + return "SkipForward"; + case chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Id: + return "SkipBackward"; + case chip::app::Clusters::MediaPlayback::Commands::Seek::Id: + return "Seek"; + case chip::app::Clusters::MediaPlayback::Commands::ActivateAudioTrack::Id: + return "ActivateAudioTrack"; + case chip::app::Clusters::MediaPlayback::Commands::ActivateTextTrack::Id: + return "ActivateTextTrack"; + case chip::app::Clusters::MediaPlayback::Commands::DeactivateTextTrack::Id: + return "DeactivateTextTrack"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MediaInput::Id: { + switch (id) + { + case chip::app::Clusters::MediaInput::Commands::SelectInput::Id: + return "SelectInput"; + case chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Id: + return "ShowInputStatus"; + case chip::app::Clusters::MediaInput::Commands::HideInputStatus::Id: + return "HideInputStatus"; + case chip::app::Clusters::MediaInput::Commands::RenameInput::Id: + return "RenameInput"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LowPower::Id: { + switch (id) + { + case chip::app::Clusters::LowPower::Commands::Sleep::Id: + return "Sleep"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::KeypadInput::Id: { + switch (id) + { + case chip::app::Clusters::KeypadInput::Commands::SendKey::Id: + return "SendKey"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Id: + return "LaunchContent"; + case chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Id: + return "LaunchURL"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AudioOutput::Id: { + switch (id) + { + case chip::app::Clusters::AudioOutput::Commands::SelectOutput::Id: + return "SelectOutput"; + case chip::app::Clusters::AudioOutput::Commands::RenameOutput::Id: + return "RenameOutput"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ApplicationLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Id: + return "LaunchApp"; + case chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Id: + return "StopApp"; + case chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Id: + return "HideApp"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccountLogin::Id: { + switch (id) + { + case chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Id: + return "GetSetupPIN"; + case chip::app::Clusters::AccountLogin::Commands::Login::Id: + return "Login"; + case chip::app::Clusters::AccountLogin::Commands::Logout::Id: + return "Logout"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentControl::Id: { + switch (id) + { + case chip::app::Clusters::ContentControl::Commands::UpdatePIN::Id: + return "UpdatePIN"; + case chip::app::Clusters::ContentControl::Commands::ResetPIN::Id: + return "ResetPIN"; + case chip::app::Clusters::ContentControl::Commands::Enable::Id: + return "Enable"; + case chip::app::Clusters::ContentControl::Commands::Disable::Id: + return "Disable"; + case chip::app::Clusters::ContentControl::Commands::AddBonusTime::Id: + return "AddBonusTime"; + case chip::app::Clusters::ContentControl::Commands::SetScreenDailyTime::Id: + return "SetScreenDailyTime"; + case chip::app::Clusters::ContentControl::Commands::BlockUnratedContent::Id: + return "BlockUnratedContent"; + case chip::app::Clusters::ContentControl::Commands::UnblockUnratedContent::Id: + return "UnblockUnratedContent"; + case chip::app::Clusters::ContentControl::Commands::SetOnDemandRatingThreshold::Id: + return "SetOnDemandRatingThreshold"; + case chip::app::Clusters::ContentControl::Commands::SetScheduledContentRatingThreshold::Id: + return "SetScheduledContentRatingThreshold"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentAppObserver::Id: { + switch (id) + { + case chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Id: + return "ContentAppMessage"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::CommissionerControl::Id: { + switch (id) + { + case chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::Id: + return "RequestCommissioningApproval"; + case chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Id: + return "CommissionNode"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ElectricalMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoCommand::Id: + return "GetProfileInfoCommand"; + case chip::app::Clusters::ElectricalMeasurement::Commands::GetMeasurementProfileCommand::Id: + return "GetMeasurementProfileCommand"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::UnitTesting::Id: { + switch (id) + { + case chip::app::Clusters::UnitTesting::Commands::Test::Id: + return "Test"; + case chip::app::Clusters::UnitTesting::Commands::TestNotHandled::Id: + return "TestNotHandled"; + case chip::app::Clusters::UnitTesting::Commands::TestSpecific::Id: + return "TestSpecific"; + case chip::app::Clusters::UnitTesting::Commands::TestUnknownCommand::Id: + return "TestUnknownCommand"; + case chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Id: + return "TestAddArguments"; + case chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Id: + return "TestSimpleArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest::Id: + return "TestStructArrayArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Id: + return "TestStructArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Id: + return "TestNestedStructArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Id: + return "TestListStructArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Id: + return "TestListInt8UArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Id: + return "TestNestedStructListArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Id: + return "TestListNestedStructListArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Id: + return "TestListInt8UReverseRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Id: + return "TestEnumsRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Id: + return "TestNullableOptionalRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Id: + return "TestComplexNullableOptionalRequest"; + case chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Id: + return "SimpleStructEchoRequest"; + case chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Id: + return "TimedInvokeRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Id: + return "TestSimpleOptionalArgumentRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Id: + return "TestEmitTestEventRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Id: + return "TestEmitTestFabricScopedEventRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestBatchHelperRequest::Id: + return "TestBatchHelperRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestSecondBatchHelperRequest::Id: + return "TestSecondBatchHelperRequest"; + case chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::Id: + return "StringEchoRequest"; + case chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Id: + return "GlobalEchoRequest"; + case chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiRequest::Id: + return "TestDifferentVendorMeiRequest"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::FaultInjection::Id: { + switch (id) + { + case chip::app::Clusters::FaultInjection::Commands::FailAtFault::Id: + return "FailAtFault"; + case chip::app::Clusters::FaultInjection::Commands::FailRandomlyAtFault::Id: + return "FailRandomlyAtFault"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SampleMei::Id: { + switch (id) + { + case chip::app::Clusters::SampleMei::Commands::Ping::Id: + return "Ping"; + case chip::app::Clusters::SampleMei::Commands::AddArguments::Id: + return "AddArguments"; + default: + return "Unknown"; + } + } + default: + return "Unknown"; + } +} + +char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) +{ + switch (cluster) + { + case chip::app::Clusters::Groups::Id: { + switch (id) + { + case chip::app::Clusters::Groups::Commands::AddGroupResponse::Id: + return "AddGroupResponse"; + case chip::app::Clusters::Groups::Commands::ViewGroupResponse::Id: + return "ViewGroupResponse"; + case chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::Id: + return "GetGroupMembershipResponse"; + case chip::app::Clusters::Groups::Commands::RemoveGroupResponse::Id: + return "RemoveGroupResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccessControl::Id: { + switch (id) + { + case chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::Id: + return "ReviewFabricRestrictionsResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OtaSoftwareUpdateProvider::Id: { + switch (id) + { + case chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id: + return "QueryImageResponse"; + case chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id: + return "ApplyUpdateResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::Id: + return "ArmFailSafeResponse"; + case chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::Id: + return "SetRegulatoryConfigResponse"; + case chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::Id: + return "CommissioningCompleteResponse"; + case chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgementsResponse::Id: + return "SetTCAcknowledgementsResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::NetworkCommissioning::Id: { + switch (id) + { + case chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::Id: + return "ScanNetworksResponse"; + case chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id: + return "NetworkConfigResponse"; + case chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetworkResponse::Id: + return "ConnectNetworkResponse"; + case chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentityResponse::Id: + return "QueryIdentityResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DiagnosticLogs::Id: { + switch (id) + { + case chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::Id: + return "RetrieveLogsResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GeneralDiagnostics::Id: { + switch (id) + { + case chip::app::Clusters::GeneralDiagnostics::Commands::TimeSnapshotResponse::Id: + return "TimeSnapshotResponse"; + case chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestResponse::Id: + return "PayloadTestResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TimeSynchronization::Id: { + switch (id) + { + case chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::Id: + return "SetTimeZoneResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalCredentials::Id: { + switch (id) + { + case chip::app::Clusters::OperationalCredentials::Commands::AttestationResponse::Id: + return "AttestationResponse"; + case chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::Id: + return "CertificateChainResponse"; + case chip::app::Clusters::OperationalCredentials::Commands::CSRResponse::Id: + return "CSRResponse"; + case chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id: + return "NOCResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::GroupKeyManagement::Id: { + switch (id) + { + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::Id: + return "KeySetReadResponse"; + case chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Id: + return "KeySetReadAllIndicesResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::IcdManagement::Id: { + switch (id) + { + case chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id: + return "RegisterClientResponse"; + case chip::app::Clusters::IcdManagement::Commands::StayActiveResponse::Id: + return "StayActiveResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenCavityOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id: + return "OperationalCommandResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OvenMode::Id: { + switch (id) + { + case chip::app::Clusters::OvenMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::LaundryWasherMode::Id: { + switch (id) + { + case chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id: { + switch (id) + { + case chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcRunMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcRunMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcCleanMode::Id: { + switch (id) + { + case chip::app::Clusters::RvcCleanMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DishwasherMode::Id: { + switch (id) + { + case chip::app::Clusters::DishwasherMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::OperationalState::Id: { + switch (id) + { + case chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id: + return "OperationalCommandResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::RvcOperationalState::Id: { + switch (id) + { + case chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id: + return "OperationalCommandResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ScenesManagement::Id: { + switch (id) + { + case chip::app::Clusters::ScenesManagement::Commands::AddSceneResponse::Id: + return "AddSceneResponse"; + case chip::app::Clusters::ScenesManagement::Commands::ViewSceneResponse::Id: + return "ViewSceneResponse"; + case chip::app::Clusters::ScenesManagement::Commands::RemoveSceneResponse::Id: + return "RemoveSceneResponse"; + case chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenesResponse::Id: + return "RemoveAllScenesResponse"; + case chip::app::Clusters::ScenesManagement::Commands::StoreSceneResponse::Id: + return "StoreSceneResponse"; + case chip::app::Clusters::ScenesManagement::Commands::GetSceneMembershipResponse::Id: + return "GetSceneMembershipResponse"; + case chip::app::Clusters::ScenesManagement::Commands::CopySceneResponse::Id: + return "CopySceneResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvse::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::Id: + return "GetTargetsResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::EnergyEvseMode::Id: { + switch (id) + { + case chip::app::Clusters::EnergyEvseMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WaterHeaterMode::Id: { + switch (id) + { + case chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DeviceEnergyManagementMode::Id: { + switch (id) + { + case chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::Id: + return "ChangeToModeResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::DoorLock::Id: { + switch (id) + { + case chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::Id: + return "GetWeekDayScheduleResponse"; + case chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::Id: + return "GetYearDayScheduleResponse"; + case chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::Id: + return "GetHolidayScheduleResponse"; + case chip::app::Clusters::DoorLock::Commands::GetUserResponse::Id: + return "GetUserResponse"; + case chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::Id: + return "SetCredentialResponse"; + case chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::Id: + return "GetCredentialStatusResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ServiceArea::Id: { + switch (id) + { + case chip::app::Clusters::ServiceArea::Commands::SelectAreasResponse::Id: + return "SelectAreasResponse"; + case chip::app::Clusters::ServiceArea::Commands::SkipAreaResponse::Id: + return "SkipAreaResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Thermostat::Id: { + switch (id) + { + case chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::Id: + return "GetWeeklyScheduleResponse"; + case chip::app::Clusters::Thermostat::Commands::AtomicResponse::Id: + return "AtomicResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::WiFiNetworkManagement::Id: { + switch (id) + { + case chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::Id: + return "NetworkPassphraseResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadBorderRouterManagement::Id: { + switch (id) + { + case chip::app::Clusters::ThreadBorderRouterManagement::Commands::DatasetResponse::Id: + return "DatasetResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ThreadNetworkDirectory::Id: { + switch (id) + { + case chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id: + return "OperationalDatasetResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::Channel::Id: { + switch (id) + { + case chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Id: + return "ChangeChannelResponse"; + case chip::app::Clusters::Channel::Commands::ProgramGuideResponse::Id: + return "ProgramGuideResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::TargetNavigator::Id: { + switch (id) + { + case chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Id: + return "NavigateTargetResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::MediaPlayback::Id: { + switch (id) + { + case chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id: + return "PlaybackResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::KeypadInput::Id: { + switch (id) + { + case chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Id: + return "SendKeyResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Id: + return "LauncherResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ApplicationLauncher::Id: { + switch (id) + { + case chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id: + return "LauncherResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::AccountLogin::Id: { + switch (id) + { + case chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Id: + return "GetSetupPINResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentControl::Id: { + switch (id) + { + case chip::app::Clusters::ContentControl::Commands::ResetPINResponse::Id: + return "ResetPINResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ContentAppObserver::Id: { + switch (id) + { + case chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessageResponse::Id: + return "ContentAppMessageResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::CommissionerControl::Id: { + switch (id) + { + case chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id: + return "ReverseOpenCommissioningWindow"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::ElectricalMeasurement::Id: { + switch (id) + { + case chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoResponseCommand::Id: + return "GetProfileInfoResponseCommand"; + case chip::app::Clusters::ElectricalMeasurement::Commands::GetMeasurementProfileResponseCommand::Id: + return "GetMeasurementProfileResponseCommand"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::UnitTesting::Id: { + switch (id) + { + case chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::Id: + return "TestSpecificResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::Id: + return "TestAddArgumentsResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentResponse::Id: + return "TestSimpleArgumentResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::Id: + return "TestStructArrayArgumentResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::Id: + return "TestListInt8UReverseResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestEnumsResponse::Id: + return "TestEnumsResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::Id: + return "TestNullableOptionalResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalResponse::Id: + return "TestComplexNullableOptionalResponse"; + case chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id: + return "BooleanResponse"; + case chip::app::Clusters::UnitTesting::Commands::SimpleStructResponse::Id: + return "SimpleStructResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::Id: + return "TestEmitTestEventResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventResponse::Id: + return "TestEmitTestFabricScopedEventResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::Id: + return "TestBatchHelperResponse"; + case chip::app::Clusters::UnitTesting::Commands::StringEchoResponse::Id: + return "StringEchoResponse"; + case chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::Id: + return "GlobalEchoResponse"; + case chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiResponse::Id: + return "TestDifferentVendorMeiResponse"; + default: + return "Unknown"; + } + } + case chip::app::Clusters::SampleMei::Id: { + switch (id) + { + case chip::app::Clusters::SampleMei::Commands::AddArgumentsResponse::Id: + return "AddArgumentsResponse"; + default: + return "Unknown"; + } + } + default: + return "Unknown"; + } +} diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.h new file mode 100644 index 00000000000000..27fa6512fbdd01 --- /dev/null +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/EntryToText.h @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#include +#include +#include + +char const * ClusterIdToText(chip::ClusterId id); + +char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id); + +char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); + +char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); From 07789d41bb849e18a970451c6bd6c7189cbc5362 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 22 Aug 2024 09:56:19 +0100 Subject: [PATCH 23/53] Truncate map and area names (#35127) * Updated the setting of the area and map names so that if the name given is greater than the buffer size, it's truncated rater to set to empty. * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../service-area-cluster-objects.h | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/app/clusters/service-area-server/service-area-cluster-objects.h b/src/app/clusters/service-area-server/service-area-cluster-objects.h index 66f20720701587..69a392a874f49d 100644 --- a/src/app/clusters/service-area-server/service-area-cluster-objects.h +++ b/src/app/clusters/service-area-server/service-area-cluster-objects.h @@ -109,12 +109,14 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: const DataModel::Nullable & areaType) { areaDesc.locationInfo.SetNonNull(); - // Copy the name - auto areaNameSpan = MutableCharSpan(mAreaNameBuffer, kAreaNameMaxSize); - CopyCharSpanToMutableCharSpan(locationName, areaNameSpan); - areaDesc.locationInfo.Value().locationName = CharSpan(areaNameSpan.data(), areaNameSpan.size()); - areaDesc.locationInfo.Value().floorNumber = floorNumber; - areaDesc.locationInfo.Value().areaType = areaType; + + // Copy the name. If the name is larger than kAreaNameMaxSize, truncate it to fit. + auto sizeToCopy = std::min(kAreaNameMaxSize, locationName.size()); + memcpy(mAreaNameBuffer, locationName.data(), sizeToCopy); + areaDesc.locationInfo.Value().locationName = CharSpan(mAreaNameBuffer, sizeToCopy); + + areaDesc.locationInfo.Value().floorNumber = floorNumber; + areaDesc.locationInfo.Value().areaType = areaType; return *this; } @@ -320,10 +322,11 @@ struct MapStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::M */ void Set(uint32_t aMapId, const CharSpan & aMapName) { - mapID = aMapId; - auto mapNameSpan = MutableCharSpan(mMapNameBuffer, kMapNameMaxSize); - CopyCharSpanToMutableCharSpan(aMapName, mapNameSpan); - name = CharSpan(mapNameSpan.data(), mapNameSpan.size()); + mapID = aMapId; + // Copy the name. If the name is larger than kMapNameMaxSize, truncate it to fit. + auto sizeToCopy = std::min(kMapNameMaxSize, aMapName.size()); + memcpy(mMapNameBuffer, aMapName.data(), sizeToCopy); + name = CharSpan(mMapNameBuffer, sizeToCopy); } /** From 607a6da04159723dd251262b960c5389bbd6318a Mon Sep 17 00:00:00 2001 From: Sean <97990350+s-mcclain@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:56:36 -0500 Subject: [PATCH 24/53] Add new CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS and (#35102) CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS macros to CHIPConfig. Use new lookup time min/max macros inside AddressResolve for default kMinLookupTimeMsDefault and kMaxLookupTimeMsDefault to allow for applications to override the time required to wait for an address lookup before timing out. --- src/lib/address_resolve/AddressResolve.h | 10 ++++++++-- src/lib/core/CHIPConfig.h | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/lib/address_resolve/AddressResolve.h b/src/lib/address_resolve/AddressResolve.h index 0d6f8ab719519d..1e45ffed5da907 100644 --- a/src/lib/address_resolve/AddressResolve.h +++ b/src/lib/address_resolve/AddressResolve.h @@ -143,8 +143,14 @@ class NodeLookupRequest } private: - static constexpr uint32_t kMinLookupTimeMsDefault = 200; - static constexpr uint32_t kMaxLookupTimeMsDefault = 45000; + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS) <= (CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS), + "AddressResolveMinLookupTime must be equal or less than AddressResolveMaxLookupTime"); + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS) >= 0, + "AddressResolveMinLookupTime must be equal or greater than 0"); + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS) < UINT32_MAX, + "AddressResolveMaxLookupTime must be less than UINT32_MAX"); + static constexpr uint32_t kMinLookupTimeMsDefault = CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS; + static constexpr uint32_t kMaxLookupTimeMsDefault = CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS; PeerId mPeerId; System::Clock::Milliseconds32 mMinLookupTimeMs{ kMinLookupTimeMsDefault }; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index e9c317dfc79d5c..7600b4eaa4c315 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1370,6 +1370,28 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS 1 #endif // CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS +/** + * @def CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS + * + * @brief Default minimum lookup time to wait during address resolve for + * additional DNSSD queries even if a reply has already been received, or + * to allow for additional heuristics regarding node choice to succeed, in + * milliseconds + */ +#ifndef CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS +#define CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS 200 +#endif // CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS + +/** + * @def CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS + * + * @brief Default maximum lookup time to wait during address resolve before + * a TIMEOUT error, in milliseconds + */ +#ifndef CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS +#define CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS 45000 +#endif // CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS + /* * @def CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE * From 58896ab304b7b7e1b7e0ae279c1a4ba271952d5e Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 22 Aug 2024 16:58:21 +0200 Subject: [PATCH 25/53] Fix CHIP REPL tests runner after changes in e407d40 (#34453) * Fix CHIP REPL tests runner after changes in e407d40 The click framework does not have a support for async functions. The async needs to be synchronized before applying click wrappers. * Accept 0x, 0b or 0o prefix for int values * Fix for non-string numbers * Exclude Test_TC_BRBINFO_2_1 from chip-repl engine * Log what happened in case of pseudo cluster creation failure * Fix typo * Fix typo when accessing TestGlobalStruct * Fix new line --- scripts/tests/chiptest/__init__.py | 1 + .../tests/chiptest/yamltest_with_chip_repl_tester.py | 11 ++++++++++- src/controller/python/chip/yaml/format_converter.py | 7 ++++--- src/controller/python/chip/yaml/runner.py | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index aef22e030eae8d..03ac663427ce84 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -234,6 +234,7 @@ def _GetChipReplUnsupportedTests() -> Set[str]: "TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestReadNoneSubscribeNone.yaml", # chip-repl does not support AnyCommands (07/27/2023) "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) + "Test_TC_BRBINFO_2_1.yaml", # chip-repl does not support AnyCommands (24/07/2024) "TestIcdManagementCluster.yaml", # TODO(#30430): add ICD registration support in chip-repl "Test_TC_ICDM_3_4.yaml", # chip-repl does not support ICD registration # chip-repl and chip-tool disagree on what the YAML here should look like: https://github.com/project-chip/connectedhomeip/issues/29110 diff --git a/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py b/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py index 1b301c572874d0..70f9215f5456be 100644 --- a/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py +++ b/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py @@ -16,6 +16,7 @@ import asyncio import atexit +import functools import logging import os import tempfile @@ -84,6 +85,13 @@ async def execute_test(yaml, runner): raise Exception(f'Test step failed {test_step.label}') +def asyncio_executor(f): + @functools.wraps(f) + def wrapper(*args, **kwargs): + return asyncio.run(f(*args, **kwargs)) + return wrapper + + @click.command() @click.option( '--setup-code', @@ -101,6 +109,7 @@ async def execute_test(yaml, runner): '--pics-file', default=None, help='Optional PICS file') +@asyncio_executor async def main(setup_code, yaml_path, node_id, pics_file): # Setting up python environment for running YAML CI tests using python parser. with tempfile.NamedTemporaryFile() as chip_stack_storage: @@ -153,4 +162,4 @@ def _StackShutDown(): if __name__ == '__main__': - asyncio.run(main()) + main() diff --git a/src/controller/python/chip/yaml/format_converter.py b/src/controller/python/chip/yaml/format_converter.py index eefe61f172ee15..1be051155b6040 100644 --- a/src/controller/python/chip/yaml/format_converter.py +++ b/src/controller/python/chip/yaml/format_converter.py @@ -198,10 +198,11 @@ def convert_to_data_model_type(field_value, field_type): return field_value # YAML conversion treats all numbers as ints. Convert to a uint type if the schema # type indicates so. - elif (field_type == uint): + elif (type(field_value) is str and field_type == uint): # Longer number are stored as strings. Need to make this conversion first. - value = int(field_value) - return field_type(value) + # The value can be represented in binary, octal, decimal or hexadecimal + # format. + return field_type(int(field_value, 0)) # YAML treats enums as ints. Convert to the typed enum class. elif (issubclass(field_type, MatterIntEnum)): return field_type.extend_enum_if_value_doesnt_exist(field_value) diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index 00e0de2154e5ec..8a19109439e3cf 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -832,7 +832,8 @@ def _commissioner_command_action_factory(self, test_step): def _default_pseudo_cluster(self, test_step): try: return DefaultPseudoCluster(test_step) - except ActionCreationError: + except ActionCreationError as e: + logger.warn(f"Failed create default pseudo cluster: {e}") return None def encode(self, request) -> Optional[BaseAction]: From 7ad2fc9b2db389f10f963a1b1d546df43375edac Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:00:41 -0400 Subject: [PATCH 26/53] use CHIP_DEVICE_CONFIG_FAILSAFE_EXPIRY_LENGTH_SEC define to arme the failsafe (#35137) --- src/app/server/CommissioningWindowManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 47bc3e8ff97f07..01bff4bf07db46 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -221,7 +221,8 @@ void CommissioningWindowManager::OnSessionEstablished(const SessionHandle & sess } else { - err = failSafeContext.ArmFailSafe(kUndefinedFabricIndex, System::Clock::Seconds16(60)); + err = failSafeContext.ArmFailSafe(kUndefinedFabricIndex, + System::Clock::Seconds16(CHIP_DEVICE_CONFIG_FAILSAFE_EXPIRY_LENGTH_SEC)); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Error arming failsafe on PASE session establishment completion"); From ae5d75c69f6cec4fb62b991e57b895b6f4812291 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 22 Aug 2024 13:13:04 -0400 Subject: [PATCH 27/53] Remove unnecessary invokeCommand overrides from MTRDevice_Concrete. (#35151) The one part that is not shared with the XPC implementation is _invokeCommandWithEndpointID:.... Everything else is just generic argument massaging and forwarding that can keep living in the base MTRDevice. --- .../Framework/CHIP/MTRDevice_Concrete.mm | 126 ------------------ 1 file changed, 126 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index 120d29aff122d4..12614ea4091b0c 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -2835,59 +2835,6 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; } -- (void)invokeCommandWithEndpointID:(NSNumber *)endpointID - clusterID:(NSNumber *)clusterID - commandID:(NSNumber *)commandID - commandFields:(NSDictionary * _Nullable)commandFields - expectedValues:(NSArray *> * _Nullable)expectedValues - expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval - queue:(dispatch_queue_t)queue - completion:(MTRDeviceResponseHandler)completion -{ - if (commandFields == nil) { - commandFields = @{ - MTRTypeKey : MTRStructureValueType, - MTRValueKey : @[], - }; - } - - [self invokeCommandWithEndpointID:endpointID - clusterID:clusterID - commandID:commandID - commandFields:commandFields - expectedValues:expectedValues - expectedValueInterval:expectedValueInterval - timedInvokeTimeout:nil - queue:queue - completion:completion]; -} - -- (void)invokeCommandWithEndpointID:(NSNumber *)endpointID - clusterID:(NSNumber *)clusterID - commandID:(NSNumber *)commandID - commandFields:(id)commandFields - expectedValues:(NSArray *> * _Nullable)expectedValues - expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval - timedInvokeTimeout:(NSNumber * _Nullable)timeout - queue:(dispatch_queue_t)queue - completion:(MTRDeviceResponseHandler)completion -{ - // We don't have a way to communicate a non-default invoke timeout - // here for now. - // TODO: https://github.com/project-chip/connectedhomeip/issues/24563 - - [self _invokeCommandWithEndpointID:endpointID - clusterID:clusterID - commandID:commandID - commandFields:commandFields - expectedValues:expectedValues - expectedValueInterval:expectedValueInterval - timedInvokeTimeout:timeout - serverSideProcessingTimeout:nil - queue:queue - completion:completion]; -} - - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID commandID:(NSNumber *)commandID @@ -2985,58 +2932,6 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"invoke %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, commandID.unsignedLongLongValue]; } -- (void)_invokeKnownCommandWithEndpointID:(NSNumber *)endpointID - clusterID:(NSNumber *)clusterID - commandID:(NSNumber *)commandID - commandPayload:(id)commandPayload - expectedValues:(NSArray *> * _Nullable)expectedValues - expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval - timedInvokeTimeout:(NSNumber * _Nullable)timeout - serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout - responseClass:(Class _Nullable)responseClass - queue:(dispatch_queue_t)queue - completion:(void (^)(id _Nullable response, NSError * _Nullable error))completion -{ - if (![commandPayload respondsToSelector:@selector(_encodeAsDataValue:)]) { - dispatch_async(queue, ^{ - completion(nil, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]); - }); - return; - } - - NSError * encodingError; - auto * commandFields = [commandPayload _encodeAsDataValue:&encodingError]; - if (commandFields == nil) { - dispatch_async(queue, ^{ - completion(nil, encodingError); - }); - return; - } - - auto responseHandler = ^(NSArray *> * _Nullable values, NSError * _Nullable error) { - id _Nullable response = nil; - if (error == nil) { - if (values.count != 1) { - error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:nil]; - } else if (responseClass != nil) { - response = [[responseClass alloc] initWithResponseValue:values[0] error:&error]; - } - } - completion(response, error); - }; - - [self _invokeCommandWithEndpointID:endpointID - clusterID:clusterID - commandID:commandID - commandFields:commandFields - expectedValues:expectedValues - expectedValueInterval:expectedValueInterval - timedInvokeTimeout:timeout - serverSideProcessingTimeout:serverSideProcessingTimeout - queue:queue - completion:responseHandler]; -} - - (void)openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration @@ -4072,27 +3967,6 @@ + (MTRDevice *)deviceWithNodeID:(uint64_t)nodeID deviceController:(MTRDeviceCont return [self deviceWithNodeID:@(nodeID) controller:deviceController]; } -- (void)invokeCommandWithEndpointID:(NSNumber *)endpointID - clusterID:(NSNumber *)clusterID - commandID:(NSNumber *)commandID - commandFields:(id)commandFields - expectedValues:(NSArray *> * _Nullable)expectedValues - expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval - timedInvokeTimeout:(NSNumber * _Nullable)timeout - clientQueue:(dispatch_queue_t)queue - completion:(MTRDeviceResponseHandler)completion -{ - [self invokeCommandWithEndpointID:endpointID - clusterID:clusterID - commandID:commandID - commandFields:commandFields - expectedValues:expectedValues - expectedValueInterval:expectedValueInterval - timedInvokeTimeout:timeout - queue:queue - completion:completion]; -} - @end #pragma mark - SubscriptionCallback From 26956012d4d6d6a14796a2894ffe4af0a3c88ff9 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 22 Aug 2024 13:16:50 -0400 Subject: [PATCH 28/53] Remove readAttributeWithEndpointID implementation from MTRDevice. (#35150) This is implemented (differently) by the different subclasses. Once this implementation is removed, the following become unreachable and can be removed: * _attributeValueDictionaryForAttributePath * _subscriptionAbleToReport * _readThroughSkipped At that point _subscriptionsAllowed becomes unreachable and can be removed. --- src/darwin/Framework/CHIP/MTRDevice.mm | 229 +------------------------ 1 file changed, 7 insertions(+), 222 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index d4027f7725ddeb..3f2acce5f5587e 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -649,21 +649,7 @@ - (void)_setDSTOffsets:(NSArray return outputArray; } -#pragma mark Subscription and delegate handling - -// subscription intervals are in seconds -#define MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MIN (10 * 60) // 10 minutes (for now) -#define MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX (60 * 60) // 60 minutes - -- (BOOL)_subscriptionsAllowed -{ - os_unfair_lock_assert_owner(&self->_lock); - - // TODO: XPC: This function and all its callsites should go away from this class. - - // We should not allow a subscription for device controllers over XPC. - return ![_deviceController isKindOfClass:MTRDeviceControllerOverXPC.class]; -} +#pragma mark Delegate handling - (void)setDelegate:(id)delegate queue:(dispatch_queue_t)queue { @@ -757,41 +743,6 @@ - (void)nodeMayBeAdvertisingOperational MTR_LOG("%@ saw new operational advertisement", self); } -// Return YES if we are in a state where, apart from communication issues with -// the device, we will be able to get reports via our subscription. -- (BOOL)_subscriptionAbleToReport -{ - std::lock_guard lock(_lock); - if (![self _delegateExists]) { - // No delegate definitely means no subscription. - return NO; - } - - // For unit testing only, matching logic in setDelegate -#ifdef DEBUG - __block BOOL useTestDelegateOverride = NO; - __block BOOL testDelegateShouldSetUpSubscriptionForDevice = NO; - [self _callFirstDelegateSynchronouslyWithBlock:^(id testDelegate) { - if ([testDelegate respondsToSelector:@selector(unitTestShouldSetUpSubscriptionForDevice:)]) { - useTestDelegateOverride = YES; - testDelegateShouldSetUpSubscriptionForDevice = [testDelegate unitTestShouldSetUpSubscriptionForDevice:self]; - } - }]; - if (useTestDelegateOverride && !testDelegateShouldSetUpSubscriptionForDevice) { - return NO; - } - -#endif - - // Subscriptions are not able to report if they are not allowed. - return [self _subscriptionsAllowed]; -} - -// Notification that read-through was skipped for an attribute read. -- (void)_readThroughSkipped -{ -} - - (BOOL)_delegateExists { os_unfair_lock_assert_owner(&self->_lock); @@ -1880,147 +1831,12 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) attributeID:(NSNumber *)attributeID params:(MTRReadParams * _Nullable)params { - MTRAttributePath * attributePath = [MTRAttributePath attributePathWithEndpointID:endpointID - clusterID:clusterID - attributeID:attributeID]; - - BOOL attributeIsSpecified = MTRAttributeIsSpecified(clusterID.unsignedIntValue, attributeID.unsignedIntValue); - BOOL hasChangesOmittedQuality; - if (attributeIsSpecified) { - hasChangesOmittedQuality = AttributeHasChangesOmittedQuality(attributePath); - } else { - if (params == nil) { - hasChangesOmittedQuality = NO; - } else { - hasChangesOmittedQuality = !params.assumeUnknownAttributesReportable; - } - } - - // Return current known / expected value right away - NSDictionary * attributeValueToReturn = [self _attributeValueDictionaryForAttributePath:attributePath]; - - // Send read request to device if any of the following are true: - // 1. Subscription not in a state we can expect reports - // 2. The attribute has the Changes Omitted quality, so we won't get reports for it. - // 3. The attribute is not in the spec, and the read params asks to assume - // an unknown attribute has the Changes Omitted quality. - if (![self _subscriptionAbleToReport] || hasChangesOmittedQuality) { - // Read requests container will be a mutable array of items, each being an array containing: - // [attribute request path, params] - // Batching handler should only coalesce when params are equal. - - // For this single read API there's only 1 array item. Use NSNull to stand in for nil params for easy comparison. - MTRAttributeRequestPath * readRequestPath = [MTRAttributeRequestPath requestPathWithEndpointID:endpointID - clusterID:clusterID - attributeID:attributeID]; - NSArray * readRequestData = @[ readRequestPath, params ?: [NSNull null] ]; - - // But first, check if a duplicate read request is already queued and return - if ([_asyncWorkQueue hasDuplicateForTypeID:MTRDeviceWorkItemDuplicateReadTypeID workItemData:readRequestData]) { - return attributeValueToReturn; - } - - NSMutableArray * readRequests = [NSMutableArray arrayWithObject:readRequestData]; - - // Create work item, set ready handler to perform task, then enqueue the work - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; - uint64_t workItemID = workItem.uniqueID; // capture only the ID, not the work item - NSNumber * nodeID = [self nodeID]; - - [workItem setBatchingID:MTRDeviceWorkItemBatchingReadID data:readRequests handler:^(id opaqueDataCurrent, id opaqueDataNext) { - mtr_hide(self); // don't capture self accidentally - NSMutableArray * readRequestsCurrent = opaqueDataCurrent; - NSMutableArray * readRequestsNext = opaqueDataNext; - - MTRBatchingOutcome outcome = MTRNotBatched; - while (readRequestsNext.count) { - // Can only read up to 9 paths at a time, per spec - if (readRequestsCurrent.count >= 9) { - MTR_LOG("Batching read attribute work item [%llu]: cannot add more work, item is full [0x%016llX:%@:0x%llx:0x%llx]", workItemID, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - return outcome; - } - - // if params don't match then they cannot be merged - if (![readRequestsNext[0][MTRDeviceReadRequestFieldParamsIndex] - isEqual:readRequestsCurrent[0][MTRDeviceReadRequestFieldParamsIndex]]) { - MTR_LOG("Batching read attribute work item [%llu]: cannot add more work, parameter mismatch [0x%016llX:%@:0x%llx:0x%llx]", workItemID, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - return outcome; - } - - // merge the next item's first request into the current item's list - auto readItem = readRequestsNext.firstObject; - [readRequestsNext removeObjectAtIndex:0]; - [readRequestsCurrent addObject:readItem]; - MTR_LOG("Batching read attribute work item [%llu]: added %@ (now %lu requests total) [0x%016llX:%@:0x%llx:0x%llx]", - workItemID, readItem, static_cast(readRequestsCurrent.count), nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - outcome = MTRBatchedPartially; - } - NSCAssert(readRequestsNext.count == 0, @"should have batched everything or returned early"); - return MTRBatchedFully; - }]; - [workItem setDuplicateTypeID:MTRDeviceWorkItemDuplicateReadTypeID handler:^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { - mtr_hide(self); // don't capture self accidentally - for (NSArray * readItem in readRequests) { - if ([readItem isEqual:opaqueItemData]) { - MTR_LOG("Read attribute work item [%llu] report duplicate %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, readItem, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - *isDuplicate = YES; - *stop = YES; - return; - } - } - *stop = NO; - }]; - [workItem setReadyHandler:^(MTRDevice * self, NSInteger retryCount, MTRAsyncWorkCompletionBlock completion) { - // Sanity check - if (readRequests.count == 0) { - MTR_LOG_ERROR("Read attribute work item [%llu] contained no read requests", workItemID); - completion(MTRAsyncWorkComplete); - return; - } - - // Build the attribute paths from the read requests - NSMutableArray * attributePaths = [NSMutableArray array]; - for (NSArray * readItem in readRequests) { - NSAssert(readItem.count == 2, @"invalid read attribute item"); - [attributePaths addObject:readItem[MTRDeviceReadRequestFieldPathIndex]]; - } - // If param is the NSNull stand-in, then just use nil - id readParamObject = readRequests[0][MTRDeviceReadRequestFieldParamsIndex]; - MTRReadParams * readParams = (![readParamObject isEqual:[NSNull null]]) ? readParamObject : nil; - - MTRBaseDevice * baseDevice = [self newBaseDevice]; - [baseDevice - readAttributePaths:attributePaths - eventPaths:nil - params:readParams - includeDataVersion:YES - queue:self.queue - completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { - if (values) { - // Since the format is the same data-value dictionary, this looks like an - // attribute report - MTR_LOG("Read attribute work item [%llu] result: %@ [0x%016llX:%@:0x%llX:0x%llX]", workItemID, values, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - [self _handleAttributeReport:values fromSubscription:NO]; - } - - // TODO: better retry logic - if (error && (retryCount < 2)) { - MTR_LOG_ERROR("Read attribute work item [%llu] failed (will retry): %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, error, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - completion(MTRAsyncWorkNeedsRetry); - } else { - if (error) { - MTR_LOG("Read attribute work item [%llu] failed (giving up): %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, error, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); - } - completion(MTRAsyncWorkComplete); - } - }]; - }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; - } else { - [self _readThroughSkipped]; - } - - return attributeValueToReturn; +#define ErrorStr "MTRDevice readAttributeWithEndpointID:clusterID:attributeID:params: must be handled by subclasses" + MTR_LOG_ERROR(ErrorStr); +#ifdef DEBUG + NSAssert(NO, @ErrorStr); +#endif // DEBUG + return nil; } - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID @@ -2456,37 +2272,6 @@ - (void)_performScheduledExpirationCheck [self _checkExpiredExpectedValues]; } -// Get attribute value dictionary for an attribute path from the right cache -- (NSDictionary *)_attributeValueDictionaryForAttributePath:(MTRAttributePath *)attributePath -{ - std::lock_guard lock(_lock); - - // First check expected value cache - NSArray * expectedValue = _expectedValueCache[attributePath]; - if (expectedValue) { - NSDate * now = [NSDate date]; - if ([now compare:expectedValue[MTRDeviceExpectedValueFieldExpirationTimeIndex]] == NSOrderedDescending) { - // expired - purge and fall through - _expectedValueCache[attributePath] = nil; - } else { - // not yet expired - return result - return expectedValue[MTRDeviceExpectedValueFieldValueIndex]; - } - } - - // Then check read cache - NSDictionary * cachedAttributeValue = [self _cachedAttributeValueForPath:attributePath]; - if (cachedAttributeValue) { - return cachedAttributeValue; - } else { - // TODO: when not found in cache, generated default values should be used - MTR_LOG("%@ _attributeValueDictionaryForAttributePath: could not find cached attribute values for attribute %@", self, - attributePath); - } - - return nil; -} - - (BOOL)_attributeDataValue:(NSDictionary *)one isEqualToDataValue:(NSDictionary *)theOther { // Sanity check for nil cases From c6710f6268493f600b6d8ed5e7007abaa1c6f39e Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 22 Aug 2024 21:12:55 +0200 Subject: [PATCH 29/53] Fix paths for fabric apps compiled with build_examples.py (#35123) * Fix paths for fabric apps compiled with build_examples.py * Require RPC to be enabled when building fabric-admin and fabric-bridge --- examples/fabric-admin/scripts/run_fabric_sync.sh | 8 ++++---- examples/fabric-admin/scripts/stop_fabric_sync.sh | 2 +- scripts/build/build/targets.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/fabric-admin/scripts/run_fabric_sync.sh b/examples/fabric-admin/scripts/run_fabric_sync.sh index 8c820d111c37c1..957fe5f3cf16e9 100755 --- a/examples/fabric-admin/scripts/run_fabric_sync.sh +++ b/examples/fabric-admin/scripts/run_fabric_sync.sh @@ -7,14 +7,14 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEFAULT_ADMIN_CHOICES=( "./fabric-admin" "out/debug/standalone/fabric-admin" - "out/linux-x64-fabric-admin/fabric-admin" - "out/darwin-arm64-fabric-admin/fabric-admin" + "out/linux-x64-fabric-admin-rpc/fabric-admin" + "out/darwin-arm64-fabric-admin-rpc/fabric-admin" ) DEFAULT_BRIDGE_CHOICES=( "./fabric-bridge-app" "out/debug/standalone/fabric-bridge-app" - "out/linux-x64-fabric-bridge-app/fabric-bridge-app" - "out/darwin-arm64-fabric-bridge-app/fabric-bridge-app" + "out/linux-x64-fabric-bridge-rpc/fabric-bridge-app" + "out/darwin-arm64-fabric-bridge-rpc/fabric-bridge-app" ) FABRIC_ADMIN_LOG="/tmp/fabric_admin.log" FABRIC_BRIDGE_APP_LOG="/tmp/fabric_bridge_app.log" diff --git a/examples/fabric-admin/scripts/stop_fabric_sync.sh b/examples/fabric-admin/scripts/stop_fabric_sync.sh index e947c8992fac27..faa5c79ce211b6 100755 --- a/examples/fabric-admin/scripts/stop_fabric_sync.sh +++ b/examples/fabric-admin/scripts/stop_fabric_sync.sh @@ -20,5 +20,5 @@ if [ ! -z "$fabric_bridge_app_pid" ]; then fi # Remove /tmp/chip_* files and directories -sudo rm -rf /tmp/chip_* +rm -rf /tmp/chip_* echo "Removed /tmp/chip_* files and directories" diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 8ab6e2ca4e0d58..37ede960ac6f9f 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -128,8 +128,8 @@ def BuildHostTarget(): TargetPart('tv-app', app=HostApp.TV_APP), TargetPart('tv-casting-app', app=HostApp.TV_CASTING), TargetPart('bridge', app=HostApp.BRIDGE), - TargetPart('fabric-admin', app=HostApp.FABRIC_ADMIN), - TargetPart('fabric-bridge', app=HostApp.FABRIC_BRIDGE), + TargetPart('fabric-admin', app=HostApp.FABRIC_ADMIN).OnlyIfRe("-rpc"), + TargetPart('fabric-bridge', app=HostApp.FABRIC_BRIDGE).OnlyIfRe("-rpc"), TargetPart('tests', app=HostApp.TESTS), TargetPart('chip-cert', app=HostApp.CERT_TOOL), TargetPart('address-resolve-tool', app=HostApp.ADDRESS_RESOLVE), From c1403a4f68456eb238ae5d09be85b0699c2df75f Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 22 Aug 2024 21:14:27 +0200 Subject: [PATCH 30/53] [Fabric-Sync] Allow to specify custom port in fabric-bridge (#35146) --- .../fabric-bridge-common/include/CHIPProjectAppConfig.h | 3 +++ examples/fabric-bridge-app/linux/args.gni | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h b/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h index 326ddf28572517..534079821043a8 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h +++ b/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h @@ -32,3 +32,6 @@ // include the CHIPProjectConfig from config/standalone #include + +// Allows app options (ports) to be configured on launch of app +#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1 diff --git a/examples/fabric-bridge-app/linux/args.gni b/examples/fabric-bridge-app/linux/args.gni index acbabffb359358..592855ea98ffa3 100644 --- a/examples/fabric-bridge-app/linux/args.gni +++ b/examples/fabric-bridge-app/linux/args.gni @@ -21,7 +21,7 @@ chip_project_config_include = "" chip_system_project_config_include = "" chip_project_config_include_dirs = - [ "${chip_root}/examples/bridge-app/bridge-common/include" ] + [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true From 339274a3ce9f12cb42549460802a1fb2f4dfed93 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:39:10 -0700 Subject: [PATCH 31/53] [Darwin] XPC invoke should implement bottom-most method (#35159) * [Darwin] XPC invoke should implement bottom-most method * Restyled fix --- .../Framework/CHIP/MTRDeviceController_XPC.mm | 2 +- src/darwin/Framework/CHIP/MTRDevice_XPC.mm | 21 +++++++++++-------- .../CHIP/XPC Protocol/MTRXPCServerProtocol.h | 3 ++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 7111aa4eb7f2bd..67049b280d81f3 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -52,7 +52,7 @@ - (NSXPCInterface *)_interfaceForServerProtocol ]]; [interface setClasses:allowedClasses - forSelector:@selector(deviceController:nodeID:invokeCommandWithEndpointID:clusterID:commandID:commandFields:expectedValues:expectedValueInterval:timedInvokeTimeout:completion:) + forSelector:@selector(deviceController:nodeID:invokeCommandWithEndpointID:clusterID:commandID:commandFields:expectedValues:expectedValueInterval:timedInvokeTimeout:serverSideProcessingTimeout:completion:) argumentIndex:0 ofReply:YES]; return interface; diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index 03f318d83517d7..bc3b0a6b26bc4b 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -194,18 +194,20 @@ - (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID : expectedValueInterval timedWriteTimeout : timeout) -- (void)invokeCommandWithEndpointID:(NSNumber *)endpointID - clusterID:(NSNumber *)clusterID - commandID:(NSNumber *)commandID - commandFields:(id)commandFields - expectedValues:(NSArray *> * _Nullable)expectedValues - expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval - timedInvokeTimeout:(NSNumber * _Nullable)timeout - queue:(dispatch_queue_t)queue - completion:(MTRDeviceResponseHandler)completion +- (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandFields:(id)commandFields + expectedValues:(NSArray *> * _Nullable)expectedValues + expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval + timedInvokeTimeout:(NSNumber * _Nullable)timeout + serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + queue:(dispatch_queue_t)queue + completion:(MTRDeviceResponseHandler)completion { NSXPCConnection * xpcConnection = [(MTRDeviceController_XPC *) [self deviceController] xpcConnection]; + // TODO: use asynchronous XPC and register a block with controller to call for this transaction [[xpcConnection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { MTR_LOG_ERROR("Error: %@", error); }] deviceController:[[self deviceController] uniqueIdentifier] @@ -217,6 +219,7 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID expectedValues:expectedValues expectedValueInterval:expectedValueInterval timedInvokeTimeout:timeout + serverSideProcessingTimeout:serverSideProcessingTimeout completion:completion]; } diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h index 1eebb0396570ac..81d6ab930cb6aa 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h @@ -29,7 +29,8 @@ MTR_NEWLY_AVAILABLE - (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID readAttributeWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID params:(MTRReadParams * _Nullable)params withReply:(void (^)(NSDictionary * _Nullable))reply; - (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID writeAttributeWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID value:(id _Nullable)value expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval timedWriteTimeout:(NSNumber * _Nullable)timeout; -- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID invokeCommandWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID commandID:(NSNumber *)commandID commandFields:(id)commandFields expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval timedInvokeTimeout:(NSNumber * _Nullable)timeout completion:(MTRDeviceResponseHandler)completion; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID invokeCommandWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID commandID:(NSNumber *)commandID commandFields:(id)commandFields expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval timedInvokeTimeout:(NSNumber * _Nullable)timeout serverSideProcessingTimeout:(NSNumber * _Nullable)serverSideProcessingTimeout + completion:(MTRDeviceResponseHandler)completion; // Not Supported via XPC //- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration completion:(MTRDeviceOpenCommissioningWindowHandler)completion; From 47b2783152208b40148d66a96f946dadc831986b Mon Sep 17 00:00:00 2001 From: William Date: Thu, 22 Aug 2024 23:46:47 +0100 Subject: [PATCH 32/53] Update PositionTag and AreaDesc field names (#35094) * Updated the PositionTag and AreaDesc field names in the service area XML. * Zap generated after XML update. * Updated the PositionTag and AreaDesc field names in the SDK server code and test scripts. * Restyled by clang-format * Fixed issues caused by merge. * reverted changes in generated code. * encoding --------- Co-authored-by: Restyled.io --- .../rvc-app/linux/RvcAppCommandDelegate.cpp | 4 +- examples/rvc-app/rvc-common/rvc-app.matter | 4 +- .../service-area-cluster-objects.h | 50 ++++---- .../service-area-server.cpp | 8 +- .../data-model/chip/service-area-cluster.xml | 6 +- .../data_model/controller-clusters.matter | 4 +- .../chip/devicecontroller/ChipStructs.java | 44 +++---- .../structs/ServiceAreaClusterAreaStruct.kt | 14 +-- .../ServiceAreaClusterLandmarkInfoStruct.kt | 20 ++-- .../structs/ServiceAreaClusterAreaStruct.kt | 14 +-- .../ServiceAreaClusterLandmarkInfoStruct.kt | 23 ++-- .../CHIPAttributeTLVValueDecoder.cpp | 111 +++++++++--------- .../python/chip/clusters/Objects.py | 8 +- .../MTRAttributeTLVValueDecoder.mm | 38 +++--- .../CHIP/zap-generated/MTRStructsObjc.h | 4 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 12 +- src/python_testing/TC_SEAR_1_2.py | 30 ++--- .../zap-generated/cluster-objects.cpp | 12 +- .../zap-generated/cluster-objects.h | 10 +- .../cluster/ComplexArgumentParser.cpp | 22 ++-- .../cluster/logging/DataModelLogger.cpp | 8 +- 21 files changed, 225 insertions(+), 221 deletions(-) diff --git a/examples/rvc-app/linux/RvcAppCommandDelegate.cpp b/examples/rvc-app/linux/RvcAppCommandDelegate.cpp index 791df4d482cfe8..187997f9f8bf00 100644 --- a/examples/rvc-app/linux/RvcAppCommandDelegate.cpp +++ b/examples/rvc-app/linux/RvcAppCommandDelegate.cpp @@ -216,9 +216,9 @@ void RvcAppCommandHandler::OnAddServiceAreaArea(Json::Value jsonValue) if (jsonValue.isMember("LandmarkTag")) { DataModel::Nullable relativePositionTag = DataModel::NullNullable; - if (jsonValue.isMember("PositionTag")) + if (jsonValue.isMember("RelativePositionTag")) { - relativePositionTag = Globals::RelativePositionTag(jsonValue["PositionTag"].asUInt()); + relativePositionTag = Globals::RelativePositionTag(jsonValue["RelativePositionTag"].asUInt()); } area.SetLandmarkInfo(Globals::LandmarkTag(jsonValue["LandmarkTag"].asUInt()), relativePositionTag); diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 4467c170acc6eb..29460e1f43c7a1 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1458,7 +1458,7 @@ provisional cluster ServiceArea = 336 { struct LandmarkInfoStruct { LandmarkTag landmarkTag = 0; - nullable RelativePositionTag positionTag = 1; + nullable RelativePositionTag relativePositionTag = 1; } struct AreaInfoStruct { @@ -1469,7 +1469,7 @@ provisional cluster ServiceArea = 336 { struct AreaStruct { int32u areaID = 0; nullable int32u mapID = 1; - AreaInfoStruct areaDesc = 2; + AreaInfoStruct areaInfo = 2; } struct MapStruct { diff --git a/src/app/clusters/service-area-server/service-area-cluster-objects.h b/src/app/clusters/service-area-server/service-area-cluster-objects.h index 69a392a874f49d..470cd09c02b67d 100644 --- a/src/app/clusters/service-area-server/service-area-cluster-objects.h +++ b/src/app/clusters/service-area-server/service-area-cluster-objects.h @@ -68,8 +68,8 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: { areaID = aOther.areaID; mapID = aOther.mapID; - SetLocationInfo(aOther.areaDesc.locationInfo); - SetLandmarkInfo(aOther.areaDesc.landmarkInfo); + SetLocationInfo(aOther.areaInfo.locationInfo); + SetLandmarkInfo(aOther.areaInfo.landmarkInfo); return *this; } @@ -95,7 +95,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: AreaStructureWrapper & SetLocationInfoNull() { - areaDesc.locationInfo.SetNull(); + areaInfo.locationInfo.SetNull(); return *this; } @@ -108,15 +108,15 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: AreaStructureWrapper & SetLocationInfo(const CharSpan & locationName, const DataModel::Nullable & floorNumber, const DataModel::Nullable & areaType) { - areaDesc.locationInfo.SetNonNull(); + areaInfo.locationInfo.SetNonNull(); // Copy the name. If the name is larger than kAreaNameMaxSize, truncate it to fit. auto sizeToCopy = std::min(kAreaNameMaxSize, locationName.size()); memcpy(mAreaNameBuffer, locationName.data(), sizeToCopy); - areaDesc.locationInfo.Value().locationName = CharSpan(mAreaNameBuffer, sizeToCopy); + areaInfo.locationInfo.Value().locationName = CharSpan(mAreaNameBuffer, sizeToCopy); - areaDesc.locationInfo.Value().floorNumber = floorNumber; - areaDesc.locationInfo.Value().areaType = areaType; + areaInfo.locationInfo.Value().floorNumber = floorNumber; + areaInfo.locationInfo.Value().areaType = areaType; return *this; } @@ -138,7 +138,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: AreaStructureWrapper & SetLandmarkInfoNull() { - areaDesc.landmarkInfo.SetNull(); + areaInfo.landmarkInfo.SetNull(); return *this; } @@ -150,9 +150,9 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: AreaStructureWrapper & SetLandmarkInfo(const Globals::LandmarkTag & landmarkTag, const DataModel::Nullable & relativePositionTag) { - areaDesc.landmarkInfo.SetNonNull(); - areaDesc.landmarkInfo.Value().landmarkTag = landmarkTag; - areaDesc.landmarkInfo.Value().positionTag = relativePositionTag; + areaInfo.landmarkInfo.SetNonNull(); + areaInfo.landmarkInfo.Value().landmarkTag = landmarkTag; + areaInfo.landmarkInfo.Value().relativePositionTag = relativePositionTag; return *this; } @@ -167,7 +167,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: return SetLandmarkInfoNull(); } - return SetLandmarkInfo(landmarkInfo.Value().landmarkTag, landmarkInfo.Value().positionTag); + return SetLandmarkInfo(landmarkInfo.Value().landmarkTag, landmarkInfo.Value().relativePositionTag); } /** @@ -178,9 +178,9 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: */ bool IsNameEqual(const CharSpan & aAreaName) const { - if (!areaDesc.locationInfo.IsNull()) + if (!areaInfo.locationInfo.IsNull()) { - return areaDesc.locationInfo.Value().locationName.data_equal(aAreaName); + return areaInfo.locationInfo.Value().locationName.data_equal(aAreaName); } return false; @@ -215,43 +215,43 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: return false; } - if (areaDesc.locationInfo.IsNull() != aOther.areaDesc.locationInfo.IsNull()) + if (areaInfo.locationInfo.IsNull() != aOther.areaInfo.locationInfo.IsNull()) { return false; } - if (!areaDesc.locationInfo.IsNull()) + if (!areaInfo.locationInfo.IsNull()) { - if (!IsNameEqual(aOther.areaDesc.locationInfo.Value().locationName)) + if (!IsNameEqual(aOther.areaInfo.locationInfo.Value().locationName)) { return false; } - if (areaDesc.locationInfo.Value().floorNumber != aOther.areaDesc.locationInfo.Value().floorNumber) + if (areaInfo.locationInfo.Value().floorNumber != aOther.areaInfo.locationInfo.Value().floorNumber) { return false; } - if (areaDesc.locationInfo.Value().areaType != aOther.areaDesc.locationInfo.Value().areaType) + if (areaInfo.locationInfo.Value().areaType != aOther.areaInfo.locationInfo.Value().areaType) { return false; } } - if (areaDesc.landmarkInfo.IsNull() != aOther.areaDesc.landmarkInfo.IsNull()) + if (areaInfo.landmarkInfo.IsNull() != aOther.areaInfo.landmarkInfo.IsNull()) { return false; } - if (!areaDesc.landmarkInfo.IsNull()) + if (!areaInfo.landmarkInfo.IsNull()) { - if (areaDesc.landmarkInfo.Value().landmarkTag != aOther.areaDesc.landmarkInfo.Value().landmarkTag) + if (areaInfo.landmarkInfo.Value().landmarkTag != aOther.areaInfo.landmarkInfo.Value().landmarkTag) { return false; } - if (areaDesc.landmarkInfo.Value().positionTag != aOther.areaDesc.landmarkInfo.Value().positionTag) + if (areaInfo.landmarkInfo.Value().relativePositionTag != aOther.areaInfo.landmarkInfo.Value().relativePositionTag) { return false; } @@ -265,12 +265,12 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs:: */ CharSpan GetName() { - if (areaDesc.locationInfo.IsNull()) + if (areaInfo.locationInfo.IsNull()) { return { mAreaNameBuffer, 0 }; } - return areaDesc.locationInfo.Value().locationName; + return areaInfo.locationInfo.Value().locationName; } private: diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index baf56cd4fc84be..2f2efceddd903d 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -442,7 +442,7 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea) { // If the LocationInfo field is null, the LandmarkInfo field SHALL NOT be null. // If the LandmarkInfo field is null, the LocationInfo field SHALL NOT be null. - if (aArea.areaDesc.locationInfo.IsNull() && aArea.areaDesc.landmarkInfo.IsNull()) + if (aArea.areaInfo.locationInfo.IsNull() && aArea.areaInfo.landmarkInfo.IsNull()) { ChipLogDetail(Zcl, "IsValidAsSupportedArea %" PRIu32 " - must have locationInfo and/or LandmarkInfo", aArea.areaID); return false; @@ -450,10 +450,10 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea) // If LocationInfo is not null, and its LocationName field is an empty string, at least one of the following SHALL NOT // be null: LocationInfo's FloorNumber field, LocationInfo's AreaType field, the LandmarkInfo - if (!aArea.areaDesc.locationInfo.IsNull()) + if (!aArea.areaInfo.locationInfo.IsNull()) { - if (aArea.areaDesc.locationInfo.Value().locationName.empty() && aArea.areaDesc.locationInfo.Value().floorNumber.IsNull() && - aArea.areaDesc.locationInfo.Value().areaType.IsNull() && aArea.areaDesc.landmarkInfo.IsNull()) + if (aArea.areaInfo.locationInfo.Value().locationName.empty() && aArea.areaInfo.locationInfo.Value().floorNumber.IsNull() && + aArea.areaInfo.locationInfo.Value().areaType.IsNull() && aArea.areaInfo.landmarkInfo.IsNull()) { ChipLogDetail( Zcl, "IsValidAsSupportedArea %" PRIu32 " - AreaName is empty string, FloorNumber, AreaType, LandmarkInfo are null", diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml index e2f0199209d4eb..e4457c3745e2a7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml @@ -20,8 +20,8 @@ limitations under the License. Data types - - + + @@ -40,7 +40,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 52f43c048aed14..ede6f1117ed37f 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6483,7 +6483,7 @@ provisional cluster ServiceArea = 336 { struct LandmarkInfoStruct { LandmarkTag landmarkTag = 0; - nullable RelativePositionTag positionTag = 1; + nullable RelativePositionTag relativePositionTag = 1; } struct AreaInfoStruct { @@ -6494,7 +6494,7 @@ provisional cluster ServiceArea = 336 { struct AreaStruct { int32u areaID = 0; nullable int32u mapID = 1; - AreaInfoStruct areaDesc = 2; + AreaInfoStruct areaInfo = 2; } struct MapStruct { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 70e9ba6b1c6ef9..7ee8a88f80f64b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9294,22 +9294,22 @@ public String toString() { } public static class ServiceAreaClusterLandmarkInfoStruct { public Integer landmarkTag; - public @Nullable Integer positionTag; + public @Nullable Integer relativePositionTag; private static final long LANDMARK_TAG_ID = 0L; - private static final long POSITION_TAG_ID = 1L; + private static final long RELATIVE_POSITION_TAG_ID = 1L; public ServiceAreaClusterLandmarkInfoStruct( Integer landmarkTag, - @Nullable Integer positionTag + @Nullable Integer relativePositionTag ) { this.landmarkTag = landmarkTag; - this.positionTag = positionTag; + this.relativePositionTag = relativePositionTag; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(LANDMARK_TAG_ID, new UIntType(landmarkTag))); - values.add(new StructElement(POSITION_TAG_ID, positionTag != null ? new UIntType(positionTag) : new NullType())); + values.add(new StructElement(RELATIVE_POSITION_TAG_ID, relativePositionTag != null ? new UIntType(relativePositionTag) : new NullType())); return new StructType(values); } @@ -9319,23 +9319,23 @@ public static ServiceAreaClusterLandmarkInfoStruct decodeTlv(BaseTLVType tlvValu return null; } Integer landmarkTag = null; - @Nullable Integer positionTag = null; + @Nullable Integer relativePositionTag = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == LANDMARK_TAG_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); landmarkTag = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == POSITION_TAG_ID) { + } else if (element.contextTagNum() == RELATIVE_POSITION_TAG_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - positionTag = castingValue.value(Integer.class); + relativePositionTag = castingValue.value(Integer.class); } } } return new ServiceAreaClusterLandmarkInfoStruct( landmarkTag, - positionTag + relativePositionTag ); } @@ -9346,8 +9346,8 @@ public String toString() { output.append("\tlandmarkTag: "); output.append(landmarkTag); output.append("\n"); - output.append("\tpositionTag: "); - output.append(positionTag); + output.append("\trelativePositionTag: "); + output.append(relativePositionTag); output.append("\n"); output.append("}\n"); return output.toString(); @@ -9417,26 +9417,26 @@ public String toString() { public static class ServiceAreaClusterAreaStruct { public Long areaID; public @Nullable Long mapID; - public ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc; + public ChipStructs.ServiceAreaClusterAreaInfoStruct areaInfo; private static final long AREA_ID_ID = 0L; private static final long MAP_ID_ID = 1L; - private static final long AREA_DESC_ID = 2L; + private static final long AREA_INFO_ID = 2L; public ServiceAreaClusterAreaStruct( Long areaID, @Nullable Long mapID, - ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc + ChipStructs.ServiceAreaClusterAreaInfoStruct areaInfo ) { this.areaID = areaID; this.mapID = mapID; - this.areaDesc = areaDesc; + this.areaInfo = areaInfo; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(AREA_ID_ID, new UIntType(areaID))); values.add(new StructElement(MAP_ID_ID, mapID != null ? new UIntType(mapID) : new NullType())); - values.add(new StructElement(AREA_DESC_ID, areaDesc.encodeTlv())); + values.add(new StructElement(AREA_INFO_ID, areaInfo.encodeTlv())); return new StructType(values); } @@ -9447,7 +9447,7 @@ public static ServiceAreaClusterAreaStruct decodeTlv(BaseTLVType tlvValue) { } Long areaID = null; @Nullable Long mapID = null; - ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc = null; + ChipStructs.ServiceAreaClusterAreaInfoStruct areaInfo = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == AREA_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -9459,17 +9459,17 @@ public static ServiceAreaClusterAreaStruct decodeTlv(BaseTLVType tlvValue) { UIntType castingValue = element.value(UIntType.class); mapID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == AREA_DESC_ID) { + } else if (element.contextTagNum() == AREA_INFO_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Struct) { StructType castingValue = element.value(StructType.class); - areaDesc = ChipStructs.ServiceAreaClusterAreaInfoStruct.decodeTlv(castingValue); + areaInfo = ChipStructs.ServiceAreaClusterAreaInfoStruct.decodeTlv(castingValue); } } } return new ServiceAreaClusterAreaStruct( areaID, mapID, - areaDesc + areaInfo ); } @@ -9483,8 +9483,8 @@ public String toString() { output.append("\tmapID: "); output.append(mapID); output.append("\n"); - output.append("\tareaDesc: "); - output.append(areaDesc); + output.append("\tareaInfo: "); + output.append(areaInfo); output.append("\n"); output.append("}\n"); return output.toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt index fc6405a96c2f7c..a5df845ac9c123 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -25,13 +25,13 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaStruct( val areaID: ULong, val mapID: ULong?, - val areaDesc: ServiceAreaClusterAreaInfoStruct, + val areaInfo: ServiceAreaClusterAreaInfoStruct, ) { override fun toString(): String = buildString { append("ServiceAreaClusterAreaStruct {\n") append("\tareaID : $areaID\n") append("\tmapID : $mapID\n") - append("\tareaDesc : $areaDesc\n") + append("\tareaInfo : $areaInfo\n") append("}\n") } @@ -44,7 +44,7 @@ class ServiceAreaClusterAreaStruct( } else { putNull(ContextSpecificTag(TAG_MAP_ID)) } - areaDesc.toTlv(ContextSpecificTag(TAG_AREA_DESC), this) + areaInfo.toTlv(ContextSpecificTag(TAG_AREA_INFO), this) endStructure() } } @@ -52,7 +52,7 @@ class ServiceAreaClusterAreaStruct( companion object { private const val TAG_AREA_ID = 0 private const val TAG_MAP_ID = 1 - private const val TAG_AREA_DESC = 2 + private const val TAG_AREA_INFO = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaStruct { tlvReader.enterStructure(tlvTag) @@ -64,12 +64,12 @@ class ServiceAreaClusterAreaStruct( tlvReader.getNull(ContextSpecificTag(TAG_MAP_ID)) null } - val areaDesc = - ServiceAreaClusterAreaInfoStruct.fromTlv(ContextSpecificTag(TAG_AREA_DESC), tlvReader) + val areaInfo = + ServiceAreaClusterAreaInfoStruct.fromTlv(ContextSpecificTag(TAG_AREA_INFO), tlvReader) tlvReader.exitContainer() - return ServiceAreaClusterAreaStruct(areaID, mapID, areaDesc) + return ServiceAreaClusterAreaStruct(areaID, mapID, areaInfo) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt index 04970798a28433..adf51e8e7c3f39 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt @@ -22,11 +22,11 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UInt, val positionTag: UInt?) { +class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UInt, val relativePositionTag: UInt?) { override fun toString(): String = buildString { append("ServiceAreaClusterLandmarkInfoStruct {\n") append("\tlandmarkTag : $landmarkTag\n") - append("\tpositionTag : $positionTag\n") + append("\trelativePositionTag : $relativePositionTag\n") append("}\n") } @@ -34,10 +34,10 @@ class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UInt, val positionTa tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) - if (positionTag != null) { - put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) + if (relativePositionTag != null) { + put(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG), relativePositionTag) } else { - putNull(ContextSpecificTag(TAG_POSITION_TAG)) + putNull(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) } endStructure() } @@ -45,22 +45,22 @@ class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UInt, val positionTa companion object { private const val TAG_LANDMARK_TAG = 0 - private const val TAG_POSITION_TAG = 1 + private const val TAG_RELATIVE_POSITION_TAG = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLandmarkInfoStruct { tlvReader.enterStructure(tlvTag) val landmarkTag = tlvReader.getUInt(ContextSpecificTag(TAG_LANDMARK_TAG)) - val positionTag = + val relativePositionTag = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_POSITION_TAG)) + tlvReader.getUInt(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) + tlvReader.getNull(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) null } tlvReader.exitContainer() - return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, positionTag) + return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, relativePositionTag) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt index d310fe5c315bf8..952623c2cf0215 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -25,13 +25,13 @@ import matter.tlv.TlvWriter class ServiceAreaClusterAreaStruct( val areaID: UInt, val mapID: UInt?, - val areaDesc: ServiceAreaClusterAreaInfoStruct, + val areaInfo: ServiceAreaClusterAreaInfoStruct, ) { override fun toString(): String = buildString { append("ServiceAreaClusterAreaStruct {\n") append("\tareaID : $areaID\n") append("\tmapID : $mapID\n") - append("\tareaDesc : $areaDesc\n") + append("\tareaInfo : $areaInfo\n") append("}\n") } @@ -44,7 +44,7 @@ class ServiceAreaClusterAreaStruct( } else { putNull(ContextSpecificTag(TAG_MAP_ID)) } - areaDesc.toTlv(ContextSpecificTag(TAG_AREA_DESC), this) + areaInfo.toTlv(ContextSpecificTag(TAG_AREA_INFO), this) endStructure() } } @@ -52,7 +52,7 @@ class ServiceAreaClusterAreaStruct( companion object { private const val TAG_AREA_ID = 0 private const val TAG_MAP_ID = 1 - private const val TAG_AREA_DESC = 2 + private const val TAG_AREA_INFO = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaStruct { tlvReader.enterStructure(tlvTag) @@ -64,12 +64,12 @@ class ServiceAreaClusterAreaStruct( tlvReader.getNull(ContextSpecificTag(TAG_MAP_ID)) null } - val areaDesc = - ServiceAreaClusterAreaInfoStruct.fromTlv(ContextSpecificTag(TAG_AREA_DESC), tlvReader) + val areaInfo = + ServiceAreaClusterAreaInfoStruct.fromTlv(ContextSpecificTag(TAG_AREA_INFO), tlvReader) tlvReader.exitContainer() - return ServiceAreaClusterAreaStruct(areaID, mapID, areaDesc) + return ServiceAreaClusterAreaStruct(areaID, mapID, areaInfo) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt index 119667c339d88c..84d369e9a82498 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLandmarkInfoStruct.kt @@ -22,11 +22,14 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UByte, val positionTag: UByte?) { +class ServiceAreaClusterLandmarkInfoStruct( + val landmarkTag: UByte, + val relativePositionTag: UByte?, +) { override fun toString(): String = buildString { append("ServiceAreaClusterLandmarkInfoStruct {\n") append("\tlandmarkTag : $landmarkTag\n") - append("\tpositionTag : $positionTag\n") + append("\trelativePositionTag : $relativePositionTag\n") append("}\n") } @@ -34,10 +37,10 @@ class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UByte, val positionT tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag) - if (positionTag != null) { - put(ContextSpecificTag(TAG_POSITION_TAG), positionTag) + if (relativePositionTag != null) { + put(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG), relativePositionTag) } else { - putNull(ContextSpecificTag(TAG_POSITION_TAG)) + putNull(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) } endStructure() } @@ -45,22 +48,22 @@ class ServiceAreaClusterLandmarkInfoStruct(val landmarkTag: UByte, val positionT companion object { private const val TAG_LANDMARK_TAG = 0 - private const val TAG_POSITION_TAG = 1 + private const val TAG_RELATIVE_POSITION_TAG = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLandmarkInfoStruct { tlvReader.enterStructure(tlvTag) val landmarkTag = tlvReader.getUByte(ContextSpecificTag(TAG_LANDMARK_TAG)) - val positionTag = + val relativePositionTag = if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_POSITION_TAG)) + tlvReader.getUByte(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG)) + tlvReader.getNull(ContextSpecificTag(TAG_RELATIVE_POSITION_TAG)) null } tlvReader.exitContainer() - return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, positionTag) + return ServiceAreaClusterLandmarkInfoStruct(landmarkTag, relativePositionTag) } } } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index db775e5d52e5c6..cacd15683ab39b 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -28647,48 +28647,48 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_mapIDCtorSignature.c_str(), jninewElement_0_mapID, newElement_0_mapID); } - jobject newElement_0_areaDesc; - jobject newElement_0_areaDesc_locationInfo; - if (entry_0.areaDesc.locationInfo.IsNull()) + jobject newElement_0_areaInfo; + jobject newElement_0_areaInfo_locationInfo; + if (entry_0.areaInfo.locationInfo.IsNull()) { - newElement_0_areaDesc_locationInfo = nullptr; + newElement_0_areaInfo_locationInfo = nullptr; } else { - jobject newElement_0_areaDesc_locationInfo_locationName; + jobject newElement_0_areaInfo_locationInfo_locationName; LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF( - entry_0.areaDesc.locationInfo.Value().locationName, newElement_0_areaDesc_locationInfo_locationName)); - jobject newElement_0_areaDesc_locationInfo_floorNumber; - if (entry_0.areaDesc.locationInfo.Value().floorNumber.IsNull()) + entry_0.areaInfo.locationInfo.Value().locationName, newElement_0_areaInfo_locationInfo_locationName)); + jobject newElement_0_areaInfo_locationInfo_floorNumber; + if (entry_0.areaInfo.locationInfo.Value().floorNumber.IsNull()) { - newElement_0_areaDesc_locationInfo_floorNumber = nullptr; + newElement_0_areaInfo_locationInfo_floorNumber = nullptr; } else { - std::string newElement_0_areaDesc_locationInfo_floorNumberClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_locationInfo_floorNumberCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_locationInfo_floorNumber = - static_cast(entry_0.areaDesc.locationInfo.Value().floorNumber.Value()); + std::string newElement_0_areaInfo_locationInfo_floorNumberClassName = "java/lang/Integer"; + std::string newElement_0_areaInfo_locationInfo_floorNumberCtorSignature = "(I)V"; + jint jninewElement_0_areaInfo_locationInfo_floorNumber = + static_cast(entry_0.areaInfo.locationInfo.Value().floorNumber.Value()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_locationInfo_floorNumberClassName.c_str(), - newElement_0_areaDesc_locationInfo_floorNumberCtorSignature.c_str(), - jninewElement_0_areaDesc_locationInfo_floorNumber, newElement_0_areaDesc_locationInfo_floorNumber); + newElement_0_areaInfo_locationInfo_floorNumberClassName.c_str(), + newElement_0_areaInfo_locationInfo_floorNumberCtorSignature.c_str(), + jninewElement_0_areaInfo_locationInfo_floorNumber, newElement_0_areaInfo_locationInfo_floorNumber); } - jobject newElement_0_areaDesc_locationInfo_areaType; - if (entry_0.areaDesc.locationInfo.Value().areaType.IsNull()) + jobject newElement_0_areaInfo_locationInfo_areaType; + if (entry_0.areaInfo.locationInfo.Value().areaType.IsNull()) { - newElement_0_areaDesc_locationInfo_areaType = nullptr; + newElement_0_areaInfo_locationInfo_areaType = nullptr; } else { - std::string newElement_0_areaDesc_locationInfo_areaTypeClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_locationInfo_areaTypeCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_locationInfo_areaType = - static_cast(entry_0.areaDesc.locationInfo.Value().areaType.Value()); + std::string newElement_0_areaInfo_locationInfo_areaTypeClassName = "java/lang/Integer"; + std::string newElement_0_areaInfo_locationInfo_areaTypeCtorSignature = "(I)V"; + jint jninewElement_0_areaInfo_locationInfo_areaType = + static_cast(entry_0.areaInfo.locationInfo.Value().areaType.Value()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_locationInfo_areaTypeClassName.c_str(), - newElement_0_areaDesc_locationInfo_areaTypeCtorSignature.c_str(), - jninewElement_0_areaDesc_locationInfo_areaType, newElement_0_areaDesc_locationInfo_areaType); + newElement_0_areaInfo_locationInfo_areaTypeClassName.c_str(), + newElement_0_areaInfo_locationInfo_areaTypeCtorSignature.c_str(), + jninewElement_0_areaInfo_locationInfo_areaType, newElement_0_areaInfo_locationInfo_areaType); } jclass locationDescriptorStructStructClass_4; @@ -28711,42 +28711,43 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0_areaDesc_locationInfo = + newElement_0_areaInfo_locationInfo = env->NewObject(locationDescriptorStructStructClass_4, locationDescriptorStructStructCtor_4, - newElement_0_areaDesc_locationInfo_locationName, - newElement_0_areaDesc_locationInfo_floorNumber, newElement_0_areaDesc_locationInfo_areaType); + newElement_0_areaInfo_locationInfo_locationName, + newElement_0_areaInfo_locationInfo_floorNumber, newElement_0_areaInfo_locationInfo_areaType); } - jobject newElement_0_areaDesc_landmarkInfo; - if (entry_0.areaDesc.landmarkInfo.IsNull()) + jobject newElement_0_areaInfo_landmarkInfo; + if (entry_0.areaInfo.landmarkInfo.IsNull()) { - newElement_0_areaDesc_landmarkInfo = nullptr; + newElement_0_areaInfo_landmarkInfo = nullptr; } else { - jobject newElement_0_areaDesc_landmarkInfo_landmarkTag; - std::string newElement_0_areaDesc_landmarkInfo_landmarkTagClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_landmarkInfo_landmarkTagCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_landmarkInfo_landmarkTag = - static_cast(entry_0.areaDesc.landmarkInfo.Value().landmarkTag); + jobject newElement_0_areaInfo_landmarkInfo_landmarkTag; + std::string newElement_0_areaInfo_landmarkInfo_landmarkTagClassName = "java/lang/Integer"; + std::string newElement_0_areaInfo_landmarkInfo_landmarkTagCtorSignature = "(I)V"; + jint jninewElement_0_areaInfo_landmarkInfo_landmarkTag = + static_cast(entry_0.areaInfo.landmarkInfo.Value().landmarkTag); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_landmarkInfo_landmarkTagClassName.c_str(), - newElement_0_areaDesc_landmarkInfo_landmarkTagCtorSignature.c_str(), - jninewElement_0_areaDesc_landmarkInfo_landmarkTag, newElement_0_areaDesc_landmarkInfo_landmarkTag); - jobject newElement_0_areaDesc_landmarkInfo_positionTag; - if (entry_0.areaDesc.landmarkInfo.Value().positionTag.IsNull()) + newElement_0_areaInfo_landmarkInfo_landmarkTagClassName.c_str(), + newElement_0_areaInfo_landmarkInfo_landmarkTagCtorSignature.c_str(), + jninewElement_0_areaInfo_landmarkInfo_landmarkTag, newElement_0_areaInfo_landmarkInfo_landmarkTag); + jobject newElement_0_areaInfo_landmarkInfo_relativePositionTag; + if (entry_0.areaInfo.landmarkInfo.Value().relativePositionTag.IsNull()) { - newElement_0_areaDesc_landmarkInfo_positionTag = nullptr; + newElement_0_areaInfo_landmarkInfo_relativePositionTag = nullptr; } else { - std::string newElement_0_areaDesc_landmarkInfo_positionTagClassName = "java/lang/Integer"; - std::string newElement_0_areaDesc_landmarkInfo_positionTagCtorSignature = "(I)V"; - jint jninewElement_0_areaDesc_landmarkInfo_positionTag = - static_cast(entry_0.areaDesc.landmarkInfo.Value().positionTag.Value()); + std::string newElement_0_areaInfo_landmarkInfo_relativePositionTagClassName = "java/lang/Integer"; + std::string newElement_0_areaInfo_landmarkInfo_relativePositionTagCtorSignature = "(I)V"; + jint jninewElement_0_areaInfo_landmarkInfo_relativePositionTag = + static_cast(entry_0.areaInfo.landmarkInfo.Value().relativePositionTag.Value()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_areaDesc_landmarkInfo_positionTagClassName.c_str(), - newElement_0_areaDesc_landmarkInfo_positionTagCtorSignature.c_str(), - jninewElement_0_areaDesc_landmarkInfo_positionTag, newElement_0_areaDesc_landmarkInfo_positionTag); + newElement_0_areaInfo_landmarkInfo_relativePositionTagClassName.c_str(), + newElement_0_areaInfo_landmarkInfo_relativePositionTagCtorSignature.c_str(), + jninewElement_0_areaInfo_landmarkInfo_relativePositionTag, + newElement_0_areaInfo_landmarkInfo_relativePositionTag); } jclass landmarkInfoStructStructClass_4; @@ -28769,9 +28770,9 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0_areaDesc_landmarkInfo = env->NewObject( + newElement_0_areaInfo_landmarkInfo = env->NewObject( landmarkInfoStructStructClass_4, landmarkInfoStructStructCtor_4, - newElement_0_areaDesc_landmarkInfo_landmarkTag, newElement_0_areaDesc_landmarkInfo_positionTag); + newElement_0_areaInfo_landmarkInfo_landmarkTag, newElement_0_areaInfo_landmarkInfo_relativePositionTag); } jclass areaInfoStructStructClass_2; @@ -28795,8 +28796,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0_areaDesc = env->NewObject(areaInfoStructStructClass_2, areaInfoStructStructCtor_2, - newElement_0_areaDesc_locationInfo, newElement_0_areaDesc_landmarkInfo); + newElement_0_areaInfo = env->NewObject(areaInfoStructStructClass_2, areaInfoStructStructCtor_2, + newElement_0_areaInfo_locationInfo, newElement_0_areaInfo_landmarkInfo); jclass areaStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -28819,7 +28820,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } newElement_0 = env->NewObject(areaStructStructClass_1, areaStructStructCtor_1, newElement_0_areaID, - newElement_0_mapID, newElement_0_areaDesc); + newElement_0_mapID, newElement_0_areaInfo); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 624f42c8e80088..391765f3838e7b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -31392,11 +31392,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="landmarkTag", Tag=0, Type=Globals.Enums.LandmarkTag), - ClusterObjectFieldDescriptor(Label="positionTag", Tag=1, Type=typing.Union[Nullable, Globals.Enums.RelativePositionTag]), + ClusterObjectFieldDescriptor(Label="relativePositionTag", Tag=1, Type=typing.Union[Nullable, Globals.Enums.RelativePositionTag]), ]) landmarkTag: 'Globals.Enums.LandmarkTag' = 0 - positionTag: 'typing.Union[Nullable, Globals.Enums.RelativePositionTag]' = NullValue + relativePositionTag: 'typing.Union[Nullable, Globals.Enums.RelativePositionTag]' = NullValue @dataclass class AreaInfoStruct(ClusterObject): @@ -31419,12 +31419,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="areaID", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="mapID", Tag=1, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="areaDesc", Tag=2, Type=ServiceArea.Structs.AreaInfoStruct), + ClusterObjectFieldDescriptor(Label="areaInfo", Tag=2, Type=ServiceArea.Structs.AreaInfoStruct), ]) areaID: 'uint' = 0 mapID: 'typing.Union[Nullable, uint]' = NullValue - areaDesc: 'ServiceArea.Structs.AreaInfoStruct' = field(default_factory=lambda: ServiceArea.Structs.AreaInfoStruct()) + areaInfo: 'ServiceArea.Structs.AreaInfoStruct' = field(default_factory=lambda: ServiceArea.Structs.AreaInfoStruct()) @dataclass class MapStruct(ClusterObject): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 472a630d93df68..4b0e0bb96389b3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -11197,37 +11197,37 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri } else { newElement_0.mapID = [NSNumber numberWithUnsignedInt:entry_0.mapID.Value()]; } - newElement_0.areaDesc = [MTRServiceAreaClusterAreaInfoStruct new]; - if (entry_0.areaDesc.locationInfo.IsNull()) { - newElement_0.areaDesc.locationInfo = nil; + newElement_0.areaInfo = [MTRServiceAreaClusterAreaInfoStruct new]; + if (entry_0.areaInfo.locationInfo.IsNull()) { + newElement_0.areaInfo.locationInfo = nil; } else { - newElement_0.areaDesc.locationInfo = [MTRDataTypeLocationDescriptorStruct new]; - newElement_0.areaDesc.locationInfo.locationName = AsString(entry_0.areaDesc.locationInfo.Value().locationName); - if (newElement_0.areaDesc.locationInfo.locationName == nil) { + newElement_0.areaInfo.locationInfo = [MTRDataTypeLocationDescriptorStruct new]; + newElement_0.areaInfo.locationInfo.locationName = AsString(entry_0.areaInfo.locationInfo.Value().locationName); + if (newElement_0.areaInfo.locationInfo.locationName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (entry_0.areaDesc.locationInfo.Value().floorNumber.IsNull()) { - newElement_0.areaDesc.locationInfo.floorNumber = nil; + if (entry_0.areaInfo.locationInfo.Value().floorNumber.IsNull()) { + newElement_0.areaInfo.locationInfo.floorNumber = nil; } else { - newElement_0.areaDesc.locationInfo.floorNumber = [NSNumber numberWithShort:entry_0.areaDesc.locationInfo.Value().floorNumber.Value()]; + newElement_0.areaInfo.locationInfo.floorNumber = [NSNumber numberWithShort:entry_0.areaInfo.locationInfo.Value().floorNumber.Value()]; } - if (entry_0.areaDesc.locationInfo.Value().areaType.IsNull()) { - newElement_0.areaDesc.locationInfo.areaType = nil; + if (entry_0.areaInfo.locationInfo.Value().areaType.IsNull()) { + newElement_0.areaInfo.locationInfo.areaType = nil; } else { - newElement_0.areaDesc.locationInfo.areaType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.locationInfo.Value().areaType.Value())]; + newElement_0.areaInfo.locationInfo.areaType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaInfo.locationInfo.Value().areaType.Value())]; } } - if (entry_0.areaDesc.landmarkInfo.IsNull()) { - newElement_0.areaDesc.landmarkInfo = nil; + if (entry_0.areaInfo.landmarkInfo.IsNull()) { + newElement_0.areaInfo.landmarkInfo = nil; } else { - newElement_0.areaDesc.landmarkInfo = [MTRServiceAreaClusterLandmarkInfoStruct new]; - newElement_0.areaDesc.landmarkInfo.landmarkTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.landmarkInfo.Value().landmarkTag)]; - if (entry_0.areaDesc.landmarkInfo.Value().positionTag.IsNull()) { - newElement_0.areaDesc.landmarkInfo.positionTag = nil; + newElement_0.areaInfo.landmarkInfo = [MTRServiceAreaClusterLandmarkInfoStruct new]; + newElement_0.areaInfo.landmarkInfo.landmarkTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaInfo.landmarkInfo.Value().landmarkTag)]; + if (entry_0.areaInfo.landmarkInfo.Value().relativePositionTag.IsNull()) { + newElement_0.areaInfo.landmarkInfo.relativePositionTag = nil; } else { - newElement_0.areaDesc.landmarkInfo.positionTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaDesc.landmarkInfo.Value().positionTag.Value())]; + newElement_0.areaInfo.landmarkInfo.relativePositionTag = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.areaInfo.landmarkInfo.Value().relativePositionTag.Value())]; } } [array_0 addObject:newElement_0]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 35df5cc3e32495..fac8e1bdf7afe8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1615,7 +1615,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterLandmarkInfoStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull landmarkTag MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable positionTag MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable relativePositionTag MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -1628,7 +1628,7 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterAreaStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull areaID MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable mapID MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) MTRServiceAreaClusterAreaInfoStruct * _Nonnull areaDesc MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRServiceAreaClusterAreaInfoStruct * _Nonnull areaInfo MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 6c3fc19e9b68bf..f24ca05abfb4eb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6739,7 +6739,7 @@ - (instancetype)init _landmarkTag = @(0); - _positionTag = nil; + _relativePositionTag = nil; } return self; } @@ -6749,14 +6749,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone auto other = [[MTRServiceAreaClusterLandmarkInfoStruct alloc] init]; other.landmarkTag = self.landmarkTag; - other.positionTag = self.positionTag; + other.relativePositionTag = self.relativePositionTag; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: landmarkTag:%@; positionTag:%@; >", NSStringFromClass([self class]), _landmarkTag, _positionTag]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: landmarkTag:%@; relativePositionTag:%@; >", NSStringFromClass([self class]), _landmarkTag, _relativePositionTag]; return descriptionString; } @@ -6801,7 +6801,7 @@ - (instancetype)init _mapID = nil; - _areaDesc = [MTRServiceAreaClusterAreaInfoStruct new]; + _areaInfo = [MTRServiceAreaClusterAreaInfoStruct new]; } return self; } @@ -6812,14 +6812,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.areaID = self.areaID; other.mapID = self.mapID; - other.areaDesc = self.areaDesc; + other.areaInfo = self.areaInfo; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: areaID:%@; mapID:%@; areaDesc:%@; >", NSStringFromClass([self class]), _areaID, _mapID, _areaDesc]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: areaID:%@; mapID:%@; areaInfo:%@; >", NSStringFromClass([self class]), _areaID, _mapID, _areaInfo]; return descriptionString; } diff --git a/src/python_testing/TC_SEAR_1_2.py b/src/python_testing/TC_SEAR_1_2.py index 083533277a5e6d..c21e831464557e 100644 --- a/src/python_testing/TC_SEAR_1_2.py +++ b/src/python_testing/TC_SEAR_1_2.py @@ -80,7 +80,7 @@ async def read_and_validate_supported_areas(self, step): asserts.assert_less_equal(len(supported_areas), 255, "SupportedAreas should have max 255 entries") areaid_list = [] - areadesc_s = set() + areainfo_s = set() for a in supported_areas: asserts.assert_true(a.areaID not in areaid_list, "SupportedAreas must have unique AreaID values!") @@ -91,27 +91,27 @@ async def read_and_validate_supported_areas(self, step): f"SupportedAreas entry with AreaID({a.areaID}) should not have null MapID") asserts.assert_true(a.mapID in self.mapid_list, f"SupportedAreas entry with AreaID({a.areaID}) has unknown MapID({a.mapID})") - k = f"mapID:{a.mapID} areaDesc:{a.areaDesc}" - asserts.assert_true(k not in areadesc_s, - f"SupportedAreas must have unique MapID({a.mapID}) + AreaDesc({a.areaDesc}) values!") - areadesc_s.add(k) + k = f"mapID:{a.mapID} areaInfo:{a.areaInfo}" + asserts.assert_true(k not in areainfo_s, + f"SupportedAreas must have unique MapID({a.mapID}) + AreaInfo({a.areaInfo}) values!") + areainfo_s.add(k) else: # empty SupportedMaps asserts.assert_is(a.mapID, NullValue, f"SupportedAreas entry with AreaID({a.areaID}) should have null MapID") - k = f"areaDesc:{a.areaDesc}" - asserts.assert_true(k not in areadesc_s, f"SupportedAreas must have unique AreaDesc({a.areaDesc}) values!") - areadesc_s.add(k) + k = f"areaInfo:{a.areaInfo}" + asserts.assert_true(k not in areainfo_s, f"SupportedAreas must have unique AreaInfo({a.areaInfo}) values!") + areainfo_s.add(k) - if a.areaDesc.locationInfo is NullValue and a.areaDesc.landmarkInfo is NullValue: + if a.areaInfo.locationInfo is NullValue and a.areaInfo.landmarkInfo is NullValue: asserts.assert_true( f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkInfo") - if a.areaDesc.landmarkInfo is not NullValue: - asserts.assert_true(a.areaDesc.landmarkInfo.landmarkTag <= self.MAX_LANDMARK_ID, - f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.areaDesc.landmarkInfo.landmarkTag})") - asserts.assert_true(a.areaDesc.landmarkInfo.positionTag is NullValue or a - .areaDesc.landmarkInfo.positionTag in range(0, self.MAX_RELPOS_ID), - f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.areaDesc.landmarkInfo.positionTag})") + if a.areaInfo.landmarkInfo is not NullValue: + asserts.assert_true(a.areaInfo.landmarkInfo.landmarkTag <= self.MAX_LANDMARK_ID, + f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.areaInfo.landmarkInfo.landmarkTag})") + asserts.assert_true(a.areaInfo.landmarkInfo.relativePositionTag is NullValue or a + .areaInfo.landmarkInfo.relativePositionTag in range(0, self.MAX_RELPOS_ID), + f"SupportedAreas entry with AreaID({a.areaID}) has invalid RelativePositionTag({a.areaInfo.landmarkInfo.relativePositionTag})") # save so other methods can use this if needed self.areaid_list = areaid_list 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 20fdd126514076..c2a25ed9477c2e 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 @@ -20457,7 +20457,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kLandmarkTag), landmarkTag); - encoder.Encode(to_underlying(Fields::kPositionTag), positionTag); + encoder.Encode(to_underlying(Fields::kRelativePositionTag), relativePositionTag); return encoder.Finalize(); } @@ -20479,9 +20479,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, landmarkTag); } - else if (__context_tag == to_underlying(Fields::kPositionTag)) + else if (__context_tag == to_underlying(Fields::kRelativePositionTag)) { - err = DataModel::Decode(reader, positionTag); + err = DataModel::Decode(reader, relativePositionTag); } else { @@ -20540,7 +20540,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kAreaID), areaID); encoder.Encode(to_underlying(Fields::kMapID), mapID); - encoder.Encode(to_underlying(Fields::kAreaDesc), areaDesc); + encoder.Encode(to_underlying(Fields::kAreaInfo), areaInfo); return encoder.Finalize(); } @@ -20566,9 +20566,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, mapID); } - else if (__context_tag == to_underlying(Fields::kAreaDesc)) + else if (__context_tag == to_underlying(Fields::kAreaInfo)) { - err = DataModel::Decode(reader, areaDesc); + err = DataModel::Decode(reader, areaInfo); } else { 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 c2c1697ce271f3..fc62ada8bd3fcb 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 @@ -28428,15 +28428,15 @@ namespace Structs { namespace LandmarkInfoStruct { enum class Fields : uint8_t { - kLandmarkTag = 0, - kPositionTag = 1, + kLandmarkTag = 0, + kRelativePositionTag = 1, }; struct Type { public: Globals::LandmarkTag landmarkTag = static_cast(0); - DataModel::Nullable positionTag; + DataModel::Nullable relativePositionTag; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -28476,7 +28476,7 @@ enum class Fields : uint8_t { kAreaID = 0, kMapID = 1, - kAreaDesc = 2, + kAreaInfo = 2, }; struct Type @@ -28484,7 +28484,7 @@ struct Type public: uint32_t areaID = static_cast(0); DataModel::Nullable mapID; - Structs::AreaInfoStruct::Type areaDesc; + Structs::AreaInfoStruct::Type areaInfo; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 202a6efcb06a01..9a1062c23b40a0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -4052,17 +4052,17 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("LandmarkInfoStruct.landmarkTag", "landmarkTag", value.isMember("landmarkTag"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("LandmarkInfoStruct.positionTag", "positionTag", value.isMember("positionTag"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LandmarkInfoStruct.relativePositionTag", "relativePositionTag", + value.isMember("relativePositionTag"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "landmarkTag"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.landmarkTag, value["landmarkTag"])); valueCopy.removeMember("landmarkTag"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "positionTag"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.positionTag, value["positionTag"])); - valueCopy.removeMember("positionTag"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "relativePositionTag"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.relativePositionTag, value["relativePositionTag"])); + valueCopy.removeMember("relativePositionTag"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -4070,7 +4070,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::ServiceArea::Structs::LandmarkInfoStruct::Type & request) { ComplexArgumentParser::Finalize(request.landmarkTag); - ComplexArgumentParser::Finalize(request.positionTag); + ComplexArgumentParser::Finalize(request.relativePositionTag); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, @@ -4115,7 +4115,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AreaStruct.areaID", "areaID", value.isMember("areaID"))); ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AreaStruct.mapID", "mapID", value.isMember("mapID"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AreaStruct.areaDesc", "areaDesc", value.isMember("areaDesc"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AreaStruct.areaInfo", "areaInfo", value.isMember("areaInfo"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "areaID"); @@ -4126,9 +4126,9 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.mapID, value["mapID"])); valueCopy.removeMember("mapID"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "areaDesc"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.areaDesc, value["areaDesc"])); - valueCopy.removeMember("areaDesc"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "areaInfo"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.areaInfo, value["areaInfo"])); + valueCopy.removeMember("areaInfo"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -4137,7 +4137,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ServiceArea::Structs:: { ComplexArgumentParser::Finalize(request.areaID); ComplexArgumentParser::Finalize(request.mapID); - ComplexArgumentParser::Finalize(request.areaDesc); + ComplexArgumentParser::Finalize(request.areaInfo); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::MapStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 3d40f3897e852b..16248a7ca4e157 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3586,10 +3586,10 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("PositionTag", indent + 1, value.positionTag); + CHIP_ERROR err = LogValue("RelativePositionTag", indent + 1, value.relativePositionTag); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PositionTag'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RelativePositionTag'"); return err; } } @@ -3644,10 +3644,10 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("AreaDesc", indent + 1, value.areaDesc); + CHIP_ERROR err = LogValue("AreaInfo", indent + 1, value.areaInfo); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AreaDesc'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AreaInfo'"); return err; } } From bbd21f496615539fdea1f4fb9c11fef32cb2f74a Mon Sep 17 00:00:00 2001 From: mthiesc Date: Fri, 23 Aug 2024 00:59:53 +0200 Subject: [PATCH 33/53] AccountLogin Login/Logout command support (#34162) * AccountLogin Login/Logout command support [Problem] * ContentAppPlatform should send AccountLogin::Login command after successfull commissioning if user was shown setupPIN prompt. * Handling Login/Logout commands is currently not implemented in the Android. [Solution] * Call AccountLoginManager::HandleLogin if commissioning succeeded successfully with setupPIN prompt flow. * Implement HandleLogin (and HandleLogout) for Android AccountLoginManager using the ContentAppCommandDelegate. [Testing] WIP * HandleLogin in ContentAppPlatform::ManageClientAccess * Cache rotating ID in OnUserDirectedCommissioningRequest * Restyled by google-java-format * Restyled by clang-format * Update content app * Restyled by whitespace * Restyled by clang-format * Update response * Update method name * Restyled by google-java-format * Update src/app/app-platform/ContentApp.h Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com> * Update content app platform validation * Update validation logic * Update logic * Update responses * Restyled by clang-format * Simplify logic * Restyled by whitespace * clean up * Update code * Update content app with dynamic pin code * Restyled by google-java-format * Remove getRotatingIdSpan class methods * Restyled by clang-format --------- Co-authored-by: Restyled.io Co-authored-by: Lazar Kovacic Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com> --- .../contentapp/CommandResponseHolder.java | 10 +++ .../receiver/MatterCommandReceiver.java | 17 ++++ .../account-login/AccountLoginManager.cpp | 87 ++++++++++++++++--- examples/tv-app/android/java/AppImpl.cpp | 2 +- .../java/ContentAppCommandDelegate.cpp | 66 +++++++++----- .../android/java/ContentAppCommandDelegate.h | 2 + examples/tv-app/android/java/TVApp-JNI.cpp | 35 +++++--- examples/tv-app/tv-common/src/AppTv.cpp | 37 +++++--- src/app/app-platform/ContentApp.cpp | 13 ++- src/app/app-platform/ContentApp.h | 3 +- src/app/app-platform/ContentAppPlatform.cpp | 26 +++++- src/app/app-platform/ContentAppPlatform.h | 6 +- .../CommissionerDiscoveryController.cpp | 11 ++- .../CommissionerDiscoveryController.h | 7 +- 14 files changed, 254 insertions(+), 68 deletions(-) diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java index 61ee303b408587..fa49afc312d383 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/CommandResponseHolder.java @@ -31,6 +31,16 @@ private CommandResponseHolder() { Clusters.AccountLogin.Id, Clusters.AccountLogin.Commands.GetSetupPIN.ID, "{\"0\":\"20202021\"}"); + setResponseValue( + Clusters.AccountLogin.Id, + Clusters.AccountLogin.Commands.Login.ID, + // 0 is for success, you can return 1 for failure + "{\"Status\":0}"); + setResponseValue( + Clusters.AccountLogin.Id, + Clusters.AccountLogin.Commands.Logout.ID, + // 0 is for success, you can return 1 for failure + "{\"Status\":0}"); }; public static CommandResponseHolder getInstance() { diff --git a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java index 6a4eb77cb4be3b..7134691392e6aa 100644 --- a/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java +++ b/examples/tv-app/android/App/content-app/src/main/java/com/example/contentapp/receiver/MatterCommandReceiver.java @@ -4,11 +4,13 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.provider.Settings; import android.util.Log; import com.example.contentapp.AttributeHolder; import com.example.contentapp.CommandResponseHolder; import com.example.contentapp.MainActivity; import com.example.contentapp.matter.MatterAgentClient; +import com.matter.tv.app.api.Clusters; import com.matter.tv.app.api.MatterIntentConstants; public class MatterCommandReceiver extends BroadcastReceiver { @@ -44,6 +46,21 @@ public void onReceive(Context context, Intent intent) { .append(command) .toString(); Log.d(TAG, message); + + int pinCode = + Settings.Secure.getInt(context.getContentResolver(), "matter_pin_code", 20202021); + Log.d(TAG, "Retrieved pin code:" + pinCode); + + CommandResponseHolder.getInstance() + .setResponseValue( + Clusters.AccountLogin.Id, + Clusters.AccountLogin.Commands.GetSetupPIN.ID, + "{\"" + + Clusters.AccountLogin.Commands.GetSetupPINResponse.Fields.SetupPIN + + "\":\"" + + pinCode + + "\"}"); + String response = CommandResponseHolder.getInstance().getCommandResponse(clusterId, commandId); diff --git a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp index 12e6ba44dfb220..2aa0b313b0eda1 100644 --- a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp +++ b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp @@ -24,38 +24,105 @@ #include using namespace std; +using namespace chip::app::Clusters; using namespace chip::app::Clusters::AccountLogin; using Status = chip::Protocols::InteractionModel::Status; +namespace { + +const auto loginTempAccountIdentifierFieldId = + to_string(chip::to_underlying(AccountLogin::Commands::Login::Fields::kTempAccountIdentifier)); +const auto loginSetupPINFieldId = to_string(chip::to_underlying(AccountLogin::Commands::Login::Fields::kSetupPIN)); +const auto loginNodeFieldId = to_string(chip::to_underlying(AccountLogin::Commands::Login::Fields::kNode)); +const auto logoutNodeFieldId = to_string(chip::to_underlying(AccountLogin::Commands::Logout::Fields::kNode)); + +string charSpanToString(const CharSpan & charSpan) +{ + return { charSpan.data(), charSpan.size() }; +} + +std::string serializeLoginCommand(AccountLogin::Commands::Login::Type cmd) +{ + return R"({")" + loginTempAccountIdentifierFieldId + R"(":")" + charSpanToString(cmd.tempAccountIdentifier) + R"(",)" + R"(")" + + loginSetupPINFieldId + R"(":")" + charSpanToString(cmd.setupPIN) + R"(",)" + R"(")" + loginNodeFieldId + R"(":")" + + to_string(cmd.node.Value()) + R"("})"; +} + +std::string serializeLogoutCommand(AccountLogin::Commands::Logout::Type cmd) +{ + return R"({")" + logoutNodeFieldId + R"(":")" + to_string(cmd.node.Value()) + R"("})"; +} + +} // namespace + AccountLoginManager::AccountLoginManager(ContentAppCommandDelegate * commandDelegate, const char * setupPin) : mCommandDelegate(commandDelegate) { CopyString(mSetupPin, sizeof(mSetupPin), setupPin); } -bool AccountLoginManager::HandleLogin(const CharSpan & tempAccountIdentifier, const CharSpan & setupPin, +bool AccountLoginManager::HandleLogin(const CharSpan & tempAccountIdentifier, const CharSpan & setupPIN, const chip::Optional & nodeId) { ChipLogProgress(DeviceLayer, "AccountLoginManager::HandleLogin called for endpoint %d", mEndpointId); - string tempAccountIdentifierString(tempAccountIdentifier.data(), tempAccountIdentifier.size()); - string setupPinString(setupPin.data(), setupPin.size()); - if (strcmp(mSetupPin, setupPinString.c_str()) == 0) + if (mCommandDelegate == nullptr) { - ChipLogProgress(Zcl, "AccountLoginManager::HandleLogin success"); - return true; + ChipLogError(Zcl, "CommandDelegate not found"); + return false; } - else + + if (tempAccountIdentifier.empty() || setupPIN.empty() || !nodeId.HasValue()) { - ChipLogProgress(Zcl, "AccountLoginManager::HandleLogin failed expected pin %s", mSetupPin); + ChipLogError(Zcl, "Invalid parameters"); return false; } + + Json::Value response; + bool commandHandled = true; + AccountLogin::Commands::Login::Type cmd = { tempAccountIdentifier, setupPIN, nodeId }; + + auto status = mCommandDelegate->InvokeCommand(mEndpointId, AccountLogin::Id, AccountLogin::Commands::Login::Id, + serializeLoginCommand(cmd), commandHandled, response); + if (status == Status::Success) + { + // Format status response to verify that response is non-failure. + status = mCommandDelegate->FormatStatusResponse(response); + } + ChipLogProgress(Zcl, "AccountLoginManager::HandleLogin command returned with status: %d", chip::to_underlying(status)); + return status == chip::Protocols::InteractionModel::Status::Success; } bool AccountLoginManager::HandleLogout(const chip::Optional & nodeId) { - // TODO: Insert your code here to send logout request - return true; + ChipLogProgress(DeviceLayer, "AccountLoginManager::HandleLogout called for endpoint %d", mEndpointId); + + if (mCommandDelegate == nullptr) + { + ChipLogError(Zcl, "CommandDelegate not found"); + return false; + } + + if (!nodeId.HasValue()) + { + ChipLogError(Zcl, "Invalid parameters"); + return false; + } + + Json::Value response; + bool commandHandled = true; + AccountLogin::Commands::Logout::Type cmd = { nodeId }; + + auto status = mCommandDelegate->InvokeCommand(mEndpointId, AccountLogin::Id, AccountLogin::Commands::Logout::Id, + serializeLogoutCommand(cmd), commandHandled, response); + + if (status == Status::Success) + { + // Format status response to verify that response is non-failure. + status = mCommandDelegate->FormatStatusResponse(response); + } + ChipLogProgress(Zcl, "AccountLoginManager::HandleLogout command returned with status: %d", chip::to_underlying(status)); + return status == chip::Protocols::InteractionModel::Status::Success; } void AccountLoginManager::HandleGetSetupPin(CommandResponseHelper & helper, diff --git a/examples/tv-app/android/java/AppImpl.cpp b/examples/tv-app/android/java/AppImpl.cpp index d7da8ab6661a46..d33949a5d382d9 100644 --- a/examples/tv-app/android/java/AppImpl.cpp +++ b/examples/tv-app/android/java/AppImpl.cpp @@ -417,7 +417,7 @@ void refreshConnectedClientsAcl(uint16_t vendorId, uint16_t productId, ContentAp for (const auto & allowedVendor : app->GetApplicationBasicDelegate()->GetAllowedVendorList()) { - std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowVendorId(allowedVendor); + std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowedVendorId(allowedVendor); nodeIds.insert(tempNodeIds.begin(), tempNodeIds.end()); } diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp index 02b4a7e806fefb..caf2d665b8522e 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.cpp +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.cpp @@ -39,15 +39,9 @@ namespace chip { namespace AppPlatform { -using CommandHandlerInterface = chip::app::CommandHandlerInterface; -using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Type; -using PlaybackResponseType = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Type; -using NavigateTargetResponseType = chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Type; -using GetSetupPINResponseType = chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Type; -using Status = chip::Protocols::InteractionModel::Status; - -const std::string FAILURE_KEY = "PlatformError"; -const std::string FAILURE_STATUS_KEY = "Status"; +const std::string FAILURE_KEY = "PlatformError"; +const std::string FAILURE_STATUS_KEY = "Status"; +const std::string RESPONSE_STATUS_KEY = "Status"; bool isValidJson(const char * response) { @@ -166,6 +160,7 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust ChipLogError(Zcl, "Java exception in ContentAppCommandDelegate::sendCommand"); env->ExceptionDescribe(); env->ExceptionClear(); + return chip::Protocols::InteractionModel::Status::Failure; } else { @@ -198,7 +193,8 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust } env->DeleteLocalRef(resp); - // handle errors from platform-app + // Parse response here in case there is failure response. + // Return non-success error code to indicate to caller it should not parse response. if (!value[FAILURE_KEY].empty()) { value = value[FAILURE_KEY]; @@ -209,7 +205,9 @@ Status ContentAppCommandDelegate::InvokeCommand(EndpointId epId, ClusterId clust return chip::Protocols::InteractionModel::Status::Failure; } - return chip::Protocols::InteractionModel::Status::UnsupportedEndpoint; + // Return success to indicate command has been sent, response returned and parsed successfully. + // Caller has to manually parse value input/output parameter to get response status/object. + return chip::Protocols::InteractionModel::Status::Success; } else { @@ -282,20 +280,31 @@ void ContentAppCommandDelegate::FormatResponseData(CommandHandlerInterface::Hand } case app::Clusters::AccountLogin::Id: { - if (app::Clusters::AccountLogin::Commands::GetSetupPIN::Id != handlerContext.mRequestPath.mCommandId) + switch (handlerContext.mRequestPath.mCommandId) { - // No response for other commands in this cluster + case app::Clusters::AccountLogin::Commands::GetSetupPIN::Id: { + Status status; + GetSetupPINResponseType getSetupPINresponse = FormatGetSetupPINResponse(value, status); + if (status != chip::Protocols::InteractionModel::Status::Success) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); + } + else + { + handlerContext.mCommandHandler.AddResponse(handlerContext.mRequestPath, getSetupPINresponse); + } break; } - Status status; - GetSetupPINResponseType getSetupPINresponse = FormatGetSetupPINResponse(value, status); - if (status != chip::Protocols::InteractionModel::Status::Success) - { - handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, status); + case app::Clusters::AccountLogin::Commands::Login::Id: { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, FormatStatusResponse(value)); + break; } - else - { - handlerContext.mCommandHandler.AddResponse(handlerContext.mRequestPath, getSetupPINresponse); + case app::Clusters::AccountLogin::Commands::Logout::Id: { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, FormatStatusResponse(value)); + break; + } + default: + break; } break; } @@ -388,10 +397,23 @@ GetSetupPINResponseType ContentAppCommandDelegate::FormatGetSetupPINResponse(Jso } else { - getSetupPINresponse.setupPIN = ""; + status = chip::Protocols::InteractionModel::Status::Failure; } return getSetupPINresponse; } +Status ContentAppCommandDelegate::FormatStatusResponse(Json::Value value) +{ + // check if JSON has "Status" key + if (!value[RESPONSE_STATUS_KEY].empty() && !value[RESPONSE_STATUS_KEY].isUInt()) + { + return static_cast(value.asUInt()); + } + else + { + return chip::Protocols::InteractionModel::Status::Failure; + } +} + } // namespace AppPlatform } // namespace chip diff --git a/examples/tv-app/android/java/ContentAppCommandDelegate.h b/examples/tv-app/android/java/ContentAppCommandDelegate.h index f033b1afa79189..49d3e6fda87610 100644 --- a/examples/tv-app/android/java/ContentAppCommandDelegate.h +++ b/examples/tv-app/android/java/ContentAppCommandDelegate.h @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -75,6 +76,7 @@ class ContentAppCommandDelegate : public CommandHandlerInterface LaunchResponseType FormatContentLauncherResponse(Json::Value value, Status & status); NavigateTargetResponseType FormatNavigateTargetResponse(Json::Value value, Status & status); PlaybackResponseType FormatMediaPlaybackResponse(Json::Value value, Status & status); + Status FormatStatusResponse(Json::Value value); private: void InitializeJNIObjects(jobject manager) diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 0fe1bdef939ca8..228cab60e03748 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -258,15 +258,15 @@ SampleTvAppInstallationService gSampleTvAppInstallationService; class MyPostCommissioningListener : public PostCommissioningListener { - void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - const SessionHandle & sessionHandle) override + void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, CharSpan rotatingId, uint32_t passcode, + Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) override { // read current binding list chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); ContentAppPlatform::GetInstance().StoreNodeIdForContentApp(vendorId, productId, nodeId); - cacheContext(vendorId, productId, nodeId, exchangeMgr, sessionHandle); + cacheContext(vendorId, productId, nodeId, rotatingId, passcode, exchangeMgr, sessionHandle); CHIP_ERROR err = cluster.ReadAttribute(this, OnReadSuccessResponse, OnReadFailureResponse); @@ -350,17 +350,23 @@ class MyPostCommissioningListener : public PostCommissioningListener Optional opt = mSecureSession.Get(); SessionHandle & sessionHandle = opt.Value(); + auto rotatingIdSpan = CharSpan{ mRotatingId.data(), mRotatingId.size() }; ContentAppPlatform::GetInstance().ManageClientAccess(*mExchangeMgr, sessionHandle, mVendorId, mProductId, localNodeId, - bindings, OnSuccessResponse, OnFailureResponse); + rotatingIdSpan, mPasscode, bindings, OnSuccessResponse, + OnFailureResponse); clearContext(); } - void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - const SessionHandle & sessionHandle) + void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, CharSpan rotatingId, uint32_t passcode, + Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { - mVendorId = vendorId; - mProductId = productId; - mNodeId = nodeId; + mVendorId = vendorId; + mProductId = productId; + mNodeId = nodeId; + mRotatingId = std::string{ + rotatingId.data(), rotatingId.size() + }; // Allocates and copies to string instead of storing span to make sure lifetime is valid. + mPasscode = passcode; mExchangeMgr = &exchangeMgr; mSecureSession.ShiftToSession(sessionHandle); } @@ -370,12 +376,17 @@ class MyPostCommissioningListener : public PostCommissioningListener mVendorId = 0; mProductId = 0; mNodeId = 0; + mRotatingId = {}; + mPasscode = 0; mExchangeMgr = nullptr; mSecureSession.SessionReleased(); } - uint16_t mVendorId = 0; - uint16_t mProductId = 0; - NodeId mNodeId = 0; + + uint16_t mVendorId = 0; + uint16_t mProductId = 0; + NodeId mNodeId = 0; + std::string mRotatingId; + uint32_t mPasscode = 0; Messaging::ExchangeManager * mExchangeMgr = nullptr; SessionHolder mSecureSession; }; diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 8d81d9cf6c2c5c..794c879b4c4da1 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -158,15 +158,15 @@ MyAppInstallationService gMyAppInstallationService; class MyPostCommissioningListener : public PostCommissioningListener { - void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - const SessionHandle & sessionHandle) override + void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, CharSpan rotatingId, uint32_t passcode, + Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) override { // read current binding list chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); ContentAppPlatform::GetInstance().StoreNodeIdForContentApp(vendorId, productId, nodeId); - cacheContext(vendorId, productId, nodeId, exchangeMgr, sessionHandle); + cacheContext(vendorId, productId, nodeId, rotatingId, passcode, exchangeMgr, sessionHandle); CHIP_ERROR err = cluster.ReadAttribute(this, OnReadSuccessResponse, OnReadFailureResponse); @@ -250,17 +250,23 @@ class MyPostCommissioningListener : public PostCommissioningListener Optional opt = mSecureSession.Get(); SessionHandle & sessionHandle = opt.Value(); + auto rotatingIdSpan = CharSpan{ mRotatingId.data(), mRotatingId.size() }; ContentAppPlatform::GetInstance().ManageClientAccess(*mExchangeMgr, sessionHandle, mVendorId, mProductId, localNodeId, - bindings, OnSuccessResponse, OnFailureResponse); + rotatingIdSpan, mPasscode, bindings, OnSuccessResponse, + OnFailureResponse); clearContext(); } - void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, Messaging::ExchangeManager & exchangeMgr, - const SessionHandle & sessionHandle) + void cacheContext(uint16_t vendorId, uint16_t productId, NodeId nodeId, CharSpan rotatingId, uint32_t passcode, + Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { - mVendorId = vendorId; - mProductId = productId; - mNodeId = nodeId; + mVendorId = vendorId; + mProductId = productId; + mNodeId = nodeId; + mRotatingId = std::string{ + rotatingId.data(), rotatingId.size() + }; // Allocates and copies to string instead of storing span to make sure lifetime is valid. + mPasscode = passcode; mExchangeMgr = &exchangeMgr; mSecureSession.ShiftToSession(sessionHandle); } @@ -270,12 +276,17 @@ class MyPostCommissioningListener : public PostCommissioningListener mVendorId = 0; mProductId = 0; mNodeId = 0; + mRotatingId = {}; + mPasscode = 0; mExchangeMgr = nullptr; mSecureSession.SessionReleased(); } - uint16_t mVendorId = 0; - uint16_t mProductId = 0; - NodeId mNodeId = 0; + + uint16_t mVendorId = 0; + uint16_t mProductId = 0; + NodeId mNodeId = 0; + std::string mRotatingId; + uint32_t mPasscode = 0; Messaging::ExchangeManager * mExchangeMgr = nullptr; SessionHolder mSecureSession; }; @@ -684,7 +695,7 @@ void ContentAppFactoryImpl::InstallContentApp(uint16_t vendorId, uint16_t produc // update the list of node ids with content apps allowed vendor list for (const auto & allowedVendor : app->GetApplicationBasicDelegate()->GetAllowedVendorList()) { - std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowVendorId(allowedVendor); + std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowedVendorId(allowedVendor); nodeIds.insert(tempNodeIds.begin(), tempNodeIds.end()); } diff --git a/src/app/app-platform/ContentApp.cpp b/src/app/app-platform/ContentApp.cpp index a70965c5f2cd5e..4d9268e586dc2c 100644 --- a/src/app/app-platform/ContentApp.cpp +++ b/src/app/app-platform/ContentApp.cpp @@ -64,8 +64,17 @@ Status ContentApp::HandleWriteAttribute(ClusterId clusterId, AttributeId attribu return Status::Failure; } -void ContentApp::AddClientNode(NodeId subjectNodeId) +bool ContentApp::AddClientNode(NodeId subjectNodeId) { + for (int i = 0; i < kMaxClientNodes; ++i) + { + if (mClientNodes[i] == subjectNodeId) + { + // avoid storing duplicate nodes + return false; + } + } + mClientNodes[mNextClientNodeIndex++] = subjectNodeId; if (mClientNodeCount < kMaxClientNodes) { @@ -76,6 +85,8 @@ void ContentApp::AddClientNode(NodeId subjectNodeId) // if we exceed the max number, then overwrite the oldest entry mNextClientNodeIndex = 0; } + + return true; } void ContentApp::SendAppObserverCommand(chip::Controller::DeviceCommissioner * commissioner, NodeId clientNodeId, char * data, diff --git a/src/app/app-platform/ContentApp.h b/src/app/app-platform/ContentApp.h index 79c59e45dfd5bf..ee272c314d01f0 100644 --- a/src/app/app-platform/ContentApp.h +++ b/src/app/app-platform/ContentApp.h @@ -135,7 +135,8 @@ class DLL_EXPORT ContentApp uint16_t maxReadLength); Protocols::InteractionModel::Status HandleWriteAttribute(ClusterId clusterId, AttributeId attributeId, uint8_t * buffer); - void AddClientNode(NodeId clientNodeId); + // returns true only if new node is added. If node was added previously, then false is returned. + bool AddClientNode(NodeId clientNodeId); uint8_t GetClientNodeCount() const { return mClientNodeCount; } NodeId GetClientNode(uint8_t index) const { return mClientNodes[index]; } diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index 214af261e26e54..aa615aaae8be54 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -420,7 +420,7 @@ std::set ContentAppPlatform::GetNodeIdsForContentApp(uint16_t vendorId, return {}; } -std::set ContentAppPlatform::GetNodeIdsForAllowVendorId(uint16_t vendorId) +std::set ContentAppPlatform::GetNodeIdsForAllowedVendorId(uint16_t vendorId) { std::set result; std::string vendorPrefix = std::to_string(vendorId) + ":"; @@ -660,6 +660,7 @@ CHIP_ERROR ContentAppPlatform::GetACLEntryIndex(size_t * foundIndex, FabricIndex // and create bindings on the given client so that it knows what it has access to. CHIP_ERROR ContentAppPlatform::ManageClientAccess(Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle, uint16_t targetVendorId, uint16_t targetProductId, NodeId localNodeId, + CharSpan rotatingId, uint32_t passcode, std::vector bindings, Controller::WriteResponseSuccessCallback successCb, Controller::WriteResponseFailureCallback failureCb) @@ -799,13 +800,32 @@ CHIP_ERROR ContentAppPlatform::ManageClientAccess(Messaging::ExchangeManager & e .cluster = NullOptional, .fabricIndex = kUndefinedFabricIndex, }); + + accessAllowed = true; } - accessAllowed = true; } if (accessAllowed) { // notify content app about this nodeId - app->AddClientNode(subjectNodeId); + bool isNodeAdded = app->AddClientNode(subjectNodeId); + + if (isNodeAdded && rotatingId.size() != 0) + { + // handle login + auto setupPIN = std::to_string(passcode); + auto accountLoginDelegate = app->GetAccountLoginDelegate(); + if (accountLoginDelegate != nullptr) + { + bool condition = accountLoginDelegate->HandleLogin(rotatingId, { setupPIN.data(), setupPIN.size() }, + MakeOptional(subjectNodeId)); + ChipLogProgress(Controller, "AccountLogin::Login command sent and returned: %s", + condition ? "success" : "failure"); + } + else + { + ChipLogError(Controller, "AccountLoginDelegate not found for app"); + } + } } } } diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 45615d09ed8ddf..b00f9f1bf7a1ab 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -165,7 +165,7 @@ class DLL_EXPORT ContentAppPlatform std::set GetNodeIdsForContentApp(uint16_t vendorId, uint16_t productId); // returns set of connected nodes for a given allowed vendor id - std::set GetNodeIdsForAllowVendorId(uint16_t vendorId); + std::set GetNodeIdsForAllowedVendorId(uint16_t vendorId); // store node id for content app after commissioning // node id can be used later on to update ACL @@ -188,6 +188,8 @@ class DLL_EXPORT ContentAppPlatform * @param[in] targetVendorId Vendor ID for the target device. * @param[in] targetProductId Product ID for the target device. * @param[in] localNodeId The NodeId for the local device. + * @param[in] rotatingId The rotating account ID to handle account login. + * @param[in] passcode The passcode to handle account login. * @param[in] bindings Any additional bindings to include. This may include current bindings. * @param[in] successCb The function to be called on success of adding the binding. * @param[in] failureCb The function to be called on failure of adding the binding. @@ -195,7 +197,7 @@ class DLL_EXPORT ContentAppPlatform * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error */ CHIP_ERROR ManageClientAccess(Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle, uint16_t targetVendorId, - uint16_t targetProductId, NodeId localNodeId, + uint16_t targetProductId, NodeId localNodeId, chip::CharSpan rotatingId, uint32_t passcode, std::vector bindings, Controller::WriteResponseSuccessCallback successCb, Controller::WriteResponseFailureCallback failureCb); diff --git a/src/controller/CommissionerDiscoveryController.cpp b/src/controller/CommissionerDiscoveryController.cpp index 09a22e03e0bcd2..baf8e14bfd4e37 100644 --- a/src/controller/CommissionerDiscoveryController.cpp +++ b/src/controller/CommissionerDiscoveryController.cpp @@ -166,6 +166,11 @@ void CommissionerDiscoveryController::OnUserDirectedCommissioningRequest(UDCClie ChipLogError(AppServer, "On UDC: could not convert rotating id to hex"); rotatingIdString[0] = '\0'; } + else + { + // Store rotating ID string. Don't include null terminator character. + mRotatingId = std::string{ rotatingIdString, state.GetRotatingIdLength() * 2 }; + } ChipLogDetail(Controller, "------PROMPT USER: %s is requesting permission to cast to this TV, approve? [" ChipLogFormatMEI @@ -455,6 +460,7 @@ void CommissionerDiscoveryController::InternalHandleContentAppPasscodeResponse() cd, Transport::PeerAddress::UDP(client->GetPeerAddress().GetIPAddress(), client->GetCdPort())); return; } + client->SetCachedCommissionerPasscode(passcode); client->SetUDCClientProcessingState(UDCClientProcessingState::kWaitingForCommissionerPasscodeReady); @@ -630,10 +636,13 @@ void CommissionerDiscoveryController::CommissioningSucceeded(uint16_t vendorId, mVendorId = vendorId; mProductId = productId; mNodeId = nodeId; + if (mPostCommissioningListener != nullptr) { ChipLogDetail(Controller, "CommissionerDiscoveryController calling listener"); - mPostCommissioningListener->CommissioningCompleted(vendorId, productId, nodeId, exchangeMgr, sessionHandle); + auto rotatingIdSpan = CharSpan{ mRotatingId.data(), mRotatingId.size() }; + mPostCommissioningListener->CommissioningCompleted(vendorId, productId, nodeId, rotatingIdSpan, mPasscode, exchangeMgr, + sessionHandle); } else { diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h index 5f7572b29def17..94f172c1d32750 100644 --- a/src/controller/CommissionerDiscoveryController.h +++ b/src/controller/CommissionerDiscoveryController.h @@ -232,12 +232,14 @@ class DLL_EXPORT PostCommissioningListener * @param[in] vendorId The vendorid from the DAC of the new node. * @param[in] productId The productid from the DAC of the new node. * @param[in] nodeId The node id for the newly commissioned node. + * @param[in] rotatingId The rotating ID to handle account login. + * @param[in] passcode The passcode to handle account login. * @param[in] exchangeMgr The exchange manager to be used to get an exchange context. * @param[in] sessionHandle A reference to an established session. * */ - virtual void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, - chip::Messaging::ExchangeManager & exchangeMgr, + virtual void CommissioningCompleted(uint16_t vendorId, uint16_t productId, NodeId nodeId, chip::CharSpan rotatingId, + uint32_t passcode, chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle) = 0; virtual ~PostCommissioningListener() = default; @@ -451,6 +453,7 @@ class CommissionerDiscoveryController : public chip::Protocols::UserDirectedComm uint16_t mProductId = 0; NodeId mNodeId = 0; uint32_t mPasscode = 0; + std::string mRotatingId; UserDirectedCommissioningServer * mUdcServer = nullptr; UserPrompter * mUserPrompter = nullptr; From 05ba80342a0b9949e286a19e02a6f658f0d97add Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 22 Aug 2024 16:17:11 -0700 Subject: [PATCH 34/53] [Fabric-Sync] Symplify the build instructions with build_examples.py (#35162) --- examples/fabric-admin/README.md | 3 ++- examples/fabric-bridge-app/linux/README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/fabric-admin/README.md b/examples/fabric-admin/README.md index 7178ab2c2f8c94..c6b4ba7eb3577f 100644 --- a/examples/fabric-admin/README.md +++ b/examples/fabric-admin/README.md @@ -14,7 +14,8 @@ fabrics. For Linux host example: ``` -./scripts/examples/gn_build_example.sh examples/fabric-admin out/debug/standalone 'import("//with_pw_rpc.gni")' +source scripts/activate.sh +./scripts/build/build_examples.py --target linux-x64-fabric-admin-rpc build ``` For Raspberry Pi 4 example: diff --git a/examples/fabric-bridge-app/linux/README.md b/examples/fabric-bridge-app/linux/README.md index 6d830cdd987c33..96e8a2924a65bc 100644 --- a/examples/fabric-bridge-app/linux/README.md +++ b/examples/fabric-bridge-app/linux/README.md @@ -91,7 +91,8 @@ defined: ### For Linux host example: ``` - ./scripts/examples/gn_build_example.sh examples/fabric-bridge-app/linux out/debug/standalone chip_config_network_layer_ble=false 'import("//with_pw_rpc.gni")' + source scripts/activate.sh + ./scripts/build/build_examples.py --target linux-x64-fabric-bridge-rpc build ``` ### For Raspberry Pi 4 example: From daa2a57af16652ce17d7536db7665bf1e2ad40c2 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Thu, 22 Aug 2024 19:48:46 -0400 Subject: [PATCH 35/53] Fix init of all TC-OCC-* tests (#35001) * Fix init of all TC-OCC-* tests - During TE2 if was found that all TC-OCC-* tests require to pass a `--int-arg endpoint:N` argument which is not the right way to specify endpoint. This is fixed here. - Some pre-steps were done in Step 1 which should have been done after Step 1 so that errors are not marked as Commissioning Failure when it's test failure. Fixes https://github.com/project-chip/matter-test-scripts/issues/340 * More fixes to OCC tests - 3.2 now properly using feature map - Fixed typos - Added queue flushing examples * Restyle * Fix line endings * Restyled by autopep8 * Fix CI --------- Co-authored-by: Restyled.io --- src/python_testing/TC_OCC_2_1.py | 566 ++++++++++--------- src/python_testing/TC_OCC_2_2.py | 264 ++++----- src/python_testing/TC_OCC_2_3.py | 255 ++++----- src/python_testing/TC_OCC_3_1.py | 263 +++++---- src/python_testing/TC_OCC_3_2.py | 411 +++++++------- src/python_testing/matter_testing_support.py | 26 + 6 files changed, 907 insertions(+), 878 deletions(-) diff --git a/src/python_testing/TC_OCC_2_1.py b/src/python_testing/TC_OCC_2_1.py index cf39a7eff5a111..ddbb34cbf0252a 100644 --- a/src/python_testing/TC_OCC_2_1.py +++ b/src/python_testing/TC_OCC_2_1.py @@ -1,278 +1,288 @@ -# -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. -# -# 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. -# -# There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for -# the occupancy state ON/OFF change. -# [TC-OCC-3.1] test procedure step 4 -# [TC-OCC-3.2] test precedure step 3a, 3c - -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto -# === END CI TEST ARGUMENTS === - -import logging - -import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts - - -class TC_OCC_2_1(MatterBaseTest): - async def read_occ_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.OccupancySensing - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) - - def desc_TC_OCC_2_1(self) -> str: - return "[TC-OCC-2.1] Attributes with DUT as Server" - - def steps_TC_OCC_2_1(self) -> list[TestStep]: - steps = [ - TestStep(1, "Commissioning, already done", is_commissioning=True), - TestStep(2, "Read Occupancy attribute."), - TestStep(3, "Read OccupancySensorType attribute."), - TestStep(4, "Read OccupancySensorTypeBitmap attribute."), - TestStep(5, "Read HoldTimeLimits attribute, if supported"), - TestStep(6, "Read HoldTime attribute, if supported"), - TestStep(7, "Read PIROccupiedToUnoccupiedDelay attribute, if supported"), - TestStep(8, "Read PIRUnoccupiedToOccupiedDelay attribute, if supported"), - TestStep(9, "Read PIRUnoccupiedToOccupiedThreshold attribute, if supported"), - TestStep(10, "Read UltrasonicOccupiedToUnoccupiedDelay attribute, if supported"), - TestStep(11, "Read UltrasonicUnoccupiedToOccupiedDelay attribute, if supported"), - TestStep(12, "Read UltrasonicUnoccupiedToOccupiedThreshold attribute, if supported"), - TestStep(13, "Read PhysicalContactOccupiedToUnoccupiedDelay attribute, if supported"), - TestStep(14, "Read PhysicalContactUnoccupiedToOccupiedDelay attribute, if supported"), - TestStep(15, "Read PhysicalContactUnoccupiedToOccupiedThreshold attribute, if supported") - ] - return steps - - def pics_TC_OCC_2_1(self) -> list[str]: - pics = [ - "OCC.S", - ] - return pics - - @async_test_body - async def test_TC_OCC_2_1(self): - - endpoint = self.user_params.get("endpoint", 1) - - self.step(1) - attributes = Clusters.OccupancySensing.Attributes - attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) - - self.step(2) - asserts.assert_in(attributes.Occupancy.attribute_id, attribute_list, "Occupancy attribute is mandatory") - occupancy_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.Occupancy) - asserts.assert_less_equal(occupancy_dut, 0b00000001, "Occupancy attribute is not in valid range") - - self.step(3) - asserts.assert_in(attributes.OccupancySensorType.attribute_id, attribute_list, - "OccupancySensorType attribute is a mandatory attribute.") - - occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) - asserts.assert_less(occupancy_sensor_type_dut, Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUnknownEnumValue, - "OccupancySensorType is not in valid range") - asserts.assert_in(occupancy_sensor_type_dut, {Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPir, - Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic, - Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic, - Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact}, "OccupancySensorType is not in valid range") - self.step(4) - asserts.assert_in(attributes.OccupancySensorTypeBitmap.attribute_id, attribute_list, - "OccupancySensorTypeBitmap attribute is a mandatory attribute.") - - occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorTypeBitmap) - asserts.assert_less_equal(occupancy_sensor_type_bitmap_dut, 0b00000111, - "OccupancySensorTypeBitmap attribute is not in valid range") - - self.step(5) - if attributes.HoldTimeLimits.attribute_id in attribute_list: - asserts.assert_in(attributes.HoldTime.attribute_id, attribute_list, "HoldTime attribute conformance failed.") - hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits) - asserts.assert_less_equal(hold_time_limits_dut.holdTimeMin, hold_time_limits_dut.holdTimeMax, - "HoldTimeMin is not in valid range") - asserts.assert_greater_equal(hold_time_limits_dut.holdTimeMin, 0, "HoldTimeMin is not in valid range") - asserts.assert_less_equal(hold_time_limits_dut.holdTimeMax, 0xFFFE, "HoldTimeMin is not in valid range") - asserts.assert_greater_equal(hold_time_limits_dut.holdTimeMax, - hold_time_limits_dut.holdTimeMin, "HoldTimeMin is not in valid range") - asserts.assert_less_equal(hold_time_limits_dut.holdTimeDefault, - hold_time_limits_dut.holdTimeMax, "HoldTimeMin is not in valid range") - asserts.assert_greater_equal(hold_time_limits_dut.holdTimeDefault, - hold_time_limits_dut.holdTimeMin, "HoldTimeMin is not in valid range") - else: - logging.info("HoldTimeLimits not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(6) - if attributes.HoldTime.attribute_id in attribute_list: - hold_time_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTime) - hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits) - - asserts.assert_less_equal(hold_time_dut, hold_time_limits_dut.holdTimeMax, "HoldTime attribute is out of range") - asserts.assert_greater_equal(hold_time_dut, hold_time_limits_dut.holdTimeMin, "HoldTime attribute is out of range") - else: - logging.info("HoldTime not supported. The rest of legacy attribute test can be skipped") - self.skip_all_remaining_steps(7) - return - - self.step(7) - if attributes.PIROccupiedToUnoccupiedDelay.attribute_id in attribute_list: - has_pir_bitmap = (occupancy_sensor_type_bitmap_dut & - Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPir) != 0 - has_ultrasonic_bitmap = (occupancy_sensor_type_bitmap_dut & - Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kUltrasonic) != 0 - has_phy_bitmap = (occupancy_sensor_type_bitmap_dut & - Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPhysicalContact) != 0 - if has_pir_bitmap or (not has_ultrasonic_bitmap and not has_phy_bitmap): - pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) - asserts.assert_less_equal(pir_otou_delay_dut, 0xFFFE, "PIROccupiedToUnoccupiedDelay is not in valid range") - asserts.assert_greater_equal(pir_otou_delay_dut, 0, "PIROccupiedToUnoccupiedDelay is not in valid range") - else: - logging.info("PIROccupiedToUnoccupiedDelay conformance failed") - asserts.fail( - f"PIROccupiedToUnoccupiedDelay conformance is incorrect: {has_pir_bitmap}, {has_ultrasonic_bitmap}, {has_phy_bitmap}") - else: - logging.info("PIROccupiedToUnoccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(8) - if attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list: - has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedDelay conformance failure") - pir_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedDelay) - asserts.assert_less_equal(pir_utoo_delay_dut, 0xFFFE, "PIRUnoccupiedToOccupiedDelay is not in valid range") - asserts.assert_greater_equal(pir_utoo_delay_dut, 0, "PIRUnoccupiedToOccupiedDelay is not in valid range") - else: - logging.info("PIRUnoccupiedToOccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(9) - if attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: - has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedThreshold conformance failure") - pir_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedThreshold) - asserts.assert_less_equal(pir_utoo_threshold_dut, 0xFE, "PIRUnoccupiedToOccupiedThreshold is not in valid range") - asserts.assert_greater_equal(pir_utoo_threshold_dut, 0, "PIRUnoccupiedToOccupiedThreshold is not in valid range") - else: - logging.info("PIRUnoccupiedToOccupiedThreshold not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(10) - if attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list: - has_ultrasonic_bitmap = (occupancy_sensor_type_bitmap_dut & - Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic) != 0 - has_ultrasonic_delay = attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list - asserts.assert_equal(has_ultrasonic_bitmap, has_ultrasonic_delay, "Bad conformance on Ultrasonic bitmap") - - ultrasonic_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) - asserts.assert_less_equal(ultrasonic_otou_delay_dut, 0xFFFE, - "UltrasonicOccupiedToUnoccupiedDelay is not in valid range") - asserts.assert_greater_equal(ultrasonic_otou_delay_dut, 0, "UltrasonicOccupiedToUnoccupiedDelay is not in valid range") - - else: - logging.info("UltrasonicOccupiedToUnoccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(11) - if attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list: - has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedDelay conformance failure") - - ultrasonic_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedDelay) - asserts.assert_less_equal(ultrasonic_utoo_delay_dut, 0xFFFE, - "UltrasonicUnoccupiedToOccupiedDelay is not in valid range") - asserts.assert_greater_equal(ultrasonic_utoo_delay_dut, 0, "UltrasonicUnoccupiedToOccupiedDelay is not in valid range") - else: - logging.info("UltrasonicUnoccupiedToOccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(12) - if attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: - has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedThreshold conformance failure") - - ultrasonic_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedThreshold) - asserts.assert_less_equal(ultrasonic_utoo_threshold_dut, 0xFE, - "UltrasonicUnoccupiedToOccupiedThreshold is not in valid range") - asserts.assert_greater_equal(ultrasonic_utoo_threshold_dut, 0, - "UltrasonicUnoccupiedToOccupiedThreshold is not in valid range") - - else: - logging.info("UltrasonicUnoccupiedToOccupiedThreshold not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(13) - if attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list: - has_phycon_bitmap = (occupancy_sensor_type_bitmap_dut & - Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact) != 0 - has_phycon_delay = attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list - asserts.assert_equal(has_phycon_bitmap, has_phycon_delay, "Bad conformance on PhysicalContact bitmap") - phycontact_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) - asserts.assert_less_equal(phycontact_otou_delay_dut, 0xFFFE, - "PhysicalContactOccupiedToUnoccupiedDelay is not in valid range") - asserts.assert_greater_equal(phycontact_otou_delay_dut, 0, - "PhysicalContactOccupiedToUnoccupiedDelay is not in valid range") - - else: - logging.info("PhysicalContactOccupiedToUnoccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(14) - if attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list: - has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedDelay conformance failure") - - phycontact_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedDelay) - asserts.assert_less_equal(phycontact_utoo_delay_dut, 0xFFFE, - "PhysicalContactUnoccupiedToOccupiedDelay is not in valid range") - asserts.assert_greater_equal(phycontact_utoo_delay_dut, 0, - "PhysicalContactUnoccupiedToOccupiedDelay is not in valid range") - - else: - logging.info("PhysicalContactUnoccupiedToOccupiedDelay not supported. Test step skipped") - self.mark_current_step_skipped() - - self.step(15) - if attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: - has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list - has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list - asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedThreshold conformance failure") - - phycontact_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedThreshold) - asserts.assert_less_equal(phycontact_utoo_threshold_dut, 0xFE, - "PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range") - asserts.assert_greater_equal(phycontact_utoo_threshold_dut, 0, - "PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range") - - else: - logging.info("PhysicalContactUnoccupiedToOccupiedThreshold not supported. Test step skipped") - self.mark_current_step_skipped() - - -if __name__ == "__main__": - default_matter_test_main() +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# +# There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for +# the occupancy state ON/OFF change. +# [TC-OCC-3.1] test procedure step 4 +# [TC-OCC-3.2] test precedure step 3a, 3c + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --endpoint 1 +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_OCC_2_1(MatterBaseTest): + async def read_occ_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.OccupancySensing + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + def desc_TC_OCC_2_1(self) -> str: + return "[TC-OCC-2.1] Attributes with DUT as Server" + + def steps_TC_OCC_2_1(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Read Occupancy attribute."), + TestStep(3, "Read OccupancySensorType attribute."), + TestStep(4, "Read OccupancySensorTypeBitmap attribute."), + TestStep(5, "Read HoldTimeLimits attribute, if supported"), + TestStep(6, "Read HoldTime attribute, if supported"), + TestStep(7, "Read PIROccupiedToUnoccupiedDelay attribute, if supported"), + TestStep(8, "Read PIRUnoccupiedToOccupiedDelay attribute, if supported"), + TestStep(9, "Read PIRUnoccupiedToOccupiedThreshold attribute, if supported"), + TestStep(10, "Read UltrasonicOccupiedToUnoccupiedDelay attribute, if supported"), + TestStep(11, "Read UltrasonicUnoccupiedToOccupiedDelay attribute, if supported"), + TestStep(12, "Read UltrasonicUnoccupiedToOccupiedThreshold attribute, if supported"), + TestStep(13, "Read PhysicalContactOccupiedToUnoccupiedDelay attribute, if supported"), + TestStep(14, "Read PhysicalContactUnoccupiedToOccupiedDelay attribute, if supported"), + TestStep(15, "Read PhysicalContactUnoccupiedToOccupiedThreshold attribute, if supported") + ] + return steps + + def pics_TC_OCC_2_1(self) -> list[str]: + pics = [ + "OCC.S", + ] + return pics + + @async_test_body + async def test_TC_OCC_2_1(self): + endpoint = self.matter_test_config.endpoint + cluster = Clusters.Objects.OccupancySensing + attributes = cluster.Attributes + + self.step(1) # Already done, immediately go to step 2 + + self.step(2) + + feature_map = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) + has_feature_pir = (feature_map & cluster.Bitmaps.Feature.kPassiveInfrared) != 0 + has_feature_ultrasonic = (feature_map & cluster.Bitmaps.Feature.kUltrasonic) != 0 + has_feature_contact = (feature_map & cluster.Bitmaps.Feature.kPhysicalContact) != 0 + + logging.info( + f"Feature map: 0x{feature_map:x}. PIR: {has_feature_pir}, US:{has_feature_ultrasonic}, PHY:{has_feature_contact}") + + attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) + + asserts.assert_in(attributes.Occupancy.attribute_id, attribute_list, "Occupancy attribute is mandatory") + occupancy_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.Occupancy) + asserts.assert_less_equal(occupancy_dut, 0b00000001, "Occupancy attribute is not in valid range") + + self.step(3) + asserts.assert_in(attributes.OccupancySensorType.attribute_id, attribute_list, + "OccupancySensorType attribute is a mandatory attribute.") + + occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) + asserts.assert_less(occupancy_sensor_type_dut, Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUnknownEnumValue, + "OccupancySensorType is not in valid range") + asserts.assert_in(occupancy_sensor_type_dut, {Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPir, + Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic, + Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic, + Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact}, "OccupancySensorType is not in valid range") + self.step(4) + asserts.assert_in(attributes.OccupancySensorTypeBitmap.attribute_id, attribute_list, + "OccupancySensorTypeBitmap attribute is a mandatory attribute.") + + occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorTypeBitmap) + asserts.assert_less_equal(occupancy_sensor_type_bitmap_dut, 0b00000111, + "OccupancySensorTypeBitmap attribute is not in valid range") + + self.step(5) + if attributes.HoldTimeLimits.attribute_id in attribute_list: + asserts.assert_in(attributes.HoldTime.attribute_id, attribute_list, "HoldTime attribute conformance failed.") + hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits) + asserts.assert_less_equal(hold_time_limits_dut.holdTimeMin, hold_time_limits_dut.holdTimeMax, + "HoldTimeMin is not in valid range") + asserts.assert_greater_equal(hold_time_limits_dut.holdTimeMin, 0, "HoldTimeMin is not in valid range") + asserts.assert_less_equal(hold_time_limits_dut.holdTimeMax, 0xFFFE, "HoldTimeMin is not in valid range") + asserts.assert_greater_equal(hold_time_limits_dut.holdTimeMax, + hold_time_limits_dut.holdTimeMin, "HoldTimeMin is not in valid range") + asserts.assert_less_equal(hold_time_limits_dut.holdTimeDefault, + hold_time_limits_dut.holdTimeMax, "HoldTimeMin is not in valid range") + asserts.assert_greater_equal(hold_time_limits_dut.holdTimeDefault, + hold_time_limits_dut.holdTimeMin, "HoldTimeMin is not in valid range") + else: + logging.info("HoldTimeLimits not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(6) + if attributes.HoldTime.attribute_id in attribute_list: + hold_time_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTime) + hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits) + + asserts.assert_less_equal(hold_time_dut, hold_time_limits_dut.holdTimeMax, "HoldTime attribute is out of range") + asserts.assert_greater_equal(hold_time_dut, hold_time_limits_dut.holdTimeMin, "HoldTime attribute is out of range") + else: + logging.info("HoldTime not supported. The rest of legacy attribute test can be skipped") + self.skip_all_remaining_steps(7) + return + + self.step(7) + if attributes.PIROccupiedToUnoccupiedDelay.attribute_id in attribute_list: + has_feature_pir = (occupancy_sensor_type_bitmap_dut & + Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPir) != 0 + has_feature_ultrasonic = (occupancy_sensor_type_bitmap_dut & + Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kUltrasonic) != 0 + has_feature_contact = (occupancy_sensor_type_bitmap_dut & + Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPhysicalContact) != 0 + if has_feature_pir or (not has_feature_pir and not has_feature_ultrasonic and not has_feature_contact): + pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) + asserts.assert_less_equal(pir_otou_delay_dut, 0xFFFE, "PIROccupiedToUnoccupiedDelay is not in valid range") + asserts.assert_greater_equal(pir_otou_delay_dut, 0, "PIROccupiedToUnoccupiedDelay is not in valid range") + else: + logging.info("PIROccupiedToUnoccupiedDelay conformance failed") + asserts.fail( + f"PIROccupiedToUnoccupiedDelay conformance is incorrect: {has_feature_pir}, {has_feature_ultrasonic}, {has_feature_contact}") + else: + logging.info("PIROccupiedToUnoccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(8) + if attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list: + has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedDelay conformance failure") + pir_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedDelay) + asserts.assert_less_equal(pir_utoo_delay_dut, 0xFFFE, "PIRUnoccupiedToOccupiedDelay is not in valid range") + asserts.assert_greater_equal(pir_utoo_delay_dut, 0, "PIRUnoccupiedToOccupiedDelay is not in valid range") + else: + logging.info("PIRUnoccupiedToOccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(9) + if attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: + has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedThreshold conformance failure") + pir_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedThreshold) + asserts.assert_less_equal(pir_utoo_threshold_dut, 0xFE, "PIRUnoccupiedToOccupiedThreshold is not in valid range") + asserts.assert_greater_equal(pir_utoo_threshold_dut, 0, "PIRUnoccupiedToOccupiedThreshold is not in valid range") + else: + logging.info("PIRUnoccupiedToOccupiedThreshold not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(10) + if attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list: + has_feature_ultrasonic = (occupancy_sensor_type_bitmap_dut & + Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic) != 0 + has_ultrasonic_delay = attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list + asserts.assert_equal(has_feature_ultrasonic, has_ultrasonic_delay, "Bad conformance on Ultrasonic bitmap") + + ultrasonic_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) + asserts.assert_less_equal(ultrasonic_otou_delay_dut, 0xFFFE, + "UltrasonicOccupiedToUnoccupiedDelay is not in valid range") + asserts.assert_greater_equal(ultrasonic_otou_delay_dut, 0, "UltrasonicOccupiedToUnoccupiedDelay is not in valid range") + + else: + logging.info("UltrasonicOccupiedToUnoccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(11) + if attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list: + has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedDelay conformance failure") + + ultrasonic_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedDelay) + asserts.assert_less_equal(ultrasonic_utoo_delay_dut, 0xFFFE, + "UltrasonicUnoccupiedToOccupiedDelay is not in valid range") + asserts.assert_greater_equal(ultrasonic_utoo_delay_dut, 0, "UltrasonicUnoccupiedToOccupiedDelay is not in valid range") + else: + logging.info("UltrasonicUnoccupiedToOccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(12) + if attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: + has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedThreshold conformance failure") + + ultrasonic_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedThreshold) + asserts.assert_less_equal(ultrasonic_utoo_threshold_dut, 0xFE, + "UltrasonicUnoccupiedToOccupiedThreshold is not in valid range") + asserts.assert_greater_equal(ultrasonic_utoo_threshold_dut, 0, + "UltrasonicUnoccupiedToOccupiedThreshold is not in valid range") + + else: + logging.info("UltrasonicUnoccupiedToOccupiedThreshold not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(13) + if attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list: + has_phycon_bitmap = (occupancy_sensor_type_bitmap_dut & + Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact) != 0 + has_phycon_delay = attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list + asserts.assert_equal(has_phycon_bitmap, has_phycon_delay, "Bad conformance on PhysicalContact bitmap") + phycontact_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) + asserts.assert_less_equal(phycontact_otou_delay_dut, 0xFFFE, + "PhysicalContactOccupiedToUnoccupiedDelay is not in valid range") + asserts.assert_greater_equal(phycontact_otou_delay_dut, 0, + "PhysicalContactOccupiedToUnoccupiedDelay is not in valid range") + + else: + logging.info("PhysicalContactOccupiedToUnoccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(14) + if attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list: + has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedDelay conformance failure") + + phycontact_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedDelay) + asserts.assert_less_equal(phycontact_utoo_delay_dut, 0xFFFE, + "PhysicalContactUnoccupiedToOccupiedDelay is not in valid range") + asserts.assert_greater_equal(phycontact_utoo_delay_dut, 0, + "PhysicalContactUnoccupiedToOccupiedDelay is not in valid range") + + else: + logging.info("PhysicalContactUnoccupiedToOccupiedDelay not supported. Test step skipped") + self.mark_current_step_skipped() + + self.step(15) + if attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list: + has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list + has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list + asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedThreshold conformance failure") + + phycontact_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedThreshold) + asserts.assert_less_equal(phycontact_utoo_threshold_dut, 0xFE, + "PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range") + asserts.assert_greater_equal(phycontact_utoo_threshold_dut, 0, + "PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range") + + else: + logging.info("PhysicalContactUnoccupiedToOccupiedThreshold not supported. Test step skipped") + self.mark_current_step_skipped() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OCC_2_2.py b/src/python_testing/TC_OCC_2_2.py index e27bbf30ebcade..9914452342cef3 100644 --- a/src/python_testing/TC_OCC_2_2.py +++ b/src/python_testing/TC_OCC_2_2.py @@ -1,132 +1,132 @@ -# -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. -# -# 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. -# - -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto -# === END CI TEST ARGUMENTS === - -import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts - - -class TC_OCC_2_2(MatterBaseTest): - async def read_occ_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.OccupancySensing - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) - - def desc_TC_OCC_2_2(self) -> str: - return "[TC-OCC-2.2] OccupancySensorTypeBitmap and OccupancySensorType interdependency with server as DUT" - - def steps_TC_OCC_2_2(self) -> list[TestStep]: - steps = [ - TestStep(1, "Commissioning, already done", is_commissioning=True), - TestStep(2, "Read OccupancySensorType attribute selection based on FeatureMap Bitmap."), - TestStep(3, "Read OccupancySensorTypeBitmap attribute selection based on FeatureMap Bitmap.") - ] - return steps - - def pics_TC_OCC_2_2(self) -> list[str]: - pics = [ - "OCC.S", - ] - return pics - - @async_test_body - async def test_TC_OCC_2_2(self): - - endpoint = self.user_params.get("endpoint", 1) - - attributes = Clusters.OccupancySensing.Attributes - feature_map = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) - - self.step(1) - attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) - - self.step(2) - # OccupancySensorType will be determined by FeatureMap matching table at 2.7.6.2. - asserts.assert_in(attributes.OccupancySensorType.attribute_id, attribute_list, - "OccupancySensorType attribute is a mandatory attribute.") - occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) - - # For validation purposes, 2.7.6.2 table describes what feature flags map to what type of sensors - TypeEnum = Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum - - Y = True - N = False - # Map is PIR, US, PHY => expected sensor type - # odd Y/N mapping to make the table align nicely - mappings = { - (N, N, N): TypeEnum.kPir, - (Y, N, N): TypeEnum.kPir, - (N, Y, N): TypeEnum.kUltrasonic, - (Y, Y, N): TypeEnum.kPIRAndUltrasonic, - (N, N, Y): TypeEnum.kPhysicalContact, - (Y, N, Y): TypeEnum.kPir, - (N, Y, Y): TypeEnum.kUltrasonic, - (Y, Y, Y): TypeEnum.kPIRAndUltrasonic, - } - - FeatureBit = Clusters.OccupancySensing.Bitmaps.Feature - expected = mappings.get( - ( - (feature_map & FeatureBit.kPassiveInfrared) != 0, - (feature_map & FeatureBit.kUltrasonic) != 0, - (feature_map & FeatureBit.kPhysicalContact) != 0 - )) - - asserts.assert_equal( - occupancy_sensor_type_dut, - expected, - f"Sensor Type should be f{expected}" - ) - - self.step(3) - # OccupancySensorTypeBitmap will be determined by FeatureMap matching table at 2.7.6.2. - asserts.assert_in(attributes.OccupancySensorTypeBitmap.attribute_id, attribute_list, - "OccupancySensorTypeBitmap attribute is a mandatory attribute.") - - occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorTypeBitmap) - - # Feature map must match the sensor type bitmap - must_match_bits = [ - (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPir, - Clusters.OccupancySensing.Bitmaps.Feature.kPassiveInfrared, "PIR"), - (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kUltrasonic, - Clusters.OccupancySensing.Bitmaps.Feature.kUltrasonic, "Ultrasonic"), - (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPhysicalContact, - Clusters.OccupancySensing.Bitmaps.Feature.kPhysicalContact, "Physical contact"), - ] - - for sensor_bit, feature_bit, name in must_match_bits: - asserts.assert_equal( - (occupancy_sensor_type_bitmap_dut & sensor_bit) != 0, - (feature_map & feature_bit) != 0, - f"Feature bit and sensor bitmap must be equal for {name} (BITMAP: 0x{occupancy_sensor_type_bitmap_dut:02X}, FEATUREMAP: 0x{feature_map:02X})" - ) - - -if __name__ == "__main__": - default_matter_test_main() +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --endpoint 1 +# === END CI TEST ARGUMENTS === + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_OCC_2_2(MatterBaseTest): + async def read_occ_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.OccupancySensing + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + def desc_TC_OCC_2_2(self) -> str: + return "[TC-OCC-2.2] OccupancySensorTypeBitmap and OccupancySensorType interdependency with server as DUT" + + def steps_TC_OCC_2_2(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Read OccupancySensorType attribute selection based on FeatureMap Bitmap."), + TestStep(3, "Read OccupancySensorTypeBitmap attribute selection based on FeatureMap Bitmap.") + ] + return steps + + def pics_TC_OCC_2_2(self) -> list[str]: + pics = [ + "OCC.S", + ] + return pics + + @async_test_body + async def test_TC_OCC_2_2(self): + endpoint = self.matter_test_config.endpoint + + self.step(1) # Already done, immediately go to step 2 + + self.step(2) + + attributes = Clusters.OccupancySensing.Attributes + feature_map = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap) + attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) + + # OccupancySensorType will be determined by FeatureMap matching table at 2.7.6.2. + asserts.assert_in(attributes.OccupancySensorType.attribute_id, attribute_list, + "OccupancySensorType attribute is a mandatory attribute.") + occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) + + # For validation purposes, 2.7.6.2 table describes what feature flags map to what type of sensors + TypeEnum = Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum + + Y = True + N = False + # Map is PIR, US, PHY => expected sensor type + # odd Y/N mapping to make the table align nicely + mappings = { + (N, N, N): TypeEnum.kPir, + (Y, N, N): TypeEnum.kPir, + (N, Y, N): TypeEnum.kUltrasonic, + (Y, Y, N): TypeEnum.kPIRAndUltrasonic, + (N, N, Y): TypeEnum.kPhysicalContact, + (Y, N, Y): TypeEnum.kPir, + (N, Y, Y): TypeEnum.kUltrasonic, + (Y, Y, Y): TypeEnum.kPIRAndUltrasonic, + } + + FeatureBit = Clusters.OccupancySensing.Bitmaps.Feature + expected = mappings.get( + ( + (feature_map & FeatureBit.kPassiveInfrared) != 0, + (feature_map & FeatureBit.kUltrasonic) != 0, + (feature_map & FeatureBit.kPhysicalContact) != 0 + )) + + asserts.assert_equal( + occupancy_sensor_type_dut, + expected, + f"Sensor Type should be f{expected}" + ) + + self.step(3) + # OccupancySensorTypeBitmap will be determined by FeatureMap matching table at 2.7.6.2. + asserts.assert_in(attributes.OccupancySensorTypeBitmap.attribute_id, attribute_list, + "OccupancySensorTypeBitmap attribute is a mandatory attribute.") + + occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorTypeBitmap) + + # Feature map must match the sensor type bitmap + must_match_bits = [ + (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPir, + Clusters.OccupancySensing.Bitmaps.Feature.kPassiveInfrared, "PIR"), + (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kUltrasonic, + Clusters.OccupancySensing.Bitmaps.Feature.kUltrasonic, "Ultrasonic"), + (Clusters.OccupancySensing.Bitmaps.OccupancySensorTypeBitmap.kPhysicalContact, + Clusters.OccupancySensing.Bitmaps.Feature.kPhysicalContact, "Physical contact"), + ] + + for sensor_bit, feature_bit, name in must_match_bits: + asserts.assert_equal( + (occupancy_sensor_type_bitmap_dut & sensor_bit) != 0, + (feature_map & feature_bit) != 0, + f"Feature bit and sensor bitmap must be equal for {name} (BITMAP: 0x{occupancy_sensor_type_bitmap_dut:02X}, FEATUREMAP: 0x{feature_map:02X})" + ) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OCC_2_3.py b/src/python_testing/TC_OCC_2_3.py index 0184b670c6b306..63e973b159ca37 100644 --- a/src/python_testing/TC_OCC_2_3.py +++ b/src/python_testing/TC_OCC_2_3.py @@ -1,127 +1,128 @@ -# -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. -# -# 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. -# - -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto -# === END CI TEST ARGUMENTS === - -import logging - -import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts - - -class TC_OCC_2_3(MatterBaseTest): - async def read_occ_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.OccupancySensing - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) - - def desc_TC_OCC_2_3(self) -> str: - return "[TC-OCC-2.3] HoldTime Backward Compatibility Test with server as DUT" - - def steps_TC_OCC_2_3(self) -> list[TestStep]: - steps = [ - TestStep(1, "Commission DUT to TH", is_commissioning=True), - TestStep(2, "DUT supports HoldTime attribute. If DUT doesn’t support it, then stop and exit this test case."), - TestStep(3, "Based on the feature flag value table, read OccupancySensorType attribute from DUT"), - TestStep(4, "If TH reads 0 - PIR, TH reads PIROccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime"), - TestStep(5, "If TH reads 1 - Ultrasonic, TH reads UltrasonicOccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime"), - TestStep(6, "If TH reads 2 - PHY, TH reads PhysicalContactOccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime") - ] - return steps - - def pics_TC_OCC_2_3(self) -> list[str]: - pics = [ - "OCC.S", - ] - return pics - - @async_test_body - async def test_TC_OCC_2_3(self): - - endpoint = self.user_params.get("endpoint", 1) - - self.step(1) - attributes = Clusters.OccupancySensing.Attributes - attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) - - self.step(2) - if attributes.HoldTime.attribute_id in attribute_list: - occupancy_hold_time_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTime) - else: - logging.info("No HoldTime attribute supports. Terminate this test case") - - self.step(3) - if attributes.OccupancySensorType.attribute_id in attribute_list: - occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) - - asserts.assert_less_equal(occupancy_sensor_type_dut, 3, "OccupancySensorType attribute is out of range") - asserts.assert_greater_equal(occupancy_sensor_type_dut, 0, "OccupancySensorType attribute is out of range") - else: - logging.info("OccupancySensorType attribute doesn't exist. Test step skipped") - - if occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPir: - self.step(4) - occupancy_pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) - - asserts.assert_equal(occupancy_pir_otou_delay_dut, occupancy_hold_time_dut, - "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") - self.skip_step(5) - self.skip_step(6) - - elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic: - self.step(4) - occupancy_pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) - - asserts.assert_equal(occupancy_pir_otou_delay_dut, occupancy_hold_time_dut, - "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") - self.step(5) - occupancy_us_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) - - asserts.assert_equal(occupancy_us_otou_delay_dut, occupancy_hold_time_dut, - "HoldTime attribute value is not equal to UltrasonicOccupiedToUnoccupiedDelay") - self.skip_step(6) - - elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic: - occupancy_pirus_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) - - asserts.assert_equal(occupancy_pirus_otou_delay_dut, occupancy_hold_time_dut, - "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") - - elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact: - self.skip_step(4) - self.skip_step(5) - self.step(6) - occupancy_phy_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) - - asserts.assert_equal(occupancy_phy_otou_delay_dut, occupancy_hold_time_dut, - "HoldTime attribute value is not equal to PhysicalContactOccupiedToUnoccupiedDelay") - else: - logging.info("OccupancySensorType attribute value is out of range") - - -if __name__ == "__main__": - default_matter_test_main() +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --endpoint 1 +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_OCC_2_3(MatterBaseTest): + async def read_occ_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.OccupancySensing + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + def desc_TC_OCC_2_3(self) -> str: + return "[TC-OCC-2.3] HoldTime Backward Compatibility Test with server as DUT" + + def steps_TC_OCC_2_3(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commission DUT to TH", is_commissioning=True), + TestStep(2, "DUT supports HoldTime attribute. If DUT doesn’t support it, then stop and exit this test case."), + TestStep(3, "Based on the feature flag value table, read OccupancySensorType attribute from DUT"), + TestStep(4, "If TH reads 0 - PIR, TH reads PIROccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime"), + TestStep(5, "If TH reads 1 - Ultrasonic, TH reads UltrasonicOccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime"), + TestStep(6, "If TH reads 2 - PHY, TH reads PhysicalContactOccupiedToUnoccupiedDelay attribute and its value should be same as HoldTime") + ] + return steps + + def pics_TC_OCC_2_3(self) -> list[str]: + pics = [ + "OCC.S", + ] + return pics + + @async_test_body + async def test_TC_OCC_2_3(self): + endpoint = self.matter_test_config.endpoint + + self.step(1) # Already done, immediately go to step 2 + + self.step(2) + + attributes = Clusters.OccupancySensing.Attributes + attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList) + + if attributes.HoldTime.attribute_id in attribute_list: + occupancy_hold_time_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTime) + else: + logging.info("No HoldTime attribute supports. Terminate this test case") + + self.step(3) + if attributes.OccupancySensorType.attribute_id in attribute_list: + occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType) + + asserts.assert_less_equal(occupancy_sensor_type_dut, 3, "OccupancySensorType attribute is out of range") + asserts.assert_greater_equal(occupancy_sensor_type_dut, 0, "OccupancySensorType attribute is out of range") + else: + logging.info("OccupancySensorType attribute doesn't exist. Test step skipped") + + if occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPir: + self.step(4) + occupancy_pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) + + asserts.assert_equal(occupancy_pir_otou_delay_dut, occupancy_hold_time_dut, + "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") + self.skip_step(5) + self.skip_step(6) + + elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic: + self.step(4) + occupancy_pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) + + asserts.assert_equal(occupancy_pir_otou_delay_dut, occupancy_hold_time_dut, + "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") + self.step(5) + occupancy_us_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) + + asserts.assert_equal(occupancy_us_otou_delay_dut, occupancy_hold_time_dut, + "HoldTime attribute value is not equal to UltrasonicOccupiedToUnoccupiedDelay") + self.skip_step(6) + + elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic: + occupancy_pirus_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay) + + asserts.assert_equal(occupancy_pirus_otou_delay_dut, occupancy_hold_time_dut, + "HoldTime attribute value is not equal to PIROccupiedToUnoccupiedDelay") + + elif occupancy_sensor_type_dut == Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact: + self.skip_step(4) + self.skip_step(5) + self.step(6) + occupancy_phy_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) + + asserts.assert_equal(occupancy_phy_otou_delay_dut, occupancy_hold_time_dut, + "HoldTime attribute value is not equal to PhysicalContactOccupiedToUnoccupiedDelay") + else: + logging.info("OccupancySensorType attribute value is out of range") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OCC_3_1.py b/src/python_testing/TC_OCC_3_1.py index 3fd082a62bc974..246e3a13f2a211 100644 --- a/src/python_testing/TC_OCC_3_1.py +++ b/src/python_testing/TC_OCC_3_1.py @@ -1,134 +1,129 @@ -# -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. -# -# 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. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --endpoint 1 -# === END CI TEST ARGUMENTS === -# There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for -# the occupancy state ON/OFF change. -# [TC-OCC-3.1] test procedure step 4 -# [TC-OCC-3.2] test precedure step 3c - -import logging -import time -from typing import Any, Optional - -import chip.clusters as Clusters -from chip.interaction_model import Status -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts - - -class TC_OCC_3_1(MatterBaseTest): - async def read_occ_attribute_expect_success(self, attribute): - cluster = Clusters.Objects.OccupancySensing - endpoint = self.matter_test_config.endpoint - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) - - async def write_hold_time(self, hold_time: Optional[Any]) -> Status: - dev_ctrl = self.default_controller - node_id = self.dut_node_id - endpoint = self.matter_test_config.endpoint - - cluster = Clusters.OccupancySensing - write_result = await dev_ctrl.WriteAttribute(node_id, [(endpoint, cluster.Attributes.HoldTime(hold_time))]) - return write_result[0].Status - - def desc_TC_OCC_3_1(self) -> str: - return "[TC-OCC-3.1] Primary functionality with server as DUT" - - def steps_TC_OCC_3_1(self) -> list[TestStep]: - steps = [ - TestStep(1, "Commission DUT to TH and obtain DUT attribute list.", is_commissioning=True), - TestStep(2, "Change DUT HoldTime attribute value to 10 seconds."), - TestStep(3, "Do not trigger DUT occupancy sensing for the period of HoldTime. TH reads Occupancy attribute from DUT."), - TestStep(4, "Trigger DUT occupancy sensing to change the occupancy state and start a timer."), - TestStep(5, "After 10 seconds, TH reads Occupancy attribute from DUT.") - ] - return steps - - def pics_TC_OCC_3_1(self) -> list[str]: - pics = [ - "OCC.S", - ] - return pics - - @async_test_body - async def test_TC_OCC_3_1(self): - hold_time = 10 # 10 seconds for occupancy state hold time - - self.step(1) # commissioning and getting cluster attribute list - cluster = Clusters.OccupancySensing - attributes = cluster.Attributes - attribute_list = await self.read_occ_attribute_expect_success(attribute=attributes.AttributeList) - - has_hold_time = attributes.HoldTime.attribute_id in attribute_list - - self.step(2) - if has_hold_time: - # write 10 as a HoldTime attribute - await self.write_single_attribute(cluster.Attributes.HoldTime(hold_time)) - else: - logging.info("No HoldTime attribute supports. Will test only occupancy attribute triggering functionality") - - self.step(3) - # check if Occupancy attribute is 0 - occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) - - # if occupancy is on, then wait until the sensor occupancy state is 0. - if occupancy_dut == 1: - # Don't trigger occupancy sensor to render occupancy attribute to 0 - if has_hold_time: - time.sleep(hold_time + 2.0) # add some extra 2 seconds to ensure hold time has passed. - else: # a user wait until a sensor specific time to change occupancy attribute to 0. This is the case where the sensor doesn't support HoldTime. - self.wait_for_user_input( - prompt_msg="Type any letter and press ENTER after the sensor occupancy is detection ready state (occupancy attribute = 0)") - - # check sensor occupancy state is 0 for the next test step - occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) - asserts.assert_equal(occupancy_dut, 0, "Occupancy attribute is still 1.") - - self.step(4) - # Trigger occupancy sensor to change Occupancy attribute value to 1 => TESTER ACTION on DUT - self.wait_for_user_input(prompt_msg="Type any letter and press ENTER after a sensor occupancy is triggered.") - - # And then check if Occupancy attribute has changed. - occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) - asserts.assert_equal(occupancy_dut, 1, "Occupancy state is not changed to 1") - - self.step(5) - # check if Occupancy attribute is back to 0 after HoldTime attribute period - # Tester should not be triggering the sensor for this test step. - if has_hold_time: - - # Start a timer based on HoldTime - time.sleep(hold_time + 2.0) # add some extra 2 seconds to ensure hold time has passed. - - occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) - asserts.assert_equal(occupancy_dut, 0, "Occupancy state is not 0 after HoldTime period") - - else: - logging.info("HoldTime attribute not supported. Skip this return to 0 timing test procedure.") - self.skip_step(5) - - -if __name__ == "__main__": - default_matter_test_main() +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +# There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for +# the occupancy state ON/OFF change. +# [TC-OCC-3.1] test procedure step 4 +# [TC-OCC-3.2] test precedure step 3c + +import logging +import time +from typing import Any, Optional + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_OCC_3_1(MatterBaseTest): + async def read_occ_attribute_expect_success(self, attribute): + cluster = Clusters.Objects.OccupancySensing + endpoint = self.matter_test_config.endpoint + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def write_hold_time(self, hold_time: Optional[Any]) -> Status: + dev_ctrl = self.default_controller + node_id = self.dut_node_id + endpoint = self.matter_test_config.endpoint + + cluster = Clusters.OccupancySensing + write_result = await dev_ctrl.WriteAttribute(node_id, [(endpoint, cluster.Attributes.HoldTime(hold_time))]) + return write_result[0].Status + + def desc_TC_OCC_3_1(self) -> str: + return "[TC-OCC-3.1] Primary functionality with server as DUT" + + def steps_TC_OCC_3_1(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commission DUT to TH and obtain DUT attribute list.", is_commissioning=True), + TestStep(2, "Change DUT HoldTime attribute value to 10 seconds."), + TestStep(3, "Do not trigger DUT occupancy sensing for the period of HoldTime. TH reads Occupancy attribute from DUT."), + TestStep(4, "Trigger DUT occupancy sensing to change the occupancy state and start a timer."), + TestStep(5, "After 10 seconds, TH reads Occupancy attribute from DUT.") + ] + return steps + + def pics_TC_OCC_3_1(self) -> list[str]: + pics = [ + "OCC.S", + ] + return pics + + @async_test_body + async def test_TC_OCC_3_1(self): + hold_time = 10 # 10 seconds for occupancy state hold time + + self.step(1) # Commissioning already done + + self.step(2) + + cluster = Clusters.OccupancySensing + attributes = cluster.Attributes + attribute_list = await self.read_occ_attribute_expect_success(attribute=attributes.AttributeList) + + has_hold_time = attributes.HoldTime.attribute_id in attribute_list + + if has_hold_time: + # write 10 as a HoldTime attribute + await self.write_single_attribute(cluster.Attributes.HoldTime(hold_time)) + else: + logging.info("No HoldTime attribute supports. Will test only occupancy attribute triggering functionality") + + self.step(3) + # check if Occupancy attribute is 0 + occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) + + # if occupancy is on, then wait until the sensor occupancy state is 0. + if occupancy_dut == 1: + # Don't trigger occupancy sensor to render occupancy attribute to 0 + if has_hold_time: + time.sleep(hold_time + 2.0) # add some extra 2 seconds to ensure hold time has passed. + else: # a user wait until a sensor specific time to change occupancy attribute to 0. This is the case where the sensor doesn't support HoldTime. + self.wait_for_user_input( + prompt_msg="Type any letter and press ENTER after the sensor occupancy is detection ready state (occupancy attribute = 0)") + + # check sensor occupancy state is 0 for the next test step + occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) + asserts.assert_equal(occupancy_dut, 0, "Occupancy attribute is still 1.") + + self.step(4) + # Trigger occupancy sensor to change Occupancy attribute value to 1 => TESTER ACTION on DUT + self.wait_for_user_input(prompt_msg="Type any letter and press ENTER after a sensor occupancy is triggered.") + + # And then check if Occupancy attribute has changed. + occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) + asserts.assert_equal(occupancy_dut, 1, "Occupancy state is not changed to 1") + + self.step(5) + # check if Occupancy attribute is back to 0 after HoldTime attribute period + # Tester should not be triggering the sensor for this test step. + if has_hold_time: + + # Start a timer based on HoldTime + time.sleep(hold_time + 2.0) # add some extra 2 seconds to ensure hold time has passed. + + occupancy_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) + asserts.assert_equal(occupancy_dut, 0, "Occupancy state is not 0 after HoldTime period") + + else: + logging.info("HoldTime attribute not supported. Skip this return to 0 timing test procedure.") + self.skip_step(5) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OCC_3_2.py b/src/python_testing/TC_OCC_3_2.py index 7e811362e2e2a4..64a588b6eb36e8 100644 --- a/src/python_testing/TC_OCC_3_2.py +++ b/src/python_testing/TC_OCC_3_2.py @@ -1,207 +1,204 @@ -# -# Copyright (c) 2024 Project CHIP (Matter) Authors -# All rights reserved. -# -# 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. -# -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --endpoint 1 -# === END CI TEST ARGUMENTS === - -# TODO: There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for -# the occupancy state ON/OFF change. -# [TC-OCC-3.1] test procedure step 4 -# [TC-OCC-3.2] test precedure step 3a, 3c - -import logging - -import chip.clusters as Clusters -from matter_testing_support import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, async_test_body, - await_sequence_of_reports, default_matter_test_main) -from mobly import asserts - - -class TC_OCC_3_2(MatterBaseTest): - async def read_occ_attribute_expect_success(self, attribute): - cluster = Clusters.Objects.OccupancySensing - endpoint_id = self.matter_test_config.endpoint - return await self.read_single_attribute_check_success(endpoint=endpoint_id, cluster=cluster, attribute=attribute) - - def desc_TC_OCC_3_2(self) -> str: - return "[TC-OCC-3.2] Subscription Report Verification with server as DUT" - - def steps_TC_OCC_3_2(self) -> list[TestStep]: - steps = [ - TestStep(1, "Commission DUT to TH if not already done", is_commissioning=True), - TestStep(2, "TH establishes a wildcard subscription to all attributes on Occupancy Sensing Cluster on the endpoint under test. Subscription min interval = 0 and max interval = 30 seconds."), - TestStep("3a", "Do not trigger DUT for occupancy state change."), - TestStep("3b", "TH reads DUT Occupancy attribute and saves the initial value as initial"), - TestStep("3c", "Trigger DUT to change the occupancy state."), - TestStep("3d", "TH awaits a ReportDataMessage containing an attribute report for DUT Occupancy attribute."), - TestStep("4a", "Check if DUT supports HoldTime attribute, If not supported, then stop and skip the rest of test cases."), - TestStep("4b", "TH reads DUT HoldTime attribute and saves the initial value as initial"), - TestStep("4c", "TH writes a different value to DUT HoldTime attribute."), - TestStep("4d", "TH awaits a ReportDataMessage containing an attribute report for DUT HoldTime attribute."), - TestStep("5a", "Check if DUT supports DUT feature flag PIR or OTHER, If not supported, then stop and skip to 6a."), - TestStep("5b", "TH reads DUT PIROccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), - TestStep("5c", "TH writes a different value to DUT PIROccupiedToUnoccupiedDelay attribute."), - TestStep("5d", "TH awaits a ReportDataMessage containing an attribute report for DUT PIROccupiedToUnoccupiedDelay attribute."), - TestStep("6a", "Check if DUT supports DUT feature flag US, If not supported, then stop and skip to 7a."), - TestStep("6b", "TH reads DUT UltrasonicOccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), - TestStep("6c", "TH writes a different value to DUT UltrasonicOccupiedToUnoccupiedDelay attribute."), - TestStep("6d", "TH awaits a ReportDataMessage containing an attribute report for DUT UltrasonicOccupiedToUnoccupiedDelay attribute."), - TestStep("7a", "Check if DUT supports DUT feature flag PHY, If not supported, terminate this test case."), - TestStep("7b", "TH reads DUT PhysicalContactOccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), - TestStep("7c", "TH writes a different value to DUT PhysicalContactOccupiedToUnoccupiedDelay attribute."), - TestStep("7d", "TH awaits a ReportDataMessage containing an attribute report for DUT PhysicalContactOccupiedToUnoccupiedDelay attribute.") - ] - return steps - - def pics_TC_OCC_3_2(self) -> list[str]: - pics = [ - "OCC.S", - ] - return pics - - @async_test_body - async def test_TC_OCC_3_2(self): - endpoint_id = self.matter_test_config.endpoint - node_id = self.dut_node_id - dev_ctrl = self.default_controller - - post_prompt_settle_delay_seconds = 10.0 - cluster = Clusters.Objects.OccupancySensing - attributes = cluster.Attributes - - self.step(1) - - occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(attribute=attributes.OccupancySensorTypeBitmap) - has_type_pir = ((occupancy_sensor_type_bitmap_dut & cluster.Enums.OccupancySensorTypeEnum.kPir) != 0) or \ - ((occupancy_sensor_type_bitmap_dut & cluster.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic) != 0) - has_type_ultrasonic = ((occupancy_sensor_type_bitmap_dut & cluster.Enums.OccupancySensorTypeEnum.kUltrasonic) != 0) or \ - ((occupancy_sensor_type_bitmap_dut & cluster.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic) != 0) - has_type_contact = (occupancy_sensor_type_bitmap_dut & cluster.Enums.OccupancySensorTypeEnum.kPhysicalContact) != 0 - - attribute_list = await self.read_occ_attribute_expect_success(attribute=attributes.AttributeList) - has_pir_timing_attrib = attributes.PIROccupiedToUnoccupiedDelay.attribute_id in attribute_list - has_ultrasonic_timing_attrib = attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list - has_contact_timing_attrib = attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list - - self.step(2) - # min interval = 0, and max interval = 30 seconds - attrib_listener = ClusterAttributeChangeAccumulator(Clusters.Objects.OccupancySensing) - await attrib_listener.start(dev_ctrl, node_id, endpoint=endpoint_id, min_interval_sec=0, max_interval_sec=30) - - # TODO - Will add Namepiped to assimilate the manual sensor untrigger here - self.step("3a") - self.wait_for_user_input(prompt_msg="Type any letter and press ENTER after DUT goes back to unoccupied state.") - - self.step("3b") - if attributes.Occupancy.attribute_id in attribute_list: - initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) - asserts.assert_equal(initial_dut, 0, "Occupancy attribute is still detected state") - - # TODO - Will add Namepiped to assimilate the manual sensor trigger here - self.step("3c") - self.wait_for_user_input( - prompt_msg="Type any letter and press ENTER after the sensor occupancy is triggered and its occupancy state changed.") - - self.step("3d") - await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.Occupancy, sequence=[ - 0, 1], timeout_sec=post_prompt_settle_delay_seconds) - - self.step("4a") - if attributes.HoldTime.attribute_id not in attribute_list: - logging.info("No HoldTime attribute supports. Terminate this test case") - self.skip_all_remaining_steps("4b") - - self.step("4b") - initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.HoldTime) - - self.step("4c") - # write a different a HoldTime attribute value - diff_val = 12 - await self.write_single_attribute(attributes.HoldTime(diff_val)) - - self.step("4d") - await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.HoldTime, sequence=[ - initial_dut, diff_val], timeout_sec=post_prompt_settle_delay_seconds) - - self.step("5a") - if not has_type_pir or not has_pir_timing_attrib: - logging.info("No PIR timing attribute support. Skip this steps 5b, 5c, 5d") - self.skip_step("5b") - self.skip_step("5c") - self.skip_step("5d") - else: - self.step("5b") - initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.PIROccupiedToUnoccupiedDelay) - - self.step("5c") - # write the new attribute value - diff_val = 11 - await self.write_single_attribute(attributes.PIROccupiedToUnoccupiedDelay(diff_val)) - - self.step("5d") - await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.PIROccupiedToUnoccupiedDelay, sequence=[ - initial_dut, diff_val], timeout_sec=post_prompt_settle_delay_seconds) - - self.step("6a") - if not has_type_ultrasonic or not has_ultrasonic_timing_attrib: - logging.info("No Ultrasonic timing attribute supports. Skip steps 6b, 6c, 6d") - self.skip_step("6b") - self.skip_step("6c") - self.skip_step("6d") - else: - self.step("6b") - initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) - - self.step("6c") - # write the new attribute value - diff_val = 14 - await self.write_single_attribute(attributes.UltrasonicOccupiedToUnoccupiedDelay(diff_val)) - - self.step("6d") - await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.UltrasonicOccupiedToUnoccupiedDelay, sequence=[ - initial_dut, diff_val], timeout_sec=post_prompt_settle_delay_seconds) - - self.step("7a") - if not has_type_contact or not has_contact_timing_attrib: - logging.info("No Physical contact timing attribute supports. Skip this test case") - self.skip_step("7b") - self.skip_step("7c") - self.skip_step("7d") - else: - self.step("7b") - initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) - - self.step("7c") - # write the new attribute value - diff_val = 9 - await self.write_single_attribute(attributes.PhysicalContactOccupiedToUnoccupiedDelay(diff_val)) - - self.step("7d") - await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.PhysicalContactOccupiedToUnoccupiedDelay, sequence=[ - initial_dut, diff_val], timeout_sec=post_prompt_settle_delay_seconds) - - -if __name__ == "__main__": - default_matter_test_main() +# +# Copyright (c) 2024 Project CHIP (Matter) Authors +# All rights reserved. +# +# 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. +# + +# TODO: There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for +# the occupancy state ON/OFF change. +# [TC-OCC-3.1] test procedure step 4 +# [TC-OCC-3.2] test precedure step 3a, 3c + +import logging + +import chip.clusters as Clusters +from matter_testing_support import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, async_test_body, + await_sequence_of_reports, default_matter_test_main) +from mobly import asserts + + +class TC_OCC_3_2(MatterBaseTest): + async def read_occ_attribute_expect_success(self, attribute): + cluster = Clusters.Objects.OccupancySensing + endpoint_id = self.matter_test_config.endpoint + return await self.read_single_attribute_check_success(endpoint=endpoint_id, cluster=cluster, attribute=attribute) + + def desc_TC_OCC_3_2(self) -> str: + return "[TC-OCC-3.2] Subscription Report Verification with server as DUT" + + def steps_TC_OCC_3_2(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commission DUT to TH if not already done", is_commissioning=True), + TestStep(2, "TH establishes a wildcard subscription to all attributes on Occupancy Sensing Cluster on the endpoint under test. Subscription min interval = 0 and max interval = 30 seconds."), + TestStep("3a", "Do not trigger DUT for occupancy state change."), + TestStep("3b", "TH reads DUT Occupancy attribute and saves the initial value as initial"), + TestStep("3c", "Trigger DUT to change the occupancy state."), + TestStep("3d", "TH awaits a ReportDataMessage containing an attribute report for DUT Occupancy attribute."), + TestStep("4a", "Check if DUT supports HoldTime attribute, If not supported, then stop and skip the rest of test cases."), + TestStep("4b", "TH reads DUT HoldTime attribute and saves the initial value as initial"), + TestStep("4c", "TH writes a different value to DUT HoldTime attribute."), + TestStep("4d", "TH awaits a ReportDataMessage containing an attribute report for DUT HoldTime attribute."), + TestStep("5a", "Check if DUT supports DUT feature flag PIR or (!PIR & !US & !PHY) and has the PIROccupiedToUnoccupiedDelay attribute, If not supported, then skip 5b, 5c, 5d."), + TestStep("5b", "TH reads DUT PIROccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), + TestStep("5c", "TH writes a different value to DUT PIROccupiedToUnoccupiedDelay attribute."), + TestStep("5d", "TH awaits a ReportDataMessage containing an attribute report for DUT PIROccupiedToUnoccupiedDelay attribute."), + TestStep("6a", "Check if DUT supports DUT feature flag US and has the UltrasonicOccupiedToUnoccupiedDelay attribute. If not supported, then skip 6b, 6c, 6d."), + TestStep("6b", "TH reads DUT UltrasonicOccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), + TestStep("6c", "TH writes a different value to DUT UltrasonicOccupiedToUnoccupiedDelay attribute."), + TestStep("6d", "TH awaits a ReportDataMessage containing an attribute report for DUT UltrasonicOccupiedToUnoccupiedDelay attribute."), + TestStep("7a", "Check if DUT supports DUT feature flag PHY and has the PhysicalContactOccupiedToUnoccupiedDelay attribute. If not supported, skip 7b, 7c, 7d."), + TestStep("7b", "TH reads DUT PhysicalContactOccupiedToUnoccupiedDelay attribute and saves the initial value as initial"), + TestStep("7c", "TH writes a different value to DUT PhysicalContactOccupiedToUnoccupiedDelay attribute."), + TestStep("7d", "TH awaits a ReportDataMessage containing an attribute report for DUT PhysicalContactOccupiedToUnoccupiedDelay attribute.") + ] + return steps + + def pics_TC_OCC_3_2(self) -> list[str]: + pics = [ + "OCC.S", + ] + return pics + + @async_test_body + async def test_TC_OCC_3_2(self): + endpoint_id = self.matter_test_config.endpoint + node_id = self.dut_node_id + dev_ctrl = self.default_controller + + post_prompt_settle_delay_seconds = 10.0 + cluster = Clusters.Objects.OccupancySensing + attributes = cluster.Attributes + + self.step(1) # Commissioning already done + + self.step(2) + feature_map = await self.read_occ_attribute_expect_success(attribute=attributes.FeatureMap) + has_feature_pir = (feature_map & cluster.Bitmaps.Feature.kPassiveInfrared) != 0 + has_feature_ultrasonic = (feature_map & cluster.Bitmaps.Feature.kUltrasonic) != 0 + has_feature_contact = (feature_map & cluster.Bitmaps.Feature.kPhysicalContact) != 0 + + logging.info( + f"Feature map: 0x{feature_map:x}. PIR: {has_feature_pir}, US:{has_feature_ultrasonic}, PHY:{has_feature_contact}") + + attribute_list = await self.read_occ_attribute_expect_success(attribute=attributes.AttributeList) + has_pir_timing_attrib = attributes.PIROccupiedToUnoccupiedDelay.attribute_id in attribute_list + has_ultrasonic_timing_attrib = attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list + has_contact_timing_attrib = attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list + logging.info(f"Attribute list: {attribute_list}") + logging.info(f"--> Has PIROccupiedToUnoccupiedDelay: {has_pir_timing_attrib}") + logging.info(f"--> Has UltrasonicOccupiedToUnoccupiedDelay: {has_ultrasonic_timing_attrib}") + logging.info(f"--> Has PhysicalContactOccupiedToUnoccupiedDelay: {has_contact_timing_attrib}") + + # min interval = 0, and max interval = 30 seconds + attrib_listener = ClusterAttributeChangeAccumulator(Clusters.Objects.OccupancySensing) + await attrib_listener.start(dev_ctrl, node_id, endpoint=endpoint_id, min_interval_sec=0, max_interval_sec=30) + + # TODO - Will add Namepiped to assimilate the manual sensor untrigger here + self.step("3a") + self.wait_for_user_input(prompt_msg="Type any letter and press ENTER after DUT goes back to unoccupied state.") + + self.step("3b") + if attributes.Occupancy.attribute_id in attribute_list: + initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.Occupancy) + asserts.assert_equal(initial_dut, 0, "Occupancy attribute is still detected state") + + # TODO - Will add Namepiped to assimilate the manual sensor trigger here + self.step("3c") + self.wait_for_user_input( + prompt_msg="Type any letter and press ENTER after the sensor occupancy is triggered and its occupancy state changed.") + + self.step("3d") + await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.Occupancy, sequence=[ + 1], timeout_sec=post_prompt_settle_delay_seconds) + + self.step("4a") + if attributes.HoldTime.attribute_id not in attribute_list: + logging.info("No HoldTime attribute supports. Terminate this test case") + self.skip_all_remaining_steps("4b") + + self.step("4b") + initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.HoldTime) + + self.step("4c") + # write a different a HoldTime attribute value + diff_val = 12 + await self.write_single_attribute(attributes.HoldTime(diff_val)) + + self.step("4d") + await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.HoldTime, sequence=[ + diff_val], timeout_sec=post_prompt_settle_delay_seconds) + + self.step("5a") + + has_no_legacy_features = ((not has_feature_pir) and (not has_feature_ultrasonic) and (not has_feature_contact)) + + if has_pir_timing_attrib and (has_feature_pir or has_no_legacy_features): + self.step("5b") + initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.PIROccupiedToUnoccupiedDelay) + + self.step("5c") + # write the new attribute value + diff_val = 11 + await self.write_single_attribute(attributes.PIROccupiedToUnoccupiedDelay(diff_val)) + + self.step("5d") + await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.PIROccupiedToUnoccupiedDelay, sequence=[ + diff_val], timeout_sec=post_prompt_settle_delay_seconds) + else: + logging.info("No PIR timing attribute support. Skipping steps 5b, 5c, 5d") + self.skip_step("5b") + self.skip_step("5c") + self.skip_step("5d") + + self.step("6a") + if not has_feature_ultrasonic or not has_ultrasonic_timing_attrib: + logging.info("No Ultrasonic timing attribute supports. Skipping steps 6b, 6c, 6d") + self.skip_step("6b") + self.skip_step("6c") + self.skip_step("6d") + else: + self.step("6b") + initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay) + + self.step("6c") + # write the new attribute value + diff_val = 14 + await self.write_single_attribute(attributes.UltrasonicOccupiedToUnoccupiedDelay(diff_val)) + + self.step("6d") + await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.UltrasonicOccupiedToUnoccupiedDelay, sequence=[ + diff_val], timeout_sec=post_prompt_settle_delay_seconds) + + self.step("7a") + if not has_feature_contact or not has_contact_timing_attrib: + logging.info("No Physical contact timing attribute supports. Skipping steps 7b, 7c, 7d") + self.skip_step("7b") + self.skip_step("7c") + self.skip_step("7d") + else: + self.step("7b") + initial_dut = await self.read_occ_attribute_expect_success(attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay) + + self.step("7c") + # write the new attribute value + diff_val = 9 + await self.write_single_attribute(attributes.PhysicalContactOccupiedToUnoccupiedDelay(diff_val)) + + self.step("7d") + await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.PhysicalContactOccupiedToUnoccupiedDelay, sequence=[ + diff_val], timeout_sec=post_prompt_settle_delay_seconds) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index eb8a6ba20d63b9..d3d810149ce5dd 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -334,6 +334,15 @@ def wait_for_report(self): asserts.fail(f"[AttributeChangeCallback] Attribute {self._expected_attribute} not found in returned report") +def clear_queue(report_queue: queue.Queue): + """Flush all contents of a report queue. Useful to get back to empty point.""" + while not report_queue.empty(): + try: + report_queue.get(block=False) + except queue.Empty: + break + + def await_sequence_of_reports(report_queue: queue.Queue, endpoint_id: int, attribute: TypedAttributePath, sequence: list[Any], timeout_sec: float): """Given a queue.Queue hooked-up to an attribute change accumulator, await a given expected sequence of attribute reports. @@ -344,6 +353,9 @@ def await_sequence_of_reports(report_queue: queue.Queue, endpoint_id: int, attri - sequence: list of attribute values in order that are expected. - timeout_sec: number of seconds to wait for. + *** WARNING: The queue contains every report since the sub was established. Use + clear_queue to make it empty. *** + This will fail current Mobly test with assertion failure if the data is not as expected in order. Returns nothing on success so the test can go on. @@ -446,6 +458,20 @@ def attribute_report_counts(self) -> dict[ClusterObjects.ClusterAttributeDescrip def attribute_reports(self) -> dict[ClusterObjects.ClusterAttributeDescriptor, AttributeValue]: return self._attribute_reports + def get_last_report(self) -> Optional[Any]: + """Flush entire queue, returning last (newest) report only.""" + last_report: Optional[Any] = None + while True: + try: + last_report = self._q.get(block=False) + except queue.Empty: + return last_report + + def flush_reports(self) -> None: + """Flush entire queue, returning nothing.""" + _ = self.get_last_report() + return + class InternalTestRunnerHooks(TestRunnerHooks): From 010d9821daceb60e601c5174986cb648e62705d1 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 23 Aug 2024 07:46:55 +0100 Subject: [PATCH 36/53] Remove DuplicatedAreas error (#35126) * Removed the DuplicatedAreas error from the XML * Generated code after XML update. * The service are server ignores any duplicate values before calling the delegate. Example was updated accodingly. * Updated test SEAR-1.3 following changes to the duplicated areas error. * Restyled by clang-format * Made select areas const. --------- Co-authored-by: Restyled.io --- .../include/rvc-service-area-delegate.h | 4 +- examples/rvc-app/rvc-common/rvc-app.matter | 5 +- .../src/rvc-service-area-delegate.cpp | 63 +++++------- .../service-area-delegate.h | 6 +- .../service-area-server.cpp | 99 ++++++++++--------- .../data-model/chip/service-area-cluster.xml | 5 +- .../data_model/controller-clusters.matter | 5 +- .../python/chip/clusters/Objects.py | 7 +- .../CHIP/zap-generated/MTRBaseClusters.h | 5 +- src/python_testing/TC_SEAR_1_3.py | 26 ++--- .../zap-generated/cluster-enums-check.h | 1 - .../app-common/zap-generated/cluster-enums.h | 7 +- 12 files changed, 108 insertions(+), 125 deletions(-) diff --git a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h index c6be8aa5bb55f0..a87d345cb506ba 100644 --- a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h @@ -79,8 +79,8 @@ class RvcServiceAreaDelegate : public Delegate // command support bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) override; - bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req, - ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override; + bool IsValidSelectAreasSet(const Span & selectedAreas, ServiceArea::SelectAreasStatus & areaStatus, + MutableCharSpan & statusText) override; bool HandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 29460e1f43c7a1..ee4d751919be22 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1438,9 +1438,8 @@ provisional cluster ServiceArea = 336 { enum SelectAreasStatus : enum8 { kSuccess = 0; kUnsupportedArea = 1; - kDuplicatedAreas = 2; - kInvalidInMode = 3; - kInvalidSet = 4; + kInvalidInMode = 2; + kInvalidSet = 3; } enum SkipAreaStatus : enum8 { diff --git a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp index 9041efd3d9105b..2f2594e17d7686 100644 --- a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp @@ -113,23 +113,12 @@ bool RvcServiceAreaDelegate::IsSetSelectedAreasAllowed(MutableCharSpan & statusT return (mIsSetSelectedAreasAllowedDeviceInstance->*mIsSetSelectedAreasAllowedCallback)(statusText); }; -bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & areaStatus, +bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Span & selectedAreas, SelectAreasStatus & areaStatus, MutableCharSpan & statusText) { - // if req is empty list return true. + if (selectedAreas.empty()) { - size_t reqSize; - if (req.newAreas.ComputeSize(&reqSize) != CHIP_NO_ERROR) - { - areaStatus = SelectAreasStatus::kInvalidSet; // todo Not sure this is the correct error to use here - CopyCharSpanToMutableCharSpan("error computing number of selected areas"_span, statusText); - return false; - } - - if (reqSize == 0) - { - return true; - } + return true; } // If there is 1 or 0 supported maps, any combination of areas is valid. @@ -139,42 +128,34 @@ bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas:: } // Check that all the requested areas are in the same map. - auto newAreasIter = req.newAreas.begin(); - newAreasIter.Next(); - - AreaStructureWrapper tempArea; - uint32_t ignoredIndex; - if (!GetSupportedAreaById(newAreasIter.GetValue(), ignoredIndex, tempArea)) { - areaStatus = SelectAreasStatus::kUnsupportedArea; - CopyCharSpanToMutableCharSpan("unable to find selected area in supported areas"_span, statusText); - return false; - } - - auto mapId = tempArea.mapID.Value(); // It is safe to call `.Value()` as we confirmed that there are at least 2 maps. - - while (newAreasIter.Next()) - { - if (!GetSupportedAreaById(newAreasIter.GetValue(), ignoredIndex, tempArea)) + AreaStructureWrapper tempArea; + uint32_t ignoredIndex; + if (!GetSupportedAreaById(selectedAreas[0], ignoredIndex, tempArea)) { areaStatus = SelectAreasStatus::kUnsupportedArea; CopyCharSpanToMutableCharSpan("unable to find selected area in supported areas"_span, statusText); return false; } - if (tempArea.mapID.Value() != mapId) + auto mapId = tempArea.mapID.Value(); // It is safe to call `.Value()` as we confirmed that there are at least 2 maps. + + for (const auto & areaId : selectedAreas.SubSpan(1)) { - areaStatus = SelectAreasStatus::kInvalidSet; - CopyCharSpanToMutableCharSpan("all selected areas must be in the same map"_span, statusText); - return false; - } - } + if (!GetSupportedAreaById(areaId, ignoredIndex, tempArea)) + { + areaStatus = SelectAreasStatus::kUnsupportedArea; + CopyCharSpanToMutableCharSpan("unable to find selected area in supported areas"_span, statusText); + return false; + } - if (CHIP_NO_ERROR != newAreasIter.GetStatus()) - { - areaStatus = SelectAreasStatus::kInvalidSet; - CopyCharSpanToMutableCharSpan("error processing new areas."_span, statusText); - return false; + if (tempArea.mapID.Value() != mapId) + { + areaStatus = SelectAreasStatus::kInvalidSet; + CopyCharSpanToMutableCharSpan("all selected areas must be in the same map"_span, statusText); + return false; + } + } } return true; diff --git a/src/app/clusters/service-area-server/service-area-delegate.h b/src/app/clusters/service-area-server/service-area-delegate.h index 2e9422840aa847..7fe40bb8fe16f4 100644 --- a/src/app/clusters/service-area-server/service-area-delegate.h +++ b/src/app/clusters/service-area-server/service-area-delegate.h @@ -80,10 +80,10 @@ class Delegate * If the set of locations is invalid, the locationStatus should be set to InvalidSet and * the statusText SHALL include a vendor-defined error description. * - * The caller of this method will ensure that there are no duplicates is the list + * The caller of this method will ensure that there are no duplicates in the list * and that all the locations in the set are valid supported locations. * - * @param[in] req List of new selected locations. + * @param[in] selectedAreas List of new selected locations. * @param[out] locationStatus Success if all checks pass, error code if failure. * @param[out] statusText text describing failure (see description above), size kMaxSizeStatusText. * @return true if success. @@ -91,7 +91,7 @@ class Delegate * @note If the SelectAreas command is allowed when the device is operating and the selected locations change to none, the * device must stop. */ - virtual bool IsValidSelectAreasSet(const Commands::SelectAreas::DecodableType & req, SelectAreasStatus & locationStatus, + virtual bool IsValidSelectAreasSet(const Span & selectedAreas, SelectAreasStatus & locationStatus, MutableCharSpan & statusText) = 0; /** diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index 2f2efceddd903d..4de8f942e0251d 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -240,64 +240,72 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select } } + uint32_t selectedAreasBuffer[kMaxNumSelectedAreas]; + auto selectedAreasSpan = Span(selectedAreasBuffer, kMaxNumSelectedAreas); + uint32_t numberOfSelectedAreas = 0; + + // Closure for checking if an area ID exists in the selectedAreasSpan + auto areaAlreadyExists = [&numberOfSelectedAreas, &selectedAreasSpan](uint32_t areaId) { + for (uint32_t i = 0; i < numberOfSelectedAreas; i++) + { + if (areaId == selectedAreasSpan[i]) + { + return true; + } + } + return false; + }; + // if number of selected locations in parameter matches number in attribute - the locations *might* be the same bool matchesCurrentSelectedAreas = (numberOfAreas == mDelegate->GetNumberOfSelectedAreas()); + // do as much parameter validation as we can if (numberOfAreas != 0) { - // do as much parameter validation as we can + uint32_t ignoredIndex = 0; + uint32_t oldSelectedArea; + auto iAreaIter = req.newAreas.begin(); + while (iAreaIter.Next()) { - uint32_t ignoredIndex = 0; - uint32_t oldSelectedArea; - uint32_t i = 0; - auto iAreaIter = req.newAreas.begin(); - while (iAreaIter.Next()) - { - uint32_t aSelectedArea = iAreaIter.GetValue(); + uint32_t selectedArea = iAreaIter.GetValue(); - // each item in this list SHALL match the AreaID field of an entry on the SupportedAreas attribute's list - // If the Status field is set to UnsupportedArea, the StatusText field SHALL be an empty string. - if (!IsSupportedArea(aSelectedArea)) - { - exitResponse(SelectAreasStatus::kUnsupportedArea, ""_span); - return; - } + // If aSelectedArea is already in selectedAreasSpan skip + if (areaAlreadyExists(selectedArea)) + { + continue; + } - // Checking for duplicate locations. - uint32_t j = 0; - auto jAreaIter = req.newAreas.begin(); - while (j < i) - { - jAreaIter.Next(); // Since j < i and i is valid, we can safely call Next() without checking the return value. - if (jAreaIter.GetValue() == aSelectedArea) - { - exitResponse(SelectAreasStatus::kDuplicatedAreas, ""_span); - return; - } - j += 1; - } + // each item in this list SHALL match the AreaID field of an entry on the SupportedAreas attribute's list + // If the Status field is set to UnsupportedArea, the StatusText field SHALL be an empty string. + if (!IsSupportedArea(selectedArea)) + { + exitResponse(SelectAreasStatus::kUnsupportedArea, ""_span); + return; + } - // check to see if parameter list and attribute still match - if (matchesCurrentSelectedAreas) + // check to see if parameter list and attribute still match + if (matchesCurrentSelectedAreas) + { + if (!mDelegate->GetSelectedAreaByIndex(ignoredIndex, oldSelectedArea) || (selectedArea != oldSelectedArea)) { - if (!mDelegate->GetSelectedAreaByIndex(ignoredIndex, oldSelectedArea) || (aSelectedArea != oldSelectedArea)) - { - matchesCurrentSelectedAreas = false; - } + matchesCurrentSelectedAreas = false; } - - i += 1; } - // after iterating with Next through DecodableType - check for failure - if (CHIP_NO_ERROR != iAreaIter.GetStatus()) - { - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); - return; - } + selectedAreasSpan[numberOfSelectedAreas] = selectedArea; + numberOfSelectedAreas += 1; + } + + // after iterating with Next through DecodableType - check for failure + if (CHIP_NO_ERROR != iAreaIter.GetStatus()) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; } } + selectedAreasSpan.reduce_size(numberOfSelectedAreas); + // If the newAreas field is the same as the value of the SelectedAreas attribute // the SelectAreasResponse command SHALL have the Status field set to Success and // the StatusText field MAY be supplied with a human-readable string or include an empty string. @@ -327,7 +335,7 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select // ask the device to handle SelectAreas Command // (note - locationStatusText to be filled out by delegated function for kInvalidInMode and InvalidSet) auto locationStatus = SelectAreasStatus::kSuccess; - if (!mDelegate->IsValidSelectAreasSet(req, locationStatus, delegateStatusText)) + if (!mDelegate->IsValidSelectAreasSet(selectedAreasSpan, locationStatus, delegateStatusText)) { exitResponse(locationStatus, delegateStatusText); return; @@ -342,11 +350,10 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select if (numberOfAreas != 0) { - auto locationIter = req.newAreas.begin(); uint32_t ignored; - while (locationIter.Next()) + for (uint32_t areaId : selectedAreasSpan) { - mDelegate->AddSelectedArea(locationIter.GetValue(), ignored); + mDelegate->AddSelectedArea(areaId, ignored); } } diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml index e4457c3745e2a7..8c2ba832c85604 100644 --- a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml @@ -63,9 +63,8 @@ limitations under the License. - - - + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index ede6f1117ed37f..1413833c1b14c7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6463,9 +6463,8 @@ provisional cluster ServiceArea = 336 { enum SelectAreasStatus : enum8 { kSuccess = 0; kUnsupportedArea = 1; - kDuplicatedAreas = 2; - kInvalidInMode = 3; - kInvalidSet = 4; + kInvalidInMode = 2; + kInvalidSet = 3; } enum SkipAreaStatus : enum8 { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 391765f3838e7b..9808b113f234b7 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -31358,14 +31358,13 @@ class OperationalStatusEnum(MatterIntEnum): class SelectAreasStatus(MatterIntEnum): kSuccess = 0x00 kUnsupportedArea = 0x01 - kDuplicatedAreas = 0x02 - kInvalidInMode = 0x03 - kInvalidSet = 0x04 + kInvalidInMode = 0x02 + kInvalidSet = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving an unknown # enum value. This specific value should never be transmitted. - kUnknownEnumValue = 5, + kUnknownEnumValue = 4, class SkipAreaStatus(MatterIntEnum): kSuccess = 0x00 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index c00233470f81d6..f15337ff56f41c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -19787,9 +19787,8 @@ typedef NS_ENUM(uint8_t, MTRServiceAreaOperationalStatus) { typedef NS_ENUM(uint8_t, MTRServiceAreaSelectAreasStatus) { MTRServiceAreaSelectAreasStatusSuccess MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRServiceAreaSelectAreasStatusUnsupportedArea MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRServiceAreaSelectAreasStatusDuplicatedAreas MTR_PROVISIONALLY_AVAILABLE = 0x02, - MTRServiceAreaSelectAreasStatusInvalidInMode MTR_PROVISIONALLY_AVAILABLE = 0x03, - MTRServiceAreaSelectAreasStatusInvalidSet MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRServiceAreaSelectAreasStatusInvalidInMode MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRServiceAreaSelectAreasStatusInvalidSet MTR_PROVISIONALLY_AVAILABLE = 0x03, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRServiceAreaSkipAreaStatus) { diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py index 2ea2e86b7d198d..867cdcbe234353 100644 --- a/src/python_testing/TC_SEAR_1_3.py +++ b/src/python_testing/TC_SEAR_1_3.py @@ -109,15 +109,17 @@ async def test_TC_SEAR_1_3(self): duplicated_areas = [valid_area_id, valid_area_id] - # FIXME need to check if this is the correct name of this status code - await self.send_cmd_select_areas_expect_response(step=3, new_areas=duplicated_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kDuplicatedAreas) + await self.send_cmd_select_areas_expect_response(step=3, new_areas=duplicated_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) - await self.send_cmd_select_areas_expect_response(step=4, new_areas=[], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + selected_areas = await self.read_selected_areas(step=4) + asserts.assert_true(selected_areas == [valid_area_id], "SelectedAreas should be empty") - selected_areas = await self.read_selected_areas(step=5) + await self.send_cmd_select_areas_expect_response(step=5, new_areas=[], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + + selected_areas = await self.read_selected_areas(step=6) asserts.assert_true(len(selected_areas) == 0, "SelectedAreas should be empty") - await self.send_cmd_select_areas_expect_response(step=6, new_areas=[invalid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kUnsupportedArea) + await self.send_cmd_select_areas_expect_response(step=8, new_areas=[invalid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kUnsupportedArea) if self.check_pics("SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"): test_step = "Manually intervene to put the device in a state that prevents it from executing the SelectAreas command" @@ -127,7 +129,7 @@ async def test_TC_SEAR_1_3(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - await self.send_cmd_select_areas_expect_response(step=8, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) + await self.send_cmd_select_areas_expect_response(step=10, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"): test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({supported_area_ids}) command" @@ -137,17 +139,17 @@ async def test_TC_SEAR_1_3(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - await self.send_cmd_select_areas_expect_response(step=10, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + await self.send_cmd_select_areas_expect_response(step=11, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) - selected_areas = await self.read_selected_areas(step=11) + selected_areas = await self.read_selected_areas(step=12) asserts.assert_true(len(selected_areas) == len(supported_area_ids), f"SelectedAreas({selected_areas}) should match SupportedAreas({supported_area_ids})") - await self.send_cmd_select_areas_expect_response(step=12, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + await self.send_cmd_select_areas_expect_response(step=13, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL") and self.check_pics("SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE"): test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({valid_area_id}) command, and put the device in a non-idle state" - self.print_step("13", test_step) + self.print_step("14", test_step) if self.is_ci: self.write_to_app_pipe('{"Name": "Reset"}') await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=1), endpoint=self.endpoint) @@ -155,9 +157,9 @@ async def test_TC_SEAR_1_3(self): self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") if self.check_pics("SEAR.S.F00"): - await self.send_cmd_select_areas_expect_response(step=14, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) + await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) else: - await self.send_cmd_select_areas_expect_response(step=14, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) + await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) if __name__ == "__main__": diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index f63782c221d827..90d399b8e6fde7 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2598,7 +2598,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ServiceArea::SelectArea { case EnumType::kSuccess: case EnumType::kUnsupportedArea: - case EnumType::kDuplicatedAreas: case EnumType::kInvalidInMode: case EnumType::kInvalidSet: return val; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index e78f8f4d064648..998a3c931b42b1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3825,14 +3825,13 @@ enum class SelectAreasStatus : uint8_t { kSuccess = 0x00, kUnsupportedArea = 0x01, - kDuplicatedAreas = 0x02, - kInvalidInMode = 0x03, - kInvalidSet = 0x04, + kInvalidInMode = 0x02, + kInvalidSet = 0x03, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 5, + kUnknownEnumValue = 4, }; // Enum for SkipAreaStatus From 79a6aa350f845ffd1746c43a2ddcbd6e831f8027 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 23 Aug 2024 03:55:01 -0400 Subject: [PATCH 37/53] Mark return types nullable in MTRDevice_XPC when nil can be returned. (#35152) --- src/darwin/Framework/CHIP/MTRDevice_XPC.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index bc3b0a6b26bc4b..85be0db3436df9 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -163,10 +163,10 @@ - (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(state, MTRDeviceState, MTRDeviceStateUnknown, getStateWithReply) MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(deviceCachePrimed, BOOL, NO, getDeviceCachePrimedWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedStartTime, NSDate *, nil, getEstimatedStartTimeWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedSubscriptionLatency, NSNumber *, nil, getEstimatedSubscriptionLatencyWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedStartTime, NSDate * _Nullable, nil, getEstimatedStartTimeWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedSubscriptionLatency, NSNumber * _Nullable, nil, getEstimatedSubscriptionLatencyWithReply) -typedef NSDictionary * readAttributeResponseType; +typedef NSDictionary * _Nullable readAttributeResponseType; MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(readAttributeWithEndpointID : (NSNumber *) endpointID clusterID : (NSNumber *) clusterID attributeID @@ -226,7 +226,7 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID // Not Supported via XPC //- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration completion:(MTRDeviceOpenCommissioningWindowHandler)completion; -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(clientDataKeys, NSArray *, nil, getClientDataKeysWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(clientDataKeys, NSArray * _Nullable, nil, getClientDataKeysWithReply) MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(clientDataForKey : (NSString *) key, id _Nullable, nil, clientDataForKey : key withReply) From 9462066993f3c4f7cbecb12832617c3a3b930af4 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 23 Aug 2024 04:23:38 -0400 Subject: [PATCH 38/53] check (#34998) --- src/python_testing/matter_testing_support.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index d3d810149ce5dd..4127ead64c3083 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -1838,6 +1838,14 @@ def whole_node_runner(self: MatterBaseTest, *args, **kwargs): EndpointCheckFunction = typing.Callable[[Clusters.Attribute.AsyncReadTransaction.ReadResponse, int], bool] +def get_cluster_from_attribute(attribute: ClusterObjects.ClusterAttributeDescriptor) -> ClusterObjects.Cluster: + return ClusterObjects.ALL_CLUSTERS[attribute.cluster_id] + + +def get_cluster_from_command(command: ClusterObjects.ClusterCommand) -> ClusterObjects.Cluster: + return ClusterObjects.ALL_CLUSTERS[command.cluster_id] + + def _has_cluster(wildcard, endpoint, cluster: ClusterObjects.Cluster) -> bool: try: return cluster in wildcard.attributes[endpoint] @@ -1870,7 +1878,7 @@ def has_cluster(cluster: ClusterObjects.ClusterObjectDescriptor) -> EndpointChec def _has_attribute(wildcard, endpoint, attribute: ClusterObjects.ClusterAttributeDescriptor) -> bool: - cluster = getattr(Clusters, attribute.__qualname__.split('.')[-3]) + cluster = get_cluster_from_attribute(attribute) try: attr_list = wildcard.attributes[endpoint][cluster][cluster.Attributes.AttributeList] return attribute.attribute_id in attr_list From aa3e9fcb48ee0d1d22448fd5296bdd8f80d482d4 Mon Sep 17 00:00:00 2001 From: Wang Qixiang <43193572+wqx6@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:39:40 +0800 Subject: [PATCH 39/53] minimal_mdns: Fix filter for Compressed Fabric Id when browsing operational nodes (#35063) * minimal_mdns: Fix filter for Compressed Fabric Id when browsing operational nodes * Add check for subtype number --- src/lib/dnssd/Resolver_ImplMinimalMdns.cpp | 12 +++++++++++- src/lib/shell/commands/Dns.cpp | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 8b2b30e3184291..8e913f2addb1c1 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -544,7 +544,17 @@ CHIP_ERROR MinMdnsResolver::BuildQuery(QueryBuilder & builder, const ActiveResol switch (data.type) { case DiscoveryType::kOperational: - qname = CheckAndAllocateQName(kOperationalServiceName, kOperationalProtocol, kLocalDomain); + if (data.filter.type == DiscoveryFilterType::kCompressedFabricId) + { + char subtypeStr[Common::kSubTypeMaxLength + 1]; + ReturnErrorOnFailure(MakeServiceSubtype(subtypeStr, sizeof(subtypeStr), data.filter)); + qname = CheckAndAllocateQName(subtypeStr, kSubtypeServiceNamePart, kOperationalServiceName, kOperationalProtocol, + kLocalDomain); + } + else + { + qname = CheckAndAllocateQName(kOperationalServiceName, kOperationalProtocol, kLocalDomain); + } break; case DiscoveryType::kCommissionableNode: if (data.filter.type == DiscoveryFilterType::kNone) diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index 18e0841dccce83..917f94f849d865 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -214,13 +214,23 @@ bool ParseSubType(int argc, char ** argv, Dnssd::DiscoveryFilter & filter) case 'C': filterType = Dnssd::DiscoveryFilterType::kCommissioningMode; break; + case 'I': + filterType = Dnssd::DiscoveryFilterType::kCompressedFabricId; + break; default: return false; } - uint16_t code; - VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code), false); - + uint64_t code = 0; + if (filterType == Dnssd::DiscoveryFilterType::kCompressedFabricId) + { + VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code, 16), false); + VerifyOrReturnValue(code != 0, false); + } + else + { + VerifyOrReturnError(ArgParser::ParseInt(subtype + 2, code), false); + } filter = Dnssd::DiscoveryFilter(filterType, code); return true; } From 085138295acd3af46931a8197d9e564dc11becac Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 23 Aug 2024 04:39:55 -0400 Subject: [PATCH 40/53] Docs re-organization (#34765) * Docs re-organization The second phase of the handbook involves linking over to the SDK docs from the handbook site. Before we do this, the SDK documentation needs a re-org and an update. This is a continuation of the re-org, following the platform updates. Remaining: Zap, tools, examples, IDs. Done in this PR: - remove API - this is a 4 year old design doc for a test dispatch system that was never implemented. This does not make sense to keep in the docs folder since it gives the incorrect impression that this system was implemented at some point. In reality, our testing is quite different and is decently well documented in the testing section. - rename discussion to product consideration. This contains only the ipv6 considerations doc, which isn't a discussion. Instead, we're going to use this location to land documents related to product considerations that affect matter, but are provided outside of the SDK, ex. required network stack support (current doc), and factory considerations (coming later) for things like DACs, individually provisioned values, QR codes, config options, certification declaration inclusion, DCL. - move designing cluster for testing and portability from testing to cluster design - it just makes more sense there. - Creating a tips and troubleshooting section to land small guides, move in avahi troubleshooting and guide around discovery from a host computer. - remove quick start guide - everything in here is outdated, we have a getting started guide and a readme that covers all the getting started material. Added references to that in the readme - * couple more refs * remove readme --- docs/QUICK_START.md | 52 ----- docs/README.md | 4 + docs/api/device_runner.md | 103 ---------- docs/api/device_runner_dispatch.md | 183 ------------------ docs/api/index.md | 7 - .../img/plant_uml_source.txt | 0 .../img/unit_testable_clusters.png | Bin .../unit_testable_clusters_all_classes.png | Bin .../img/unit_testable_clusters_context.png | Bin .../img/unit_testable_clusters_driver.png | Bin .../img/unit_testable_clusters_logic.png | Bin .../img/unit_testable_clusters_server.png | Bin docs/cluster_and_device_type_dev/index.md | 1 + .../unit_testing_clusters.md | 0 docs/getting_started/index.md | 1 - docs/guides/README.md | 56 ------ docs/guides/index.md | 4 - docs/index.md | 5 +- .../index.md | 0 .../lwip_ipv6.md | 0 docs/testing/index.md | 1 - docs/testing/integration_test_utilities.md | 7 +- .../discovery_from_a_host_computer.md | 0 docs/tips_and_troubleshooting/index.md | 8 + .../troubleshooting_avahi.md | 0 25 files changed, 19 insertions(+), 413 deletions(-) delete mode 100644 docs/QUICK_START.md delete mode 100644 docs/api/device_runner.md delete mode 100644 docs/api/device_runner_dispatch.md delete mode 100644 docs/api/index.md rename docs/{testing => cluster_and_device_type_dev}/img/plant_uml_source.txt (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters.png (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters_all_classes.png (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters_context.png (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters_driver.png (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters_logic.png (100%) rename docs/{testing => cluster_and_device_type_dev}/img/unit_testable_clusters_server.png (100%) rename docs/{testing => cluster_and_device_type_dev}/unit_testing_clusters.md (100%) delete mode 100644 docs/guides/README.md rename docs/{discussion => product_considerations}/index.md (100%) rename docs/{discussion => product_considerations}/lwip_ipv6.md (100%) rename docs/{getting_started => tips_and_troubleshooting}/discovery_from_a_host_computer.md (100%) create mode 100644 docs/tips_and_troubleshooting/index.md rename docs/{guides => tips_and_troubleshooting}/troubleshooting_avahi.md (100%) diff --git a/docs/QUICK_START.md b/docs/QUICK_START.md deleted file mode 100644 index d5d80703c5e61f..00000000000000 --- a/docs/QUICK_START.md +++ /dev/null @@ -1,52 +0,0 @@ -# Quick Start - -## Demo Overview - -The Matter reference implementation contains support for a number of examples -and platforms. - -## Wi-Fi Nodes - -|

Controller / Admin
|
Node
| Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [**chip-tool**](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) (Linux / Mac)
Includes docs for all the cluster commands supported
| **all-clusters-app**
  • [M5Stack](https://github.com/project-chip/connectedhomeip/blob/master/examples/all-clusters-app/esp32/README.md) (ESP)
  • [Linux](https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/linux) simulation | Use the command line tool on a laptop to pair with and control an embedded Wi-Fi platform. This demo supports the “all-clusters-app”, so it provides the basic onoff light test and more. | -| [**chip-repl**](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/README.md) | **all-clusters-app**
  • [M5Stack](https://github.com/project-chip/connectedhomeip/blob/master/examples/all-clusters-app/esp32/README.md) (ESP)
  • [Linux](https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/linux) simulation | Same as above, but uses the Python CHIP REPL as Controller Node. | - -## Thread Nodes - -Use one of the controllers listed above and then a Border Router and Node -combination listed below. - -|
    Border Router
    |
    Node
    | Description | -| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [**ot-br**](https://openthread.io/guides/border-router/build)
    Thread Border Router
  • RasPi
  • BeagleBone | **lighting-app**
  • [Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect/README.md)
  • [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nxp/k32w0/README.md)
  • [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/qpg)
  • [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/silabs/README.md) | The Lighting example is supported by many of the available Thread platforms. See the chip-tool controller instructions for how to actuate the light on/off cluster. | -| [**ot-br**](https://openthread.io/guides/border-router/build)
    Thread Border Router
  • RasPi
  • BeagleBone | **lock-app**
  • [Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nrfconnect/README.md)
  • [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/qpg)
  • [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/efr32/README.md)
  • [TI CC13x2x7](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/cc13x2x7_26x2x7/README.md) | The Lock example is supported by many of the available Thread and Wi-Fi platforms. | - -## Controllers - -### chip-tool - -This section summarizes how to run some common scenarios with the -[**chip-tool**](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) -controller. - -#### IP Pairing - -`chip-tool pairing onnetwork ${NODE_ID_TO_ASSIGN} 20202021` will use PASE over -IP to commission a device and assign `${NODE_ID_TO_ASSIGN}` (which must be a -decimal number or a 0x-prefixed hex number) as its node id. - -NOTE: On Linux, if the device is actually running after unit tests ran you have -to use `chip-tool pairing onnetwork desired-node-id 34567890`, because the unit -tests change the device configuration. - -NOTE: to run both the Node and Controller as separate processes on the same -Linux or Mac machine, build the all-clusters-app with Bluetooth LE disabled as -follows: - -`scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false` - -#### Automated CASE tests - -`chip-tool tests Test_TC_OO_1_1` will run a suite of tests that use CASE To -communicate with a paired `all-clusters-app` peer node. diff --git a/docs/README.md b/docs/README.md index e4ec9c8f3a5523..e5aad317e6d556 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,6 +2,10 @@ ## Building and Developing +- A quick start guide to building a demo application and controller is + available in the [Getting started](./getting_started/) guide +- A guide to new cluster and device type development is available in the + [New Cluster and Device Type Developement Guide](./cluster_and_device_type_dev/) - Documentation about building from the command line can be found in [the build guide](guides/BUILDING.md) - Documentation about running [cirque](https://github.com/openweave/cirque) diff --git a/docs/api/device_runner.md b/docs/api/device_runner.md deleted file mode 100644 index db9c5993eff6d8..00000000000000 --- a/docs/api/device_runner.md +++ /dev/null @@ -1,103 +0,0 @@ -# CHIP on-device testing - -_Requirements and high-level design_ - -## Background - -The ability to run tests on actual and emulated hardware is paramount in -embedded projects. CHIP is no exception. We want on-device testing to be a first -class goal of CHIP architecture. On-device testing requirements apply both to -Continuous Integration testing for main CHIP software stack development and to -eventual CHIP product certification. This document explores the requirements and -evaluates potential solutions. - -## Overview of requirements - -A good device test infrastructure is built on four pillars. - -### Pillar 1: Using a test framework - -A test framework provides a testing structure that developers can follow and -potentially reduces some of the burden of test setup and teardown (less -boilerplate). Support for state-oriented and asynchronous structuring of tests -would be beneficial. Many test frameworks leverage scripting languages such as -Python to simplify the quick development of tests and to leverage rich sets of -libraries for device/systems access and results generation. - -### Pillar 2: Dispatching tests - -Tests can run on lab machines or on the developer's local workstation. Tests can -be triggered manually by the developer or as a result of completion of a -changeset built on a continuous integration (CI) server. CHIP involves multiple -stakeholders, many of which will want to contribute to the testing efforts with -lab capacity. The infrastructure therefore must be prepared for -cross-organization test dispatch. - -To facilitate uniform dispatch of tests we will probably need a simple -request/response protocol. Potentially HTTPS based and RESTful. Due to the long -running nature of device tests the response for a test scheduling request could -be a test ID, not the test result. That ID could be used to query the test -status, subscribe for notifications on status changes and to pull the test -results. Core aspects of such a scheme include the conventions for request -artifacts contents and minimum expected results contents once the run is -complete. - -### Pillar 3: Interacting with devices - -The test host environment has to reset devices, flash images on them, issue -commands, monitor status and collect test results. It may also need to integrate -both virtual (simulated) and real devices together. This can at first be done in -an ad-hoc way per platform but eventually we can go into device access -abstraction, i.e. define a common device testing interface which CHIP-compliant -devices can expose. The test host has to be prepared for driving multiple -devices at the same time for a single test, e.g. for tests that check -communication between multiple devices. - -### Pillar 4: Collecting results - -Ideally, test results are output in standard formats and similar or analogous -results between different devices and tests are output the same way. This -ensures reusability of code that processes similar data while allowing -aggregation of results across different dimensions. Failed tests must propagate -errors from device platform layers all the way to the CHIP stack and present -errors and potential stack traces in a standard result format. As the purpose of -on-device tests is to capture bugs, it is important that the test outputs -highlight the failure reason(s) and developers don't have to browse through -thousands of lines of logs to find the one line that sheds light on why a test -failed. - -## Priorities - -In the spirit of CHIP's charter, it would be great to see something taking-off -as soon as possible, to support continuous testing of the evolving CHIP stack. -We could then improve on that first iteration, even if we have to throw away -some temporary concepts and code. - -Test dispatch (Pillar 2) arises as the highest priority, because all other -pillars can have ad-hoc solutions. The first need is an interface between a -CircleCI job and a test execution host at a participating organization. This -would enable dispatching tests to a variety of existing in-house infrastructure, -while retaining common request/response protocols to shield the CI system from -implementation details of each lab. - -The next most important goal is to provide a test framework (Pillar 1). With a -standard framework developers can start writing tests, even if those tests will -be device specific and of ad-hoc input and output format. The general structure -of tests will however be present and later the tests can be adapted to standard -interactions (Pillar 3) and result formats (Pillar 4). - -Specifying result formats (Pillar 4) for the most common outputs -(success/failure, failure reason, stack trace, memory and CPU usage time series, -pcaps of network traffic, etc.) will be an ongoing effort. The simplest output -formats can be specified together with the test framework. - -Lastly, we want to look into a common device interaction interface that would -enable reusing tests between different devices. - -## Baseline hardware platforms for CHIP - -The TSG is targeting the following platforms/boards for early bringup: - -- Nordic nRF52 board -- SiLabs `XXXX` board -- Espressif ESP32 `XXXX` board diff --git a/docs/api/device_runner_dispatch.md b/docs/api/device_runner_dispatch.md deleted file mode 100644 index fff2634b41a3fc..00000000000000 --- a/docs/api/device_runner_dispatch.md +++ /dev/null @@ -1,183 +0,0 @@ -# CHIP on-device test dispatch - -This document expands on and provides design for on-device test dispatch. The -CHIP on-device testing document states that dispatching should involve a HTTPS -based RESTful protocol that could be integrated with CircleCI. - -## Definitions - -**Test run**: Tests instantiation on a test host, consisting of host-side test -binaries and test scripts as well as one or more device-side binaries. - -**Test host**: A computing execution environment provided for the purposes of -running tests by a party participating in the scheme. - -## Scope - -The scope of this proposal is to support running tests against a known set of -canonical devices and platforms for the purposes of developing core common code -in the CHIP project GitHub repository. - -This proposal does not preclude a stakeholder running their own tests against -their own hardware or lab in any way they see fit. The goal is merely to provide -a common way for volunteer organizations to register test infrastructure and -dispatch capabilities to be used by the wider CHIP developer community. - -Authentication is not considered strictly part of the test dispatch protocol. -However it is mandated that some form of authentication takes place before any -of the test dispatch operations are issued. Throughout this document it is -assumed that proper authentication and authorization is ensured by the server -hosting the test dispatch service. - -## Objectives - -- **Provide a centralized API** for the dispatching of tests against - potentially distributed lab infrastructure, which CI systems (i.e. CircleCI) - or individual developers may not be directly configured to access. -- **Decouple test execution from the CI environment**, especially for tests - requiring complex setups, such as radio traffic capture. -- **Enable** common adoption of **aligned methodologies** for both - certification-style tests and development-support tests (pre/post-submit - testing in pull requests). - -### Certification or pre-certification tests - -Certification tests are required to have canonical test suite names. - -Here the host side test binaries and scripts are fixed and the device-side -binary can vary by device type. The objective of certification testing is to run -a known fixed set of tests against new and existing devices. Dispatching of -certification tests involves specifying the canonical test suite name and -providing the requisite arguments, such as device-side binary and device type. - -### Development support tests - -Development support test suites are required to have canonical names, but they -may, during execution, check-out the actual test script from a given PR, or from -the artifacts uploaded for the test job. - -The test is executed against a pull request and may target many device types. -Therefore, both host-side and device-side artifacts may vary and have to be -uploaded in the respective argument to test dispatch operation. Dispatching of -development support test suites therefore involves specifying a canonical test -suite name, the PR URL, pre-built artifacts (host side and device-side) and -optional test-specific arguments. - -### Common constraints for dispatch - -In order to support running tests, some common arguments are required to -determine during dispatch whether a given combination of targets can be -supported. - -These constraints include: - -- A canonical device type list to determine whether a target runner has all - the targets needed. (Note that new hardware developers may provide a - non-canonical device type for running their own certification on their own - lab. Canonical device types exist for development support tests.) -- An optional node ID (unique UUID) to force execution on a given registered - infrastructure for test purposes. - -Example of canonical test suite names: - -- RendezVousTest: loads binaries on HW, validates that assumptions about - RendezVous advertising payload are still valid. -- BasicCHIPRegression: loads binaries on HW, validates against regressions on - multiple axes of the test. Potentially runs updated tests scripts from the - PR itself. - -## Aggregator Dispatch Interface API - -We conceptualize an aggregator service where all the tests are sent to be -further dispatched to or pulled by participating infrastructure/lab providers. - -For the prototype phase the aggregator may be the same service that runs tests -as well, i.e. further dispatch/pull/registration may not happen in the -prototype. - -This is the API which CircleCI and individual test developers can use. There may -be other APIs (e.g. administrator API) to the aggregator that provide richer -functionality. For now we don't discuss those. The API for communication between -the aggregator and test labs is to be specified at a later time. - -The goal of decoupling dispatch from execution is to avoid coupling running the -tests to a given lab’s or organization’s infrastructure. The dispatch interface -API provides a separation of concerns of “what to run”/“what happened” versus -“how to run”/“where to run”. - -### Resources and operations - -/available_test_suites - Collection resource, all the canonical test suite -names. - -- GET gets the list of known canonical test suite names - -/dispatch - Collection resource, all the currently running test executions. - -- POST dispatches a new test, returning its URI with the test run identifier - 'job_id'. - Arguments - Canonical Test Suite name e.g. - "CHIP_basic_test_suite" - ZIP file upload of artifacts (device-side and, if - needed, host-side) - Some common required inputs (see section below) - - Test-suite-specific configuration/contents may also be provided for the test - suite executor to use. - Maximum time the client is willing to wait for - results (seconds) - In case of execution timed out, the test job would be - considered FAILED, due to time-out. - Maximum time the client is willing to - wait for test to start (seconds) - In case of time-out to dispatch, the test - job would be considered ABORTED in the results as opposed to FAILED - - Authentication requirements may cause a given requestor to be throttled by - internal logic. - -/status/ - Member resource, an individual test. - -- GET returns the status of the test: scheduled, running, finished, aborted. -- DELETE cancels the test. - -/status//results - Collection resource, all the files resulting from the -test run. - -- GET returns the list of (file_name, file_id) pairs. - - Only mandatory file: - - test_suite_results.json - - Normalized test results, see section below. - -/status//results/ - Member resource, and individual result -file. - -- GET returns the contents of the file. - -### /dispatch arguments - -**test_suite_name**: _Required_. Name of the test suite. - -**host_artifacts**: _Only required for development support tests_. A file (most -likely a ZIP file) corresponding to all the scripts and binaries to be run by -the test host. The test host must be able to unzip, recognize and execute -contents. - -**device_artifacts**: _Required_. A file (most likely a ZIP file) corresponding -to all the binaries to be flashed on the device. The test host must be able to -unzip, recognize and flash contents. - -**timeout_for_results_seconds**: _Required_. The maximum amount of time in -seconds the client is willing to wait for results. After this much time the test -can be killed by the test host. - -**timeout_for_start_seconds**: _Required_. The maximum amount of time in seconds -the client is willing to wait for the test to start. If after dispatch the test -does not start after this much time the test can be descheduled by the -aggregator. - -### test_suite_results.json contents - -TBD. - -### Aggregator-to-lab dispatch API - -TBD. - -### Lab Registration Interface API - -Once agreement on the dispatch API is cemented, the API to register a given -executor with certain tests and devices capabilities can be defined. - -TBD. diff --git a/docs/api/index.md b/docs/api/index.md deleted file mode 100644 index c139642dc4ed68..00000000000000 --- a/docs/api/index.md +++ /dev/null @@ -1,7 +0,0 @@ -# API - -```{toctree} -:glob: - -* -``` diff --git a/docs/testing/img/plant_uml_source.txt b/docs/cluster_and_device_type_dev/img/plant_uml_source.txt similarity index 100% rename from docs/testing/img/plant_uml_source.txt rename to docs/cluster_and_device_type_dev/img/plant_uml_source.txt diff --git a/docs/testing/img/unit_testable_clusters.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters.png similarity index 100% rename from docs/testing/img/unit_testable_clusters.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters.png diff --git a/docs/testing/img/unit_testable_clusters_all_classes.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters_all_classes.png similarity index 100% rename from docs/testing/img/unit_testable_clusters_all_classes.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters_all_classes.png diff --git a/docs/testing/img/unit_testable_clusters_context.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters_context.png similarity index 100% rename from docs/testing/img/unit_testable_clusters_context.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters_context.png diff --git a/docs/testing/img/unit_testable_clusters_driver.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters_driver.png similarity index 100% rename from docs/testing/img/unit_testable_clusters_driver.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters_driver.png diff --git a/docs/testing/img/unit_testable_clusters_logic.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters_logic.png similarity index 100% rename from docs/testing/img/unit_testable_clusters_logic.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters_logic.png diff --git a/docs/testing/img/unit_testable_clusters_server.png b/docs/cluster_and_device_type_dev/img/unit_testable_clusters_server.png similarity index 100% rename from docs/testing/img/unit_testable_clusters_server.png rename to docs/cluster_and_device_type_dev/img/unit_testable_clusters_server.png diff --git a/docs/cluster_and_device_type_dev/index.md b/docs/cluster_and_device_type_dev/index.md index 9159cdb3e511d5..cf43d02651378c 100644 --- a/docs/cluster_and_device_type_dev/index.md +++ b/docs/cluster_and_device_type_dev/index.md @@ -14,3 +14,4 @@ types in the SDK. - [Cluster and device type development](./cluster_and_device_type_dev.md) - [How To Add New Device Types & Clusters](how_to_add_new_dts_and_clusters.md) +- [Cluster Server design](./unit_testing_clusters.md) diff --git a/docs/testing/unit_testing_clusters.md b/docs/cluster_and_device_type_dev/unit_testing_clusters.md similarity index 100% rename from docs/testing/unit_testing_clusters.md rename to docs/cluster_and_device_type_dev/unit_testing_clusters.md diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md index cca67e19b0c8fc..ea881141ff43ec 100644 --- a/docs/getting_started/index.md +++ b/docs/getting_started/index.md @@ -14,4 +14,3 @@ The following docs are a brief introduction to SDK development. - [Running your first example](./first_example.md) - [SDK Basics](./SDKBasics.md) - [ZAP](./zap.md) -- [Discover from a host computer](./discovery_from_a_host_computer.md) diff --git a/docs/guides/README.md b/docs/guides/README.md deleted file mode 100644 index a00cc83e280c91..00000000000000 --- a/docs/guides/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Guides - -## Platform Guides - -- [Android - Building](./android_building.md) -- [Apple - Testing with iPhone, iPad, macOS, Apple TV, HomePod, Watch, etc](./darwin.md) -- [ASR - Getting Started Guide](./asr_getting_started_guide.md) -- [Espressif (ESP32) - Getting Started Guide](./esp32/README.md) -- [Infineon PSoC6 - Software Update](./infineon_psoc6_software_update.md) -- [Infineon Trust M Provisioning](./infineon_trustm_provisioning.md) -- [Linux - Simulated Devices](./simulated_device_linux.md) -- [mbedOS - Adding a new target](./mbedos_add_new_target.md) -- [mbedOS - Commissioning](./mbedos_commissioning.md) -- [mbedOS - Platform Overview](./mbedos_platform_overview.md) -- [nRF Connect - Android Commissioning](./nrfconnect_android_commissioning.md) -- [nRF Connect - CLI Guide](./nrfconnect_examples_cli.md) -- [nRF Connect - Configuration](./nrfconnect_examples_configuration.md) -- [nRF Connect - Factory Data Configuration](./nrfconnect_factory_data_configuration.md) -- [nRF Connect - Platform Overview](./nrfconnect_platform_overview.md) -- [nRF Connect - Software Update](./nrfconnect_examples_software_update.md) -- [NXP - Getting Started Guide](./nxp/README.md) -- [Silicon Labs - Documentation](https://siliconlabs.github.io/matter/latest/index.html) -- [Silicon Labs - Getting Started](./silabs_getting_started.md) -- [Silicon Labs - Software Update](./silabs_efr32_software_update.md) -- [Silicon Labs - CLI Guide](./silabs_cli_guide.md) -- [STMicroelectronics (STM32)](./stm32_getting_started_guide.md) -- [TI - Platform Overview](./ti/ti_matter_overview.md) -- [Open IoT SDK - Platform Overview](./openiotsdk_platform_overview.md) -- [Open IoT SDK - Examples](./openiotsdk_examples.md) -- [Open IoT SDK - Unit Tests](./openiotsdk_unit_tests.md) -- [Open IoT SDK - Commissioning](./openiotsdk_commissioning.md) -- [Open IoT SDK - Software Update](./openiotsdk_examples_software_update.md) - -## Development Guides - -- [Access Control](./access-control-guide.md) - -## Setup Guides - -- [Open Thread - Hardware suggestions](./openthread_rcp_nrf_dongle.md) -- [Open Thread - Setting up a Pi as a border router](./openthread_border_router_pi.md) - -## Troubleshooting Guides - -- [Avahi - Troubleshooting](./troubleshooting_avahi.md) - -## Tool Guides - -- [chip-tool](./chip_tool_guide.md) -- [Python Matter-Repl](./matter-repl.md) -- [python-chip-controller - Advanced](./python_chip_controller_advanced_usage.md) -- [python-chip-controller - Building](./python_chip_controller_building.md) - -## Build Guides - -- [Building](./BUILDING.md) diff --git a/docs/guides/index.md b/docs/guides/index.md index 8f747ab27e684f..14d9caf7e21839 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -60,7 +60,3 @@ ti/ti_matter_overview - [Open Thread - Hardware suggestions](./openthread_rcp_nrf_dongle.md) - [Open Thread - Setting up a Raspberry Pi as a Border Router](./openthread_border_router_pi.md) - -## Troubleshooting Guides - -- [Avahi - Troubleshooting](./troubleshooting_avahi.md) diff --git a/docs/index.md b/docs/index.md index 1f8e806dc4cce9..f4b40622714eae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,18 +5,17 @@ :caption: Contents :hidden: -QUICK_START PROJECT_FLOW VSCODE_DEVELOPMENT -api/index ci-cd/index -discussion/index getting_started/index cluster_and_device_type_dev/index guides/index style/index examples/index +product_considerations/index testing/index +tips_and_troubleshooting/index tools/index BUG_REPORT code_generation diff --git a/docs/discussion/index.md b/docs/product_considerations/index.md similarity index 100% rename from docs/discussion/index.md rename to docs/product_considerations/index.md diff --git a/docs/discussion/lwip_ipv6.md b/docs/product_considerations/lwip_ipv6.md similarity index 100% rename from docs/discussion/lwip_ipv6.md rename to docs/product_considerations/lwip_ipv6.md diff --git a/docs/testing/index.md b/docs/testing/index.md index d8ebe92da46f40..b3124f8349dc5c 100644 --- a/docs/testing/index.md +++ b/docs/testing/index.md @@ -37,7 +37,6 @@ from the global ember and message delivery layers. ![](./img/unit_tests.png) - [Unit tests](./unit_testing.md) -- [Designing clusters for unit testing and portability](./unit_testing_clusters.md) ## PICS and PIXIT diff --git a/docs/testing/integration_test_utilities.md b/docs/testing/integration_test_utilities.md index e50ad511caa28b..019a3cf44bc29b 100644 --- a/docs/testing/integration_test_utilities.md +++ b/docs/testing/integration_test_utilities.md @@ -6,9 +6,10 @@ on devices for the purposes of testing. When using any of these utilities it is important to inject the errors at the point where they are running through the MOST code that they can. -If the cluster uses the [ClusterLogic](./unit_testing_clusters.md) pattern, this -means injecting errors as close as possible to the driver layer, rather than -catching errors in the server. +If the cluster uses the +[ClusterLogic](../cluster_and_device_type_dev/unit_testing_clusters.md) pattern, +this means injecting errors as close as possible to the driver layer, rather +than catching errors in the server. ## TestEventTriggers diff --git a/docs/getting_started/discovery_from_a_host_computer.md b/docs/tips_and_troubleshooting/discovery_from_a_host_computer.md similarity index 100% rename from docs/getting_started/discovery_from_a_host_computer.md rename to docs/tips_and_troubleshooting/discovery_from_a_host_computer.md diff --git a/docs/tips_and_troubleshooting/index.md b/docs/tips_and_troubleshooting/index.md new file mode 100644 index 00000000000000..f2f4a7a417cb7d --- /dev/null +++ b/docs/tips_and_troubleshooting/index.md @@ -0,0 +1,8 @@ +# Tips and Troubleshooting + +```{toctree} +:glob: +:maxdepth: 1 + +* +``` diff --git a/docs/guides/troubleshooting_avahi.md b/docs/tips_and_troubleshooting/troubleshooting_avahi.md similarity index 100% rename from docs/guides/troubleshooting_avahi.md rename to docs/tips_and_troubleshooting/troubleshooting_avahi.md From c17fd97dad04a154ce6d26b0a8ffc4e868fdfa23 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Fri, 23 Aug 2024 06:57:11 -0700 Subject: [PATCH 41/53] [HVAC] Sync atomic write error order with spec (#34936) * Add support for Presets attributes and commands to the Thermostat cluster Clean up the Thermostat cluster and remove the TemperatureSetpointHoldPolicy attribute and SetTemperatureSetpointHoldPolicy command * Restyled by whitespace * Restyled by clang-format * Restyled by gn. * Fix build error for Linux configure build of all-clusters-app * Fix Darwin CI issues Editorial fixes * Restyled by clang-format * More fixes * Restyled by clang-format * BUILD.gn fixes for CI * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Address review comments. * Restyled by clang-format * Regenerate Thermostat XML from spec * Move atomic enum to global-enums.xml, actually # Conflicts: # src/app/zap-templates/zcl/data-model/chip/global-structs.xml * Regenerate XML and convert thermostat-server to atomic writes * Pull in ACCapacityFormat typo un-fix * Update Test_TC_TSTAT_1_1 to know about AtomicResponse command. * Restyled patch * Fix weird merge with upstream * Fix emberAfIsTypeSigned not understanding temperature type * Merge fixes from atomic write branch * Relocate thermostat-manager sample code to all-clusters-common * Fix g++ build error on linux * Fix C formatter for long int, cast whole expression * Sync cast fix with master * Add thermostat-common dependency to thermostat app under linux * Remove MatterPostAttributeChangeCallback from thermostat-manager, as it conflicts with other implementations * Convert Atomic enums and structs to global * Restyled patch * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Regen with alchemy 0.6.1 * Updates based on comments * Add TC_MCORE_FS_1_3.py test implementation (#34650) * Fix most TC-SWTCH-2.4 remaining issues (#34677) - Move 2.4 in a better place in the file - Add test steps properly - Allow default button press position override Issue #34656 Testing done: - Test still passes on DUT with automation * Initial test script for Fabric Sync TC_MCORE_FS_1_2 (#34675) * Initial test script for Fabric Sync TC_MCORE_FS_1_2 * Apply suggestions from code review Co-authored-by: C Freeman * Address Review Comments * Address review comments * Fix default timeout after other timeouts changed * Restyled by autopep8 * Fix linter error --------- Co-authored-by: C Freeman Co-authored-by: Restyled.io * Test automation for FabricSync ICD BridgedDeviceBasicInfoCluster (#34628) * WIP Bridged ICD, commissioning to both fabrics * wip testing sending KeepActive * wip most steps implemented * using SIGSTOP and SIGCONT to control ICD server pausing * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * comments addressed * more comments addressed * lint pass * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: C Freeman * comments addressed, incl TH_SERVER configurable * added setupQRCode and setupManualCode as options for DUT commissioning * Restyled by autopep8 * Restyled by isort * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * comments addressed * Restyled by autopep8 --------- Co-authored-by: Terence Hampson Co-authored-by: C Freeman Co-authored-by: Restyled.io * ServiceArea test scripts (#34548) * initial commit * fix bugs * fix issues reported by the linter * fix bug in checking for unique areaDesc * add TC 1.5 * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: William * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: William * address code review comments * fix issue introduced by the previous commit * address code review feedback * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: Kiel Oleson * address code review feedback * remove PICS checked by the TC_SEAR_1.6 * more code review updates * Restyled by autopep8 --------- Co-authored-by: William Co-authored-by: Kiel Oleson Co-authored-by: Restyled.io * Remove manual tests for Thermostat presets (#34679) * Dump details about leaked ExchangeContexts before aborting (#34617) * Dump details about leaked ExchangeContexts before aborting This is implemented via a VerifyOrDieWithObject() variant of the existing VerifyOrDie() macro that calls a DumpToLog() method on the provided object if it exists (otherwise this is simply a no-op). If CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE is not enabled, VerifyOrDieWithObject() simply behaves like a plain VerifyOrDie(). DumpToLog() implementations can use ChipLogFormatRtti to log type information about an object (usually a delegate); if RTTI is disabled this simply outputs whether the object was null or not. * Address review comments * Make gcc happy and improve documentation * Remove unused include * Fix compile error without CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE * Avoid unused parameter warning * [TI] CC13x4_26x4 build fixes (#34682) * lwip pbuf, map file, and hex creation when OTA is disabled * added cc13x4 family define around the non OTA hex creation * whitespace fix * reversed custom factoy data flash with cc13x4 check * more whitespace fixes * [ICD] Add missing polling function to NoWifi connectivity manager (#34684) * Add missing polling function to NoWifi connectivity manager * Update GenericConnectivityManagerImpl_NoWiFi.h Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky * [OPSTATE] Add Q test script for CountdownTime (#34632) * Add Q test * Added test to test set * Remove unused var * Restyled by autopep8 * Restyled by isort * Fix name * Use pics over other method * Removed unused stuff * Added pipe commands * Fix reset * Get example to report appropriate changes. * WiP * Added some comments * Changes to make things work * Removed dev msgs * Missed some * Removed dev msgs * Straggler * Restyled by clang-format * Restyled by autopep8 * Restyled by isort * Commented unused var * Update examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp * Fix bug --------- Co-authored-by: Restyled.io * YAML update to BRBINFO, ProductId (#34513) * Bridged Device Information Cluster, Attribute ProductID test reflects marking as O, not X * Update src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml Co-authored-by: Terence Hampson * corrected pics * corrected pics * WIP Bridged ICD, commissioning to both fabrics * wip testing sending KeepActive * update to bridged-device-basic-information.xml and zap generated files * removed unrelated file --------- Co-authored-by: Terence Hampson Co-authored-by: Andrei Litvin * Fix simplified Linux tv-casting-app gn build error. (#34692) * adding parallel execution to restyle-diff (#34663) * adding parallel execution to restyle-diff * using xargs to call restyle-paths * fixing Copyright year * restyle the restyler * Add some bits to exercise global structs/enums to Unit Testing cluster. (#34540) * Adds things to the Unit Testing cluster XML. * This requires those things to be enabled in all-clusters-app, all-clusters-minimal-app, and one of the chef contact sensors to pass CI. * That requires an implementation in test-cluster-server * At which point might as well add a YAML test to exercise it all. * [Silabs] Port platform specific Multi-Chip OTA work (#34440) * Pull request #1836: Cherry multi ota Merge in WMN_TOOLS/matter from cherry-multi-ota to silabs_slc_1.3 Squashed commit of the following: commit 4320bb46571658bc44fb82345348265def394991 Author: Michael Rupp Date: Fri May 10 14:26:07 2024 -0400 remove some unwanted diffs in provision files commit be160931dc600de7e7ead378b70d6a43c3945e46 Author: Michael Rupp Date: Fri May 10 14:24:25 2024 -0400 revert changes to generator.project.mak commit 14b6605887166e6d5284a61feb2bf407d850bdcf Author: Michael Rupp Date: Fri May 10 13:06:12 2024 -0400 revert NVM key changes and script changes ... and 8 more commits * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by autopep8 * remove unused libs caught by linter * update doctree with new readmes * rerun CI, cirque failing for unknown reasons * fix include guards in provision examples * Restyled by clang-format --------- Co-authored-by: Restyled.io * Add python tests for Thermostat presets feature (#34693) * Add python tests for Thermostat presets feature * Restyled by autopep8 * Restyled by isort * Update the PICS code for presets attribute --------- Co-authored-by: Restyled.io * removing unneccessary git fetch (#34698) * Restyle patch * Regen to fix ordering of global structs * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Return correct AtomicResponse when committing or rolling back * Patch tests for atomic write of presets * Fix tests to work with the new setup. Specific changes: * Enable SetActivePresetRequest command in all-clusters-app. * Fix assignment of a PresetStructWithOwnedMembers to another PresetStructWithOwnedMembers to actually work correctly. * Move constraint checks that happen on write from commit to write. * Fix sending of atomic responses to not have use-stack-after-return. * Fix PICS for the tests involved. * Fix PICS values for atomic requests * Remove PresetsSchedulesEditable and QueuedPreset from various places * Restyled patch * Restyled patch, again * Remove PICS value for PresetsSchedulesEditable * clang-tidy fixes * clang-tidy fixes * Clear associated atomic writes when fabric is removed * Add tests for fabric removal and lockout of clients outside of atomic write * Python linter * Restyled patch * Clear timer when fabric is removed * Check for open atomic write before resetting * Revert auto delegate declaration on lines where there's no collision * Allow Thermostat delegate to provide timeout for atomic requests * Relocate thermostat example code to thermostat-common * Remove thermostat-manager code, replace with thermostat delegate * Sync atomic write error order with spec * Restyle patch * Drop memset of atomic write sessions * Add PreCommit stage to allow rollback of multiple attributes when only one fails * Separate OnTimerExpired method, vs ResetWrite * Method documentation * Apply suggestions from code review Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> * Remove unused InWrite check * Drop imcode alias * Switch AtomicWriteState to enum class * DRY up atomic write manager * Apply suggestions from code review Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> * Drop duplicate doc comments * Rename GetAtomicWriteScopedNodeId to GetAtomicWriteOriginatorScopedNodeId * Updates based on comments * Add MatterReportingAttributeChangeCallback calls for updated attributes * Relocate thermostat example code to thermostat-common, and remove thermostat-manager * Merge atomic write code back into thermostat-server * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Fix build after suggestions * Actually track attribute IDs associated with atomic write * Only commit presets if all attribute precommits were successful * Fix scope on err * Add documentation to methods * Remove duplicate preset check. * Move various functions into anonymous namespaces, or Thermostat namespace * Drop impossible non-atomic attribute status after rollback * Namespace workaround for compilers on other platforms * Apply suggestions from code review --------- Co-authored-by: Nivedita Sarkar Co-authored-by: Restyled.io Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Co-authored-by: Boris Zbarsky Co-authored-by: Terence Hampson Co-authored-by: Tennessee Carmel-Veilleux Co-authored-by: Chris Letnick Co-authored-by: C Freeman Co-authored-by: Douglas Rocha Ferraz Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> Co-authored-by: William Co-authored-by: Kiel Oleson Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Co-authored-by: Anu Biradar <104591549+abiradarti@users.noreply.github.com> Co-authored-by: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Co-authored-by: Rob Bultman Co-authored-by: Andrei Litvin Co-authored-by: Shao Ling Tan <161761051+shaoltan-amazon@users.noreply.github.com> Co-authored-by: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Co-authored-by: Michael Rupp <95718139+mykrupp@users.noreply.github.com> --- examples/all-clusters-app/linux/BUILD.gn | 4 +- examples/thermostat/linux/BUILD.gn | 8 +- .../linux/include/thermostat-manager.h | 73 -- examples/thermostat/linux/main.cpp | 16 +- .../thermostat/linux/thermostat-manager.cpp | 497 -------- .../thermostat/thermostat-common/BUILD.gn | 4 + .../include/thermostat-delegate-impl.h | 6 +- .../src}/thermostat-delegate-impl.cpp | 88 +- src/app/chip_data_model.gni | 2 + .../thermostat-server/thermostat-delegate.h | 13 +- .../thermostat-server-atomic.cpp | 644 ++++++++++ .../thermostat-server-presets.cpp | 546 ++++++++ .../thermostat-server/thermostat-server.cpp | 1113 ++--------------- .../thermostat-server/thermostat-server.h | 163 ++- src/python_testing/TC_TSTAT_4_2.py | 50 +- 15 files changed, 1542 insertions(+), 1685 deletions(-) delete mode 100644 examples/thermostat/linux/include/thermostat-manager.h delete mode 100644 examples/thermostat/linux/thermostat-manager.cpp rename examples/thermostat/{linux => thermostat-common}/include/thermostat-delegate-impl.h (92%) rename examples/thermostat/{linux => thermostat-common/src}/thermostat-delegate-impl.cpp (75%) create mode 100644 src/app/clusters/thermostat-server/thermostat-server-atomic.cpp create mode 100644 src/app/clusters/thermostat-server/thermostat-server-presets.cpp diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index ed228b51b2cb32..baac52014d3c3b 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -75,7 +75,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/thermostat/linux/thermostat-delegate-impl.cpp", + "${chip_root}/examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp", "AllClustersCommandDelegate.cpp", "AllClustersCommandDelegate.h", "AppOptions.cpp", @@ -102,7 +102,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", - "${chip_root}/examples/thermostat/linux/include", + "${chip_root}/examples/thermostat/thermostat-common/include", ] if (chip_enable_pw_rpc) { diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 71c0eccfcfae50..0683b39abb4cc6 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -17,11 +17,10 @@ import("//build_overrides/chip.gni") executable("thermostat-app") { sources = [ + "${chip_root}/examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp", "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", "main.cpp", - "thermostat-delegate-impl.cpp", - "thermostat-manager.cpp", ] deps = [ @@ -30,7 +29,10 @@ executable("thermostat-app") { "${chip_root}/src/lib", ] - include_dirs = [ "include" ] + include_dirs = [ + "include", + "${chip_root}/examples/thermostat/thermostat-common/include", + ] cflags = [ "-Wconversion" ] diff --git a/examples/thermostat/linux/include/thermostat-manager.h b/examples/thermostat/linux/include/thermostat-manager.h deleted file mode 100644 index 274f66c66917cf..00000000000000 --- a/examples/thermostat/linux/include/thermostat-manager.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Copyright (c) 2024 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#pragma once - -#include - -class ThermostatManager -{ -public: - CHIP_ERROR Init(); - - /// @brief Callback called when any attribute changed on the device - void AttributeChangeHandler(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, - uint8_t * value, uint16_t size); - - chip::app::Clusters::Thermostat::SystemModeEnum GetSystemMode(); - chip::app::Clusters::Thermostat::ThermostatRunningModeEnum GetRunningMode(); - int16_t GetCurrentTemperature(); - int16_t GetCurrentHeatingSetPoint(); - int16_t GetCurrentCoolingSetPoint(); - uint8_t GetNumberOfPresets(); - CHIP_ERROR SetSystemMode(chip::app::Clusters::Thermostat::SystemModeEnum systemMode); - CHIP_ERROR SetRunningMode(chip::app::Clusters::Thermostat::ThermostatRunningModeEnum runningMode); - CHIP_ERROR SetCurrentTemperature(int16_t temperature); - CHIP_ERROR SetCurrentHeatingSetPoint(int16_t heatingSetpoint); - CHIP_ERROR SetCurrentCoolingSetPoint(int16_t coolingSetpoint); - -private: - friend ThermostatManager & ThermostatMgr(); - - chip::app::Clusters::Thermostat::SystemModeEnum mSystemMode; - chip::app::Clusters::Thermostat::ThermostatRunningModeEnum mRunningMode; - int16_t mLocalTemperature; - int16_t mOccupiedCoolingSetpoint; - int16_t mOccupiedHeatingSetpoint; - uint8_t mOccupiedSetback; - - static ThermostatManager sThermostatMgr; - - /// @brief attribute handler for the thermostat endpoint - void ThermostatEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, - uint16_t size); - void ThermostatClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); - void LocalTemperatureMeasurementEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, - uint8_t * value, uint16_t size); - void LocalTemperatureMeasurementClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); - - /// @brief Main method that evaluates the current thermostat state and updates attributes - void EvalThermostatState(); - void UpdateRunningModeForHeating(); - void UpdateRunningModeForCooling(); -}; - -inline ThermostatManager & ThermostatMgr() -{ - return ThermostatManager::sThermostatMgr; -} diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index 2279f02bef3963..b9f82696e8ce79 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -22,8 +22,6 @@ #include #include -#include "thermostat-manager.h" - using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; @@ -76,19 +74,7 @@ void ApplicationShutdown() {} int main(int argc, char * argv[]) { - if (ChipLinuxAppInit(argc, argv) != 0) - { - return -1; - } - ChipLogProgress(Zcl, "Starting Thermostat Manager"); - CHIP_ERROR err = ThermostatManager().Init(); - - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "Failed to initialize thermostat manager: %" CHIP_ERROR_FORMAT, err.Format()); - chip::DeviceLayer::PlatformMgr().Shutdown(); - return -1; - } + VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp deleted file mode 100644 index ea1f4375c1649d..00000000000000 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/* - * - * Copyright (c) 2024 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -/********************************************************** - * Includes - *********************************************************/ - -#include -#include - -#include -#include -#include -#include - -/********************************************************** - * Defines and Constants - *********************************************************/ - -using namespace chip; -using namespace chip::app; -using namespace chip::app::DataModel; -using namespace chip::Controller; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::Thermostat; -using namespace chip::app::Clusters::Thermostat::Structs; -using namespace chip::app::Clusters::Thermostat::Attributes; -using namespace chip::app::Clusters::TemperatureMeasurement; -using namespace chip::app::Clusters::TemperatureMeasurement::Attributes; -using namespace Protocols::InteractionModel; - -using namespace chip::DeviceLayer; - -static constexpr EndpointId kThermostatEndpoint = 1; - -static constexpr uint16_t kMaxIntervalCeilingSeconds = 3600; - -static const char * SystemModeString(SystemModeEnum systemMode); -static const char * RunningModeString(ThermostatRunningModeEnum runningMode); - -/********************************************************** - * Variable declarations - *********************************************************/ - -ThermostatManager ThermostatManager::sThermostatMgr; - -namespace { - -template -static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); - -template <> -void OnAttributeChangeReported(const ConcreteDataAttributePath & path, - const MeasuredValue::TypeInfo::DecodableType & value) -{ - ClusterId clusterId = path.mClusterId; - if (clusterId != TemperatureMeasurement::Id) - { - ChipLogError(AppServer, - "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id " ChipLogFormatMEI, - ChipLogValueMEI(clusterId)); - return; - } - - AttributeId attributeId = path.mAttributeId; - if (attributeId != MeasuredValue::Id) - { - ChipLogError(AppServer, - "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute" ChipLogFormatMEI, - ChipLogValueMEI(attributeId)); - return; - } - - if (!value.IsNull()) - { - ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", - value.Value()); - } -} - -static void OnError(const ConcreteDataAttributePath * path, ChipError err) -{ - ChipLogError(AppServer, - "Subscribing to cluster Id " ChipLogFormatMEI " and attribute Id " ChipLogFormatMEI - " failed with error %" CHIP_ERROR_FORMAT, - ChipLogValueMEI(path->mClusterId), ChipLogValueMEI(path->mAttributeId), err.Format()); -} - -static void OnSubscriptionEstablished(const ReadClient & client, unsigned int value) -{ - ChipLogDetail(AppServer, "OnSubscriptionEstablished with subscription Id: %d", value); -} - -template -void SubscribeToAttribute(ClusterId clusterId, AttributeId attributeId, const EmberBindingTableEntry & binding, - OperationalDeviceProxy * peer_device) -{ - VerifyOrReturn(peer_device->GetSecureSession().HasValue(), - ChipLogError(AppServer, "SubscribeToAttribute failed. Secure session is null")); - - SubscribeAttribute( - peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, attributeId, - &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, - nullptr, true /* fabricFiltered */, false /* keepExistingSubscription */); -} - -static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, - void * context) -{ - VerifyOrReturn(binding.clusterId.has_value(), ChipLogError(AppServer, "Cluster Id is null")); - ClusterId clusterId = binding.clusterId.value(); - - switch (clusterId) - { - case TemperatureMeasurement::Id: - - // Subscribe to the MeasuredValue attribute - SubscribeToAttribute(clusterId, MeasuredValue::Id, binding, peer_device); - break; - default: - ChipLogError(AppServer, "Unsupported Cluster Id"); - break; - } -} - -void NotifyBoundClusterChangedForAllClusters() -{ - BindingManager::GetInstance().NotifyBoundClusterChanged(kThermostatEndpoint, TemperatureMeasurement::Id, nullptr); -} - -static void OnPlatformChipDeviceEvent(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) -{ - if (event->Type == DeviceLayer::DeviceEventType::kBindingsChangedViaCluster) - { - NotifyBoundClusterChangedForAllClusters(); - } -} - -void InitBindingManager(intptr_t context) -{ - auto & server = Server::GetInstance(); - CHIP_ERROR error = BindingManager::GetInstance().Init( - { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() }); - - if (error != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "Failed to init binding manager"); - } - - BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(ThermostatBoundDeviceChangedHandler); - NotifyBoundClusterChangedForAllClusters(); -} - -} // anonymous namespace - -CHIP_ERROR ThermostatManager::Init() -{ - // Init binding manager - - DeviceLayer::PlatformMgr().AddEventHandler(OnPlatformChipDeviceEvent, reinterpret_cast(this)); - DeviceLayer::PlatformMgr().ScheduleWork(InitBindingManager); - - mLocalTemperature = GetCurrentTemperature(); - mSystemMode = GetSystemMode(); - mRunningMode = GetRunningMode(); - mOccupiedCoolingSetpoint = GetCurrentCoolingSetPoint(); - mOccupiedHeatingSetpoint = GetCurrentHeatingSetPoint(); - // TODO: Gotta expose this properly on attribute - mOccupiedSetback = 5; // 0.5 C - - ChipLogError(AppServer, - "Initialized a thermostat with \n " - "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " - "mOccupiedCoolingSetpoint: %d" - "NumberOfPresets: %d", - to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), - RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, - GetNumberOfPresets()); - - // TODO: Should this be called later? - EvalThermostatState(); - - return CHIP_NO_ERROR; -} - -void ThermostatManager::AttributeChangeHandler(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, - uint16_t size) -{ - switch (endpointId) - { - case kThermostatEndpoint: - ThermostatEndpointAttributeChangeHandler(clusterId, attributeId, value, size); - break; - - default: - ChipLogError(AppServer, "Attribute change reported for Thermostat on incorrect endpoint. Ignoring."); - break; - } -} - -void ThermostatManager::ThermostatEndpointAttributeChangeHandler(ClusterId clusterId, AttributeId attributeId, uint8_t * value, - uint16_t size) -{ - switch (clusterId) - { - case Thermostat::Id: - ThermostatClusterAttributeChangeHandler(attributeId, value, size); - break; - - default: - ChipLogError(AppServer, - "Attribute change reported for Thermostat on incorrect cluster for the thermostat endpoint. Ignoring."); - break; - } -} - -void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attributeId, uint8_t * value, uint16_t size) -{ - switch (attributeId) - { - case LocalTemperature::Id: { - memcpy(&mLocalTemperature, value, size); - ChipLogError(AppServer, "Local temperature changed to %d", mLocalTemperature); - EvalThermostatState(); - } - break; - - case OccupiedCoolingSetpoint::Id: { - memcpy(&mOccupiedCoolingSetpoint, value, size); - ChipLogError(AppServer, "Cooling temperature changed to %d", mOccupiedCoolingSetpoint); - EvalThermostatState(); - } - break; - - case OccupiedHeatingSetpoint::Id: { - memcpy(&mOccupiedHeatingSetpoint, value, size); - ChipLogError(AppServer, "Heating temperature changed to %d", mOccupiedHeatingSetpoint); - EvalThermostatState(); - } - break; - - case SystemMode::Id: { - mSystemMode = static_cast(*value); - ChipLogError(AppServer, "System mode changed to %u (%s)", *value, SystemModeString(mSystemMode)); - EvalThermostatState(); - } - break; - - case ThermostatRunningMode::Id: { - mRunningMode = static_cast(*value); - ChipLogError(AppServer, "Running mode changed to %u (%s)", *value, RunningModeString(mRunningMode)); - } - break; - - default: { - ChipLogError(AppServer, "Unhandled thermostat attribute %u", static_cast(attributeId)); - return; - } - break; - } -} - -SystemModeEnum ThermostatManager::GetSystemMode() -{ - SystemModeEnum systemMode; - SystemMode::Get(kThermostatEndpoint, &systemMode); - return systemMode; -} - -ThermostatRunningModeEnum ThermostatManager::GetRunningMode() -{ - ThermostatRunningModeEnum runningMode; - ThermostatRunningMode::Get(kThermostatEndpoint, &runningMode); - return runningMode; -} - -int16_t ThermostatManager::GetCurrentTemperature() -{ - DataModel::Nullable currentTemperature; - currentTemperature.SetNull(); - LocalTemperature::Get(kThermostatEndpoint, currentTemperature); - return currentTemperature.ValueOr(0); -} - -int16_t ThermostatManager::GetCurrentHeatingSetPoint() -{ - int16_t heatingSetpoint; - OccupiedHeatingSetpoint::Get(kThermostatEndpoint, &heatingSetpoint); - return heatingSetpoint; -} - -int16_t ThermostatManager::GetCurrentCoolingSetPoint() -{ - int16_t coolingSetpoint; - OccupiedCoolingSetpoint::Get(kThermostatEndpoint, &coolingSetpoint); - return coolingSetpoint; -} - -uint8_t ThermostatManager::GetNumberOfPresets() -{ - return ThermostatDelegate::GetInstance().GetNumberOfPresets(); -} - -CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) -{ - uint8_t systemModeValue = to_underlying(systemMode); - if (mSystemMode == systemMode) - { - ChipLogDetail(AppServer, "Already in system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); - return CHIP_NO_ERROR; - } - - ChipLogError(AppServer, "Setting system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); - return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(SystemMode::Set(kThermostatEndpoint, systemMode)); -} - -CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode) -{ - uint8_t runningModeValue = to_underlying(runningMode); - if (mRunningMode == runningMode) - { - ChipLogDetail(AppServer, "Already in running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); - return CHIP_NO_ERROR; - } - - ChipLogError(AppServer, "Setting running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); - return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(ThermostatRunningMode::Set(kThermostatEndpoint, runningMode)); -} - -CHIP_ERROR ThermostatManager::SetCurrentTemperature(int16_t temperature) -{ - return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(LocalTemperature::Set(kThermostatEndpoint, temperature)); -} - -CHIP_ERROR ThermostatManager::SetCurrentHeatingSetPoint(int16_t heatingSetpoint) -{ - return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint)); -} - -CHIP_ERROR ThermostatManager::SetCurrentCoolingSetPoint(int16_t coolingSetpoint) -{ - return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint)); -} - -void ThermostatManager::EvalThermostatState() -{ - ChipLogError(AppServer, - "Eval Thermostat Running Mode \n " - "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " - "mOccupiedCoolingSetpoint: %d", - to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), - RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); - - switch (mSystemMode) - { - case SystemModeEnum::kOff: { - SetRunningMode(ThermostatRunningModeEnum::kOff); - break; - } - case SystemModeEnum::kHeat: { - UpdateRunningModeForHeating(); - break; - } - case SystemModeEnum::kCool: { - UpdateRunningModeForCooling(); - break; - } - case SystemModeEnum::kAuto: { - UpdateRunningModeForHeating(); - UpdateRunningModeForCooling(); - break; - } - default: - break; - } -} - -void ThermostatManager::UpdateRunningModeForHeating() -{ - const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - static_cast(mOccupiedSetback * 10); - const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + static_cast(mOccupiedSetback * 10); - - if (mRunningMode == ThermostatRunningModeEnum::kHeat) - { - if (mLocalTemperature >= heatingOffThreshold) - { - ChipLogDetail(AppServer, "Eval Heat - Turning off"); - SetRunningMode(ThermostatRunningModeEnum::kOff); - } - else - { - ChipLogDetail(AppServer, "Eval Heat - Keep Heating"); - } - } - else - { - if (mLocalTemperature <= heatingOnThreshold) - { - ChipLogDetail(AppServer, "Eval Heat - Turn on"); - SetRunningMode(ThermostatRunningModeEnum::kHeat); - } - else - { - ChipLogDetail(AppServer, "Eval Heat - Nothing to do"); - } - } -} - -void ThermostatManager::UpdateRunningModeForCooling() -{ - const int16_t coolingOffThreshold = mOccupiedCoolingSetpoint - static_cast(mOccupiedSetback * 10); - const int16_t coolingOnThreshold = mOccupiedCoolingSetpoint + static_cast(mOccupiedSetback * 10); - - if (mRunningMode == ThermostatRunningModeEnum::kCool) - { - if (mLocalTemperature <= coolingOffThreshold) - { - ChipLogDetail(AppServer, "Eval Cool - Turning off"); - SetRunningMode(ThermostatRunningModeEnum::kOff); - } - else - { - ChipLogDetail(AppServer, "Eval Cool - Keep Cooling"); - } - } - else - { - if (mLocalTemperature >= coolingOnThreshold) - { - ChipLogDetail(AppServer, "Eval Cool - Turn on"); - SetRunningMode(ThermostatRunningModeEnum::kCool); - } - else - { - ChipLogDetail(AppServer, "Eval Cool - Nothing to do"); - } - } -} - -static const char * SystemModeString(SystemModeEnum systemMode) -{ - switch (systemMode) - { - case SystemModeEnum::kOff: - return "Off"; - case SystemModeEnum::kAuto: - return "Auto"; - case SystemModeEnum::kCool: - return "Cool"; - case SystemModeEnum::kHeat: - return "Heat"; - default: - return "Unknown"; - } -} - -static const char * RunningModeString(ThermostatRunningModeEnum runningMode) -{ - switch (runningMode) - { - case ThermostatRunningModeEnum::kOff: - return "Off"; - case ThermostatRunningModeEnum::kCool: - return "Cool"; - case ThermostatRunningModeEnum::kHeat: - return "Heat"; - default: - return "Unknown"; - } -} - -void emberAfThermostatClusterInitCallback(EndpointId endpoint) -{ - ChipLogProgress(Zcl, "Starting Thermostat Manager"); - ThermostatManager().Init(); - - // Register the delegate for the Thermostat - auto & delegate = ThermostatDelegate::GetInstance(); - // Set the default delegate for endpoint kThermostatEndpoint. - VerifyOrDie(endpoint == kThermostatEndpoint); - SetDefaultDelegate(endpoint, &delegate); -} diff --git a/examples/thermostat/thermostat-common/BUILD.gn b/examples/thermostat/thermostat-common/BUILD.gn index 93a0c7540fb93a..1f8f839b4a4f3a 100644 --- a/examples/thermostat/thermostat-common/BUILD.gn +++ b/examples/thermostat/thermostat-common/BUILD.gn @@ -16,6 +16,10 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/app/chip_data_model.gni") +config("config") { + include_dirs = [ "include" ] +} + chip_data_model("thermostat-common") { zap_file = "thermostat.zap" is_server = true diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/thermostat-common/include/thermostat-delegate-impl.h similarity index 92% rename from examples/thermostat/linux/include/thermostat-delegate-impl.h rename to examples/thermostat/thermostat-common/include/thermostat-delegate-impl.h index 6bf9d02cea462f..9edf13f839df44 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/thermostat-common/include/thermostat-delegate-impl.h @@ -44,9 +44,7 @@ class ThermostatDelegate : public Delegate public: static inline ThermostatDelegate & GetInstance() { return sInstance; } - std::optional - GetAtomicWriteTimeout(DataModel::DecodableList attributeRequests, - System::Clock::Milliseconds16 timeoutRequest) override; + std::optional GetMaxAtomicWriteTimeout(chip::AttributeId attributeId) override; CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type & presetType) override; @@ -64,7 +62,7 @@ class ThermostatDelegate : public Delegate CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; - CHIP_ERROR ApplyPendingPresets() override; + CHIP_ERROR CommitPendingPresets() override; void ClearPendingPresetList() override; diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp similarity index 75% rename from examples/thermostat/linux/thermostat-delegate-impl.cpp rename to examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp index b931db20b7c4f7..8c411cd5a9176e 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/thermostat-common/src/thermostat-delegate-impl.cpp @@ -17,7 +17,6 @@ */ #include -#include #include #include @@ -36,34 +35,12 @@ ThermostatDelegate::ThermostatDelegate() mNextFreeIndexInPresetsList = 0; mNextFreeIndexInPendingPresetsList = 0; - InitializePresetTypes(); InitializePresets(); memset(mActivePresetHandleData, 0, sizeof(mActivePresetHandleData)); mActivePresetHandleDataSize = 0; } -void ThermostatDelegate::InitializePresetTypes() -{ - PresetScenarioEnum presetScenarioEnumArray[kMaxNumberOfPresetTypes] = { - PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied, PresetScenarioEnum::kSleep, - PresetScenarioEnum::kWake, PresetScenarioEnum::kVacation, PresetScenarioEnum::kGoingToSleep - }; - static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresetTypes)); - - uint8_t index = 0; - for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) - { - mPresetTypes[index].presetScenario = presetScenario; - mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetsOfEachType; - mPresetTypes[index].presetTypeFeatures = - (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) - ? PresetTypeFeaturesBitmap::kAutomatic - : PresetTypeFeaturesBitmap::kSupportsNames; - index++; - } -} - void ThermostatDelegate::InitializePresets() { // Initialize the presets with 2 built in presets - occupied and unoccupied. @@ -94,9 +71,26 @@ void ThermostatDelegate::InitializePresets() CHIP_ERROR ThermostatDelegate::GetPresetTypeAtIndex(size_t index, PresetTypeStruct::Type & presetType) { - if (index < ArraySize(mPresetTypes)) + static PresetTypeStruct::Type presetTypes[] = { + { .presetScenario = PresetScenarioEnum::kOccupied, + .numberOfPresets = kMaxNumberOfPresetsOfEachType, + .presetTypeFeatures = to_underlying(PresetTypeFeaturesBitmap::kAutomatic) }, + { .presetScenario = PresetScenarioEnum::kUnoccupied, + .numberOfPresets = kMaxNumberOfPresetsOfEachType, + .presetTypeFeatures = to_underlying(PresetTypeFeaturesBitmap::kAutomatic) }, + { .presetScenario = PresetScenarioEnum::kSleep, + .numberOfPresets = kMaxNumberOfPresetsOfEachType, + .presetTypeFeatures = to_underlying(PresetTypeFeaturesBitmap::kSupportsNames) }, + { .presetScenario = PresetScenarioEnum::kWake, + .numberOfPresets = kMaxNumberOfPresetsOfEachType, + .presetTypeFeatures = to_underlying(PresetTypeFeaturesBitmap::kSupportsNames) }, + { .presetScenario = PresetScenarioEnum::kVacation, + .numberOfPresets = kMaxNumberOfPresetsOfEachType, + .presetTypeFeatures = to_underlying(PresetTypeFeaturesBitmap::kSupportsNames) }, + }; + if (index < ArraySize(presetTypes)) { - presetType = mPresetTypes[index]; + presetType = presetTypes[index]; return CHIP_NO_ERROR; } return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; @@ -158,45 +152,19 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable -ThermostatDelegate::GetAtomicWriteTimeout(DataModel::DecodableList attributeRequests, - System::Clock::Milliseconds16 timeoutRequest) +std::optional ThermostatDelegate::GetMaxAtomicWriteTimeout(chip::AttributeId attributeId) { - auto attributeIdsIter = attributeRequests.begin(); - bool requestedPresets = false, requestedSchedules = false; - while (attributeIdsIter.Next()) - { - auto & attributeId = attributeIdsIter.GetValue(); - - switch (attributeId) - { - case Attributes::Presets::Id: - requestedPresets = true; - break; - case Attributes::Schedules::Id: - requestedSchedules = true; - break; - default: - return System::Clock::Milliseconds16(0); - } - } - if (attributeIdsIter.GetStatus() != CHIP_NO_ERROR) - { - return System::Clock::Milliseconds16(0); - } - auto timeout = System::Clock::Milliseconds16(0); - if (requestedPresets) + switch (attributeId) { + case Attributes::Presets::Id: // If the client expects to edit the presets, then we'll give it 3 seconds to do so - timeout += std::chrono::milliseconds(3000); - } - if (requestedSchedules) - { + return std::chrono::milliseconds(3000); + case Attributes::Schedules::Id: // If the client expects to edit the schedules, then we'll give it 9 seconds to do so - timeout += std::chrono::milliseconds(9000); + return std::chrono::milliseconds(9000); + default: + return std::nullopt; } - // If the client requested an even smaller timeout, then use that one - return std::min(timeoutRequest, timeout); } void ThermostatDelegate::InitializePendingPresets() @@ -238,7 +206,7 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; } -CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() +CHIP_ERROR ThermostatDelegate::CommitPendingPresets() { mNextFreeIndexInPresetsList = 0; for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 3e4448a3bee467..01d47a47cb7184 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -428,6 +428,8 @@ template("chip_data_model") { ] } else if (cluster == "thermostat-server") { sources += [ + "${_app_root}/clusters/${cluster}/${cluster}-atomic.cpp", + "${_app_root}/clusters/${cluster}/${cluster}-presets.cpp", "${_app_root}/clusters/${cluster}/${cluster}.cpp", "${_app_root}/clusters/${cluster}/${cluster}.h", "${_app_root}/clusters/${cluster}/PresetStructWithOwnedMembers.cpp", diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index 0f89f69468099b..ccb690a34fba60 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -39,15 +39,12 @@ class Delegate virtual ~Delegate() = default; /** - * @brief Get the maximum timeout for atomically writing to a set of attributes + * @brief Get the maximum timeout for atomically writing to an attribute * - * @param[in] attributeRequests The list of attributes to write to. - * @param[out] timeoutRequest The timeout proposed by the client. - * @return The maximum allowed timeout; zero if the request is invalid. + * @param[in] attributeId The attribute to write to. + * @return The maximum allowed timeout; nullopt if the request is invalid. */ - virtual std::optional - GetAtomicWriteTimeout(DataModel::DecodableList attributeRequests, - System::Clock::Milliseconds16 timeoutRequest) = 0; + virtual std::optional GetMaxAtomicWriteTimeout(chip::AttributeId attributeId) = 0; /** * @brief Get the preset type at a given index in the PresetTypes attribute @@ -129,7 +126,7 @@ class Delegate * @return CHIP_ERROR if the updates to the presets attribute failed to commit for some reason. * */ - virtual CHIP_ERROR ApplyPendingPresets() = 0; + virtual CHIP_ERROR CommitPendingPresets() = 0; /** * @brief Clears the pending presets list. diff --git a/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp b/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp new file mode 100644 index 00000000000000..2a6e52e504887e --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp @@ -0,0 +1,644 @@ +/** + * + * Copyright (c) 2024 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 "thermostat-server.h" + +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Attributes; +using namespace chip::app::Clusters::Thermostat::Structs; +using namespace chip::app::Clusters::Globals::Structs; +using namespace chip::Protocols::InteractionModel; + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +extern ThermostatAttrAccess gThermostatAttrAccess; + +/** + * @brief Callback that is called when the timeout for editing the presets expires. + * + * @param[in] systemLayer The system layer. + * @param[in] callbackContext The context passed to the timer callback. + */ +void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) +{ + EndpointId endpoint = static_cast(reinterpret_cast(callbackContext)); + gThermostatAttrAccess.ResetAtomicWrite(endpoint); +} + +/** + * @brief Schedules a timer for the given timeout in milliseconds. + * + * @param[in] endpoint The endpoint to use. + * @param[in] timeoutMilliseconds The timeout in milliseconds. + */ +void ScheduleTimer(EndpointId endpoint, System::Clock::Milliseconds16 timeout) +{ + DeviceLayer::SystemLayer().StartTimer(timeout, TimerExpiredCallback, + reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Clears the currently scheduled timer. + * + * @param[in] endpoint The endpoint to use. + */ +void ClearTimer(EndpointId endpoint) +{ + DeviceLayer::SystemLayer().CancelTimer(TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Get the source scoped node id. + * + * @param[in] commandObj The command handler object. + * + * @return The scoped node id of the source node. If the scoped node id is not retreived, return ScopedNodeId(). + */ +ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) +{ + ScopedNodeId sourceNodeId = ScopedNodeId(); + auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); + + if (sessionHandle->IsSecureSession()) + { + sourceNodeId = sessionHandle->AsSecureSession()->GetPeer(); + } + else if (sessionHandle->IsGroupSession()) + { + sourceNodeId = sessionHandle->AsIncomingGroupSession()->GetPeer(); + } + return sourceNodeId; +} + +/** + * @brief Counts the number of attribute requests + * + * @param attributeRequests The decodable list of attribute IDs + * @param attributeRequestCount The total number of attribute requests + * @param requestedPresets Whether the Presets attribute was requested + * @param requestedSchedules Whether the Schedules attribute was requested + * @return true if the attribute list was counted + * @return false if there was an error reading the list + */ +bool CountAttributeRequests(const DataModel::DecodableList attributeRequests, size_t & attributeRequestCount, + bool & requestedPresets, bool & requestedSchedules) +{ + attributeRequestCount = 0; + requestedPresets = false; + requestedSchedules = false; + auto attributeIdsIter = attributeRequests.begin(); + while (attributeIdsIter.Next()) + { + auto & attributeId = attributeIdsIter.GetValue(); + switch (attributeId) + { + case Presets::Id: + requestedPresets = true; + break; + case Schedules::Id: + requestedSchedules = true; + break; + default: + break; + } + attributeRequestCount++; + } + return attributeIdsIter.GetStatus() == CHIP_NO_ERROR; +} + +/// @brief Builds the list of attribute statuses to return from an AtomicRequest invocation +/// @param endpoint The associated endpoint for the AtomicRequest invocation +/// @param attributeRequests The list of requested attributes +/// @param attributeStatusCount The number of attribute statuses in attributeStatuses +/// @param attributeStatuses The status of each requested attribute, plus additional attributes if needed +/// @return Status::Success if the request is valid, an error status if it is not +Status BuildAttributeStatuses(const EndpointId endpoint, const DataModel::DecodableList attributeRequests, + Platform::ScopedMemoryBufferWithSize & attributeStatuses) +{ + + bool requestedPresets = false, requestedSchedules = false; + size_t attributeStatusCount = 0; + if (!CountAttributeRequests(attributeRequests, attributeStatusCount, requestedPresets, requestedSchedules)) + { + // We errored reading the list + return Status::InvalidCommand; + } + if (attributeStatusCount == 0) + { + // List can't be empty + return Status::InvalidCommand; + } + attributeStatuses.Alloc(attributeStatusCount); + for (size_t i = 0; i < attributeStatusCount; ++i) + { + attributeStatuses[i].attributeID = kInvalidAttributeId; + attributeStatuses[i].statusCode = 0; + } + auto attributeIdsIter = attributeRequests.begin(); + size_t index = 0; + while (attributeIdsIter.Next()) + { + auto & attributeId = attributeIdsIter.GetValue(); + + for (size_t i = 0; i < index; ++i) + { + auto & attributeStatus = attributeStatuses[i]; + if (attributeStatus.attributeID == attributeId) + { + // Double-requesting an attribute is invalid + return Status::InvalidCommand; + } + } + attributeStatuses[index].attributeID = attributeId; + attributeStatuses[index].statusCode = to_underlying(Status::Success); + index++; + } + if (attributeIdsIter.GetStatus() != CHIP_NO_ERROR) + { + return Status::InvalidCommand; + } + for (size_t i = 0; i < index; ++i) + { + auto & attributeStatus = attributeStatuses[i]; + const EmberAfAttributeMetadata * metadata = + emberAfLocateAttributeMetadata(endpoint, Thermostat::Id, attributeStatus.attributeID); + + if (metadata == nullptr) + { + // This is not a valid attribute on the Thermostat cluster on the supplied endpoint + return Status::InvalidCommand; + } + } + return Status::Success; +} + +bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint, Optional attributeId) +{ + + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep >= ArraySize(mAtomicWriteSessions)) + { + return false; + } + auto & atomicWriteSession = mAtomicWriteSessions[ep]; + if (atomicWriteSession.state != AtomicWriteState::Open) + { + return false; + } + if (!attributeId.HasValue()) + { + return true; + } + for (size_t i = 0; i < atomicWriteSession.attributeIds.AllocatedSize(); ++i) + { + if (atomicWriteSession.attributeIds[i] == attributeId.Value()) + { + return true; + } + } + return false; +} + +bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint, const Access::SubjectDescriptor & subjectDescriptor, + Optional attributeId) +{ + if (!InAtomicWrite(endpoint, attributeId)) + { + return false; + } + return subjectDescriptor.authMode == Access::AuthMode::kCase && + GetAtomicWriteOriginatorScopedNodeId(endpoint) == ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); +} + +bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint, CommandHandler * commandObj, Optional attributeId) +{ + if (!InAtomicWrite(endpoint, attributeId)) + { + return false; + } + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + return GetAtomicWriteOriginatorScopedNodeId(endpoint) == sourceNodeId; +} + +bool ThermostatAttrAccess::InAtomicWrite( + EndpointId endpoint, CommandHandler * commandObj, + Platform::ScopedMemoryBufferWithSize & attributeStatuses) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep >= ArraySize(mAtomicWriteSessions)) + { + return false; + } + auto & atomicWriteSession = mAtomicWriteSessions[ep]; + if (atomicWriteSession.state != AtomicWriteState::Open) + { + return false; + } + if (atomicWriteSession.attributeIds.AllocatedSize() == 0 || + atomicWriteSession.attributeIds.AllocatedSize() != attributeStatuses.AllocatedSize()) + { + return false; + } + for (size_t i = 0; i < atomicWriteSession.attributeIds.AllocatedSize(); ++i) + { + bool hasAttribute = false; + auto attributeId = atomicWriteSession.attributeIds[i]; + for (size_t j = 0; j < attributeStatuses.AllocatedSize(); ++j) + { + auto & attributeStatus = attributeStatuses[j]; + if (attributeStatus.attributeID == attributeId) + { + hasAttribute = true; + break; + } + } + if (!hasAttribute) + { + return false; + } + } + return true; +} + +bool ThermostatAttrAccess::SetAtomicWrite( + EndpointId endpoint, ScopedNodeId originatorNodeId, AtomicWriteState state, + Platform::ScopedMemoryBufferWithSize & attributeStatuses) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep >= ArraySize(mAtomicWriteSessions)) + { + return false; + } + + auto & atomicWriteSession = mAtomicWriteSessions[ep]; + atomicWriteSession.endpointId = endpoint; + if (!atomicWriteSession.attributeIds.Alloc(attributeStatuses.AllocatedSize())) + { + atomicWriteSession.state = AtomicWriteState::Closed; + atomicWriteSession.nodeId = ScopedNodeId(); + return false; + } + + atomicWriteSession.state = state; + atomicWriteSession.nodeId = originatorNodeId; + + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + atomicWriteSession.attributeIds[i] = attributeStatuses[i].attributeID; + } + return true; +} + +void ThermostatAttrAccess::ResetAtomicWrite(EndpointId endpoint) +{ + auto delegate = GetDelegate(endpoint); + if (delegate != nullptr) + { + delegate->ClearPendingPresetList(); + } + ClearTimer(endpoint); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep >= ArraySize(mAtomicWriteSessions)) + { + return; + } + auto & atomicWriteSession = mAtomicWriteSessions[ep]; + atomicWriteSession.state = AtomicWriteState::Closed; + atomicWriteSession.endpointId = endpoint; + atomicWriteSession.nodeId = ScopedNodeId(); + atomicWriteSession.attributeIds.Free(); +} + +ScopedNodeId ThermostatAttrAccess::GetAtomicWriteOriginatorScopedNodeId(const EndpointId endpoint) +{ + ScopedNodeId originatorNodeId = ScopedNodeId(); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mAtomicWriteSessions)) + { + originatorNodeId = mAtomicWriteSessions[ep].nodeId; + } + return originatorNodeId; +} + +void SendAtomicResponse(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, Status status, + const Platform::ScopedMemoryBufferWithSize & attributeStatuses, + Optional timeout = NullOptional) +{ + Commands::AtomicResponse::Type response; + response.statusCode = to_underlying(status); + response.attributeStatus = + DataModel::List(attributeStatuses.Get(), attributeStatuses.AllocatedSize()); + response.timeout = timeout; + commandObj->AddResponse(commandPath, response); +} + +void ThermostatAttrAccess::BeginAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) +{ + EndpointId endpoint = commandPath.mEndpointId; + + auto delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + Platform::ScopedMemoryBufferWithSize attributeStatuses; + auto status = BuildAttributeStatuses(endpoint, commandData.attributeRequests, attributeStatuses); + if (status != Status::Success) + { + commandObj->AddStatus(commandPath, status); + return; + } + + if (InAtomicWrite(endpoint, commandObj)) + { + // This client already has an open atomic write + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + if (!commandData.timeout.HasValue()) + { + commandObj->AddStatus(commandPath, Status::InvalidCommand); + return; + } + + auto maximumTimeout = System::Clock::Milliseconds16(0); + auto attributeIdsIter = commandData.attributeRequests.begin(); + while (attributeIdsIter.Next()) + { + auto & attributeId = attributeIdsIter.GetValue(); + switch (attributeId) + { + case Presets::Id: + case Schedules::Id: + auto attributeTimeout = delegate->GetMaxAtomicWriteTimeout(attributeId); + + if (attributeTimeout.has_value()) + { + // Add to the maximum timeout + maximumTimeout += attributeTimeout.value(); + } + break; + } + } + + status = Status::Success; + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + auto & attributeStatus = attributeStatuses[i]; + auto statusCode = Status::Success; + switch (attributeStatus.attributeID) + { + case Presets::Id: + case Schedules::Id: + statusCode = InAtomicWrite(endpoint, MakeOptional(attributeStatus.attributeID)) ? Status::Busy : Status::Success; + break; + default: + statusCode = Status::InvalidCommand; + break; + } + if (statusCode != Status::Success) + { + status = Status::Failure; + } + attributeStatus.statusCode = to_underlying(statusCode); + } + + auto timeout = std::min(System::Clock::Milliseconds16(commandData.timeout.Value()), maximumTimeout); + if (timeout.count() == 0) + { + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + if (status == Status::Success) + { + if (!SetAtomicWrite(endpoint, GetSourceScopedNodeId(commandObj), AtomicWriteState::Open, attributeStatuses)) + { + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + attributeStatuses[i].statusCode = to_underlying(Status::ResourceExhausted); + } + status = Status::Failure; + } + else + { + // This is a valid request to open an atomic write. Tell the delegate it + // needs to keep track of a pending preset list now. + delegate->InitializePendingPresets(); + ScheduleTimer(endpoint, timeout); + } + } + + SendAtomicResponse(commandObj, commandPath, status, attributeStatuses, MakeOptional(timeout.count())); +} + +void ThermostatAttrAccess::CommitAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) +{ + EndpointId endpoint = commandPath.mEndpointId; + auto delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + Platform::ScopedMemoryBufferWithSize attributeStatuses; + auto status = BuildAttributeStatuses(endpoint, commandData.attributeRequests, attributeStatuses); + if (status != Status::Success) + { + commandObj->AddStatus(commandPath, status); + return; + } + + if (!InAtomicWrite(endpoint, commandObj, attributeStatuses)) + { + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + status = Status::Success; + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + auto & attributeStatus = attributeStatuses[i]; + auto statusCode = Status::Success; + switch (attributeStatus.attributeID) + { + case Presets::Id: + statusCode = PrecommitPresets(endpoint); + break; + case Schedules::Id: + statusCode = Status::Success; + break; + default: + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + attributeStatus.statusCode = to_underlying(statusCode); + if (statusCode != Status::Success) + { + status = Status::Failure; + } + } + + if (status == Status::Success) + { + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + auto & attributeStatus = attributeStatuses[i]; + auto statusCode = Status::Success; + CHIP_ERROR err; + switch (attributeStatus.attributeID) + { + case Presets::Id: + err = delegate->CommitPendingPresets(); + if (err != CHIP_NO_ERROR) + { + statusCode = Status::InvalidInState; + } + break; + case Schedules::Id: + break; + default: + // Not reachable, since we returned in this situation above. + break; + } + attributeStatus.statusCode = to_underlying(statusCode); + if (statusCode != Status::Success) + { + status = Status::Failure; + } + } + } + + ResetAtomicWrite(endpoint); + SendAtomicResponse(commandObj, commandPath, status, attributeStatuses); +} + +void ThermostatAttrAccess::RollbackAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) +{ + + EndpointId endpoint = commandPath.mEndpointId; + auto delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + Platform::ScopedMemoryBufferWithSize attributeStatuses; + auto status = BuildAttributeStatuses(endpoint, commandData.attributeRequests, attributeStatuses); + if (status != Status::Success) + { + commandObj->AddStatus(commandPath, status); + return; + } + + if (!InAtomicWrite(endpoint, commandObj, attributeStatuses)) + { + // There's no open atomic write + commandObj->AddStatus(commandPath, Status::InvalidInState); + return; + } + + ResetAtomicWrite(endpoint); + + for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) + { + attributeStatuses[i].statusCode = to_underlying(Status::Success); + } + + SendAtomicResponse(commandObj, commandPath, status, attributeStatuses); +} + +void MatterThermostatClusterServerShutdownCallback(EndpointId endpoint) +{ + ChipLogProgress(Zcl, "Shutting down thermostat server cluster on endpoint %d", endpoint); + gThermostatAttrAccess.ResetAtomicWrite(endpoint); +} + +bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +{ + auto & requestType = commandData.requestType; + + // If we've gotten this far, then the client has manage permission to call AtomicRequest, which is also the + // privilege necessary to write to the atomic attributes, so no need to check + + switch (requestType) + { + case Globals::AtomicRequestTypeEnum::kBeginWrite: + gThermostatAttrAccess.BeginAtomicWrite(commandObj, commandPath, commandData); + return true; + case Globals::AtomicRequestTypeEnum::kCommitWrite: + gThermostatAttrAccess.CommitAtomicWrite(commandObj, commandPath, commandData); + return true; + case Globals::AtomicRequestTypeEnum::kRollbackWrite: + gThermostatAttrAccess.RollbackAtomicWrite(commandObj, commandPath, commandData); + return true; + case Globals::AtomicRequestTypeEnum::kUnknownEnumValue: + commandObj->AddStatus(commandPath, Status::InvalidCommand); + return true; + } + + return false; +} + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip + +bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +{ + return Thermostat::emberAfThermostatClusterAtomicRequestCallback(commandObj, commandPath, commandData); +} + +void MatterThermostatClusterServerShutdownCallback(EndpointId endpoint) +{ + Thermostat::MatterThermostatClusterServerShutdownCallback(endpoint); +} diff --git a/src/app/clusters/thermostat-server/thermostat-server-presets.cpp b/src/app/clusters/thermostat-server/thermostat-server-presets.cpp new file mode 100644 index 00000000000000..e57c2f9c95f8fd --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-server-presets.cpp @@ -0,0 +1,546 @@ +/** + * + * Copyright (c) 2024 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 "thermostat-server.h" + +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Attributes; +using namespace chip::app::Clusters::Thermostat::Structs; +using namespace chip::app::Clusters::Globals::Structs; +using namespace chip::Protocols::InteractionModel; + +namespace { + +/** + * @brief Check if a preset is valid. + * + * @param[in] preset The preset to check. + * + * @return true If the preset is valid i.e the PresetHandle (if not null) fits within size constraints and the presetScenario enum + * value is valid. Otherwise, return false. + */ +bool IsValidPresetEntry(const PresetStruct::Type & preset) +{ + // Check that the preset handle is not too long. + if (!preset.presetHandle.IsNull() && preset.presetHandle.Value().size() > kPresetHandleSize) + { + return false; + } + + // Ensure we have a valid PresetScenario. + return (preset.presetScenario != PresetScenarioEnum::kUnknownEnumValue); +} + +/** + * @brief Checks if the preset is built-in + * + * @param[in] preset The preset to check. + * + * @return true If the preset is built-in, false otherwise. + */ +bool IsBuiltIn(const PresetStructWithOwnedMembers & preset) +{ + return preset.GetBuiltIn().ValueOr(false); +} + +/** + * @brief Checks if the presets are matching i.e the presetHandles are the same. + * + * @param[in] preset The preset to check. + * @param[in] presetToMatch The preset to match with. + * + * @return true If the presets match, false otherwise. If both preset handles are null, returns false + */ +bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) +{ + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && + preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); +} + +/** + * @brief Finds an entry in the pending presets list that matches a preset. + * The presetHandle of the two presets must match. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * + * @return true if a matching entry was found in the pending presets list, false otherwise. + */ +bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return false; + } + + if (PresetHandlesExistAndMatch(preset, presetToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Finds and returns an entry in the Presets attribute list that matches + * a preset, if such an entry exists. The presetToMatch must have a preset handle. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * @param[out] matchingPreset The preset in the Presets attribute list that has the same PresetHandle as the presetToMatch. + * + * @return true if a matching entry was found in the presets attribute list, false otherwise. + */ +bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStruct::Type & presetToMatch, + PresetStructWithOwnedMembers & matchingPreset) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "GetMatchingPresetInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return false; + } + + // Note: presets coming from our delegate always have a handle. + if (presetToMatch.presetHandle.Value().data_equal(matchingPreset.GetPresetHandle().Value())) + { + return true; + } + } + return false; +} + +/** + * @brief Returns the length of the list of presets if the pending presets were to be applied. The size of the pending presets list + * calculated, after all the constraint checks are done, is the new size of the updated Presets attribute since the pending + * preset list is expected to have all existing presets with or without edits plus new presets. + * This is called before changes are actually applied. + * + * @param[in] delegate The delegate to use. + * + * @return count of the updated Presets attribute if the pending presets were applied to it. Return 0 for error cases. + */ +uint8_t CountNumberOfPendingPresets(Delegate * delegate) +{ + uint8_t numberOfPendingPresets = 0; + + VerifyOrReturnValue(delegate != nullptr, 0); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers pendingPreset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, pendingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "CountNumberOfPendingPresets: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return 0; + } + numberOfPendingPresets++; + } + + return numberOfPendingPresets; +} + +/** + * @brief Checks if the presetScenario is present in the PresetTypes attribute. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetScenario is found, false otherwise. + */ +bool PresetScenarioExistsInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == presetScenario) + { + return true; + } + } + return false; +} + +/** + * @brief Returns the count of preset entries in the pending presets list that have the matching presetHandle. + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match. + * + * @return count of the number of presets found with the matching presetHandle. Returns 0 if no matching presets were found. + */ +uint8_t CountPresetsInPendingListWithPresetHandle(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + uint8_t count = 0; + VerifyOrReturnValue(delegate != nullptr, count); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPendingPresetAtIndex(i, preset); + if (err != CHIP_NO_ERROR) + { + return count; + } + + DataModel::Nullable presetHandle = preset.GetPresetHandle(); + if (!presetHandle.IsNull() && presetHandle.Value().data_equal(presetHandleToMatch)) + { + count++; + } + } + return count; +} + +/** + * @brief Checks if the presetType for the given preset scenario supports name in the presetTypeFeatures bitmap. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetType for the given preset scenario supports name, false otherwise. + */ +bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == scenario) + { + return (presetType.presetTypeFeatures.Has(PresetTypeFeaturesBitmap::kSupportsNames)); + } + } + return false; +} + +/** + * @brief Checks if the given preset handle is present in the presets attribute + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match with. + * + * @return true if the given preset handle is present in the presets attribute list, false otherwise. + */ +bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + PresetStructWithOwnedMembers matchingPreset; + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return false; + } + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return false; + } + + if (!matchingPreset.GetPresetHandle().IsNull() && matchingPreset.GetPresetHandle().Value().data_equal(presetHandleToMatch)) + { + return true; + } + } + return false; +} + +} // namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +extern ThermostatAttrAccess gThermostatAttrAccess; +extern int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint); +extern int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoint); + +Status ThermostatAttrAccess::SetActivePreset(EndpointId endpoint, DataModel::Nullable presetHandle) +{ + + auto delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return Status::InvalidInState; + } + + // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. + if (!presetHandle.IsNull() && !IsPresetHandlePresentInPresets(delegate, presetHandle.Value())) + { + return Status::InvalidCommand; + } + + CHIP_ERROR err = delegate->SetActivePresetHandle(presetHandle); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format()); + return StatusIB(err).mStatus; + } + + return Status::Success; +} + +CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * delegate, const PresetStruct::Type & preset) +{ + if (!IsValidPresetEntry(preset)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + if (preset.presetHandle.IsNull()) + { + if (IsBuiltIn(preset)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + else + { + auto & presetHandle = preset.presetHandle.Value(); + + // Per spec we need to check that: + // (a) There is an existing non-pending preset with this handle. + PresetStructWithOwnedMembers matchingPreset; + if (!GetMatchingPresetInPresets(delegate, preset, matchingPreset)) + { + return CHIP_IM_GLOBAL_STATUS(NotFound); + } + + // (b) There is no existing pending preset with this handle. + if (CountPresetsInPendingListWithPresetHandle(delegate, presetHandle) > 0) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + // (c)/(d) The built-in fields do not have a mismatch. + // TODO: What's the story with nullability on the BuiltIn field? + if (!preset.builtIn.IsNull() && !matchingPreset.GetBuiltIn().IsNull() && + preset.builtIn.Value() != matchingPreset.GetBuiltIn().Value()) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + + if (!PresetScenarioExistsInPresetTypes(delegate, preset.presetScenario)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + if (preset.name.HasValue() && !PresetTypeSupportsNames(delegate, preset.presetScenario)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + return delegate->AppendToPendingPresetList(preset); +} + +Status ThermostatAttrAccess::PrecommitPresets(EndpointId endpoint) +{ + auto delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return Status::InvalidInState; + } + + CHIP_ERROR err = CHIP_NO_ERROR; + + // For each preset in the presets attribute, check that the matching preset in the pending presets list does not + // violate any spec constraints. + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + err = delegate->GetPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); + return Status::InvalidInState; + } + + bool found = MatchingPendingPresetExists(delegate, preset); + + // If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return + // CONSTRAINT_ERROR. + if (IsBuiltIn(preset) && !found) + { + return Status::ConstraintError; + } + } + + // If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle + // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle + // attribute set, continue with other checks. + uint8_t buffer[kPresetHandleSize]; + MutableByteSpan activePresetHandleSpan(buffer); + auto activePresetHandle = DataModel::MakeNullable(activePresetHandleSpan); + + err = delegate->GetActivePresetHandle(activePresetHandle); + + if (err != CHIP_NO_ERROR) + { + return Status::InvalidInState; + } + + if (!activePresetHandle.IsNull()) + { + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle.Value()); + if (count == 0) + { + return Status::InvalidInState; + } + } + + // For each preset in the pending presets list, check that the preset does not violate any spec constraints. + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers pendingPreset; + err = delegate->GetPendingPresetAtIndex(i, pendingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); + return Status::InvalidInState; + } + + // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. + // TODO: This code does not work, because it's modifying our temporary copy. + Optional coolingSetpointValue = pendingPreset.GetCoolingSetpoint(); + if (coolingSetpointValue.HasValue()) + { + pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); + } + + Optional heatingSetpointValue = pendingPreset.GetHeatingSetpoint(); + if (heatingSetpointValue.HasValue()) + { + pendingPreset.SetHeatingSetpoint(MakeOptional(EnforceHeatingSetpointLimits(heatingSetpointValue.Value(), endpoint))); + } + } + + uint8_t totalCount = CountNumberOfPendingPresets(delegate); + + uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets(); + + if (numberOfPresetsSupported == 0) + { + ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); + return Status::InvalidInState; + } + + // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, + // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. + if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) + { + return Status::ResourceExhausted; + } + + // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that + // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. + return Status::Success; +} + +bool emberAfThermostatClusterSetActivePresetRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::SetActivePresetRequest::DecodableType & commandData) +{ + auto status = gThermostatAttrAccess.SetActivePreset(commandPath.mEndpointId, commandData.presetHandle); + commandObj->AddStatus(commandPath, status); + return true; +} + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip + +bool emberAfThermostatClusterSetActivePresetRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::SetActivePresetRequest::DecodableType & commandData) +{ + return Thermostat::emberAfThermostatClusterSetActivePresetRequestCallback(commandObj, commandPath, commandData); +} diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 8fe70211eeda1a..fe8ccf8aab3cf0 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -30,7 +30,6 @@ #include #include #include -#include using namespace chip; using namespace chip::app; @@ -38,8 +37,7 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::Thermostat; using namespace chip::app::Clusters::Thermostat::Structs; using namespace chip::app::Clusters::Thermostat::Attributes; - -using imcode = Protocols::InteractionModel::Status; +using namespace Protocols::InteractionModel; constexpr int16_t kDefaultAbsMinHeatSetpointLimit = 700; // 7C (44.5 F) is the default constexpr int16_t kDefaultAbsMaxHeatSetpointLimit = 3000; // 30C (86 F) is the default @@ -69,381 +67,16 @@ constexpr int8_t kDefaultDeadBand = 25; // 2.5C is the default #define FEATURE_MAP_DEFAULT FEATURE_MAP_HEAT | FEATURE_MAP_COOL | FEATURE_MAP_AUTO -namespace { - -ThermostatAttrAccess gThermostatAttrAccess; - static_assert(kThermostatEndpointCount <= kEmberInvalidEndpointIndex, "Thermostat Delegate table size error"); Delegate * gDelegateTable[kThermostatEndpointCount] = { nullptr }; -Delegate * GetDelegate(EndpointId endpoint) -{ - uint16_t ep = - emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - return (ep >= ArraySize(gDelegateTable) ? nullptr : gDelegateTable[ep]); -} - -/** - * @brief Check if a preset is valid. - * - * @param[in] preset The preset to check. - * - * @return true If the preset is valid i.e the PresetHandle (if not null) fits within size constraints and the presetScenario enum - * value is valid. Otherwise, return false. - */ -bool IsValidPresetEntry(const PresetStruct::Type & preset) -{ - // Check that the preset handle is not too long. - if (!preset.presetHandle.IsNull() && preset.presetHandle.Value().size() > kPresetHandleSize) - { - return false; - } - - // Ensure we have a valid PresetScenario. - return (preset.presetScenario != PresetScenarioEnum::kUnknownEnumValue); -} - -/** - * @brief Callback that is called when the timeout for editing the presets expires. - * - * @param[in] systemLayer The system layer. - * @param[in] callbackContext The context passed to the timer callback. - */ -void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) -{ - EndpointId endpoint = static_cast(reinterpret_cast(callbackContext)); - - Delegate * delegate = GetDelegate(endpoint); - VerifyOrReturn(delegate != nullptr, ChipLogError(Zcl, "Delegate is null. Unable to handle timer expired")); - - delegate->ClearPendingPresetList(); - gThermostatAttrAccess.SetAtomicWrite(endpoint, ScopedNodeId(), kAtomicWriteState_Closed); -} - -/** - * @brief Schedules a timer for the given timeout in milliseconds. - * - * @param[in] endpoint The endpoint to use. - * @param[in] timeoutMilliseconds The timeout in milliseconds. - */ -void ScheduleTimer(EndpointId endpoint, System::Clock::Milliseconds16 timeout) -{ - DeviceLayer::SystemLayer().StartTimer(timeout, TimerExpiredCallback, - reinterpret_cast(static_cast(endpoint))); -} - -/** - * @brief Clears the currently scheduled timer. - * - * @param[in] endpoint The endpoint to use. - */ -void ClearTimer(EndpointId endpoint) -{ - DeviceLayer::SystemLayer().CancelTimer(TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); -} - -/** - * @brief Checks if the preset is built-in - * - * @param[in] preset The preset to check. - * - * @return true If the preset is built-in, false otherwise. - */ -bool IsBuiltIn(const PresetStructWithOwnedMembers & preset) -{ - return preset.GetBuiltIn().ValueOr(false); -} - -/** - * @brief Checks if the presets are matching i.e the presetHandles are the same. - * - * @param[in] preset The preset to check. - * @param[in] presetToMatch The preset to match with. - * - * @return true If the presets match, false otherwise. If both preset handles are null, returns false - */ -bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) -{ - return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && - preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); -} - -/** - * @brief Get the source scoped node id. - * - * @param[in] commandObj The command handler object. - * - * @return The scoped node id of the source node. If the scoped node id is not retreived, return ScopedNodeId(). - */ -ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) -{ - ScopedNodeId sourceNodeId = ScopedNodeId(); - auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); - - if (sessionHandle->IsSecureSession()) - { - sourceNodeId = sessionHandle->AsSecureSession()->GetPeer(); - } - else if (sessionHandle->IsGroupSession()) - { - sourceNodeId = sessionHandle->AsIncomingGroupSession()->GetPeer(); - } - return sourceNodeId; -} - -/** - * @brief Discards pending atomic writes and atomic state. - * - * @param[in] delegate The delegate to use. - * @param[in] endpoint The endpoint to use. - * - */ -void resetAtomicWrite(Delegate * delegate, EndpointId endpoint) -{ - if (delegate != nullptr) - { - delegate->ClearPendingPresetList(); - } - ClearTimer(endpoint); - gThermostatAttrAccess.SetAtomicWrite(endpoint, ScopedNodeId(), kAtomicWriteState_Closed); -} - -/** - * @brief Finds an entry in the pending presets list that matches a preset. - * The presetHandle of the two presets must match. - * - * @param[in] delegate The delegate to use. - * @param[in] presetToMatch The preset to match with. - * - * @return true if a matching entry was found in the pending presets list, false otherwise. - */ -bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch) -{ - VerifyOrReturnValue(delegate != nullptr, false); - - for (uint8_t i = 0; true; i++) - { - PresetStructWithOwnedMembers preset; - CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, preset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - break; - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, - err.Format()); - return false; - } - - if (PresetHandlesExistAndMatch(preset, presetToMatch)) - { - return true; - } - } - return false; -} - -/** - * @brief Finds and returns an entry in the Presets attribute list that matches - * a preset, if such an entry exists. The presetToMatch must have a preset handle. - * - * @param[in] delegate The delegate to use. - * @param[in] presetToMatch The preset to match with. - * @param[out] matchingPreset The preset in the Presets attribute list that has the same PresetHandle as the presetToMatch. - * - * @return true if a matching entry was found in the presets attribute list, false otherwise. - */ -bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStruct::Type & presetToMatch, - PresetStructWithOwnedMembers & matchingPreset) -{ - VerifyOrReturnValue(delegate != nullptr, false); - - for (uint8_t i = 0; true; i++) - { - CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - break; - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "GetMatchingPresetInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); - return false; - } - - // Note: presets coming from our delegate always have a handle. - if (presetToMatch.presetHandle.Value().data_equal(matchingPreset.GetPresetHandle().Value())) - { - return true; - } - } - return false; -} - -/** - * @brief Checks if the given preset handle is present in the presets attribute - * @param[in] delegate The delegate to use. - * @param[in] presetHandleToMatch The preset handle to match with. - * - * @return true if the given preset handle is present in the presets attribute list, false otherwise. - */ -bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & presetHandleToMatch) -{ - VerifyOrReturnValue(delegate != nullptr, false); - - PresetStructWithOwnedMembers matchingPreset; - for (uint8_t i = 0; true; i++) - { - CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - return false; - } - - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, - err.Format()); - return false; - } - - if (!matchingPreset.GetPresetHandle().IsNull() && matchingPreset.GetPresetHandle().Value().data_equal(presetHandleToMatch)) - { - return true; - } - } - return false; -} - -/** - * @brief Returns the length of the list of presets if the pending presets were to be applied. The size of the pending presets list - * calculated, after all the constraint checks are done, is the new size of the updated Presets attribute since the pending - * preset list is expected to have all existing presets with or without edits plus new presets. - * This is called before changes are actually applied. - * - * @param[in] delegate The delegate to use. - * - * @return count of the updated Presets attribute if the pending presets were applied to it. Return 0 for error cases. - */ -uint8_t CountNumberOfPendingPresets(Delegate * delegate) -{ - uint8_t numberOfPendingPresets = 0; - - VerifyOrReturnValue(delegate != nullptr, 0); - - for (uint8_t i = 0; true; i++) - { - PresetStructWithOwnedMembers pendingPreset; - CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, pendingPreset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - break; - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "CountNumberOfPendingPresets: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, - err.Format()); - return 0; - } - numberOfPendingPresets++; - } - - return numberOfPendingPresets; -} - -/** - * @brief Checks if the presetScenario is present in the PresetTypes attribute. - * - * @param[in] delegate The delegate to use. - * @param[in] presetScenario The presetScenario to match with. - * - * @return true if the presetScenario is found, false otherwise. - */ -bool PresetScenarioExistsInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) -{ - VerifyOrReturnValue(delegate != nullptr, false); - - for (uint8_t i = 0; true; i++) - { - PresetTypeStruct::Type presetType; - auto err = delegate->GetPresetTypeAtIndex(i, presetType); - if (err != CHIP_NO_ERROR) - { - return false; - } - - if (presetType.presetScenario == presetScenario) - { - return true; - } - } - return false; -} - -/** - * @brief Returns the count of preset entries in the pending presets list that have the matching presetHandle. - * @param[in] delegate The delegate to use. - * @param[in] presetHandleToMatch The preset handle to match. - * - * @return count of the number of presets found with the matching presetHandle. Returns 0 if no matching presets were found. - */ -uint8_t CountPresetsInPendingListWithPresetHandle(Delegate * delegate, const ByteSpan & presetHandleToMatch) -{ - uint8_t count = 0; - VerifyOrReturnValue(delegate != nullptr, count); - - for (uint8_t i = 0; true; i++) - { - PresetStructWithOwnedMembers preset; - auto err = delegate->GetPendingPresetAtIndex(i, preset); - if (err != CHIP_NO_ERROR) - { - return count; - } - - DataModel::Nullable presetHandle = preset.GetPresetHandle(); - if (!presetHandle.IsNull() && presetHandle.Value().data_equal(presetHandleToMatch)) - { - count++; - } - } - return count; -} - -/** - * @brief Checks if the presetType for the given preset scenario supports name in the presetTypeFeatures bitmap. - * - * @param[in] delegate The delegate to use. - * @param[in] presetScenario The presetScenario to match with. - * - * @return true if the presetType for the given preset scenario supports name, false otherwise. - */ -bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) -{ - VerifyOrReturnValue(delegate != nullptr, false); - - for (uint8_t i = 0; true; i++) - { - PresetTypeStruct::Type presetType; - auto err = delegate->GetPresetTypeAtIndex(i, presetType); - if (err != CHIP_NO_ERROR) - { - return false; - } +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { - if (presetType.presetScenario == scenario) - { - return (presetType.presetTypeFeatures.Has(PresetTypeFeaturesBitmap::kSupportsNames)); - } - } - return false; -} +ThermostatAttrAccess gThermostatAttrAccess; int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint) { @@ -461,7 +94,7 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - imcode status; + Status status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -471,24 +104,24 @@ int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); } status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); } status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { MinHeatSetpointLimit = AbsMinHeatSetpointLimit; } status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; } @@ -532,7 +165,7 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // Note that the limits are initialized above per the spec limits // if they are not present Get() will not update the value so the defaults are used - imcode status; + Status status; // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 // behavior is not specified when Abs * values are not present and user values are present @@ -542,25 +175,25 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin // if a attribute is not present then it's default shall be used. status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); } status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); } status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { MinCoolSetpointLimit = AbsMinCoolSetpointLimit; } status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); - if (status != imcode::Success) + if (status != Status::Success) { MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; } @@ -587,81 +220,22 @@ int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoin return CoolingSetpoint; } -} // anonymous namespace - -namespace chip { -namespace app { -namespace Clusters { -namespace Thermostat { - -void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) -{ - uint16_t ep = - emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - // if endpoint is found, add the delegate in the delegate table - if (ep < ArraySize(gDelegateTable)) - { - gDelegateTable[ep] = delegate; - } -} - -void ThermostatAttrAccess::SetAtomicWrite(EndpointId endpoint, ScopedNodeId originatorNodeId, AtomicWriteState state) -{ - uint16_t ep = - emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - - if (ep < ArraySize(mAtomicWriteSessions)) - { - mAtomicWriteSessions[ep].state = state; - mAtomicWriteSessions[ep].endpointId = endpoint; - mAtomicWriteSessions[ep].nodeId = originatorNodeId; - } -} - -bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint) +Delegate * GetDelegate(EndpointId endpoint) { - bool inAtomicWrite = false; uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - - if (ep < ArraySize(mAtomicWriteSessions)) - { - inAtomicWrite = (mAtomicWriteSessions[ep].state == kAtomicWriteState_Open); - } - return inAtomicWrite; -} - -bool ThermostatAttrAccess::InAtomicWrite(const Access::SubjectDescriptor & subjectDescriptor, EndpointId endpoint) -{ - if (!InAtomicWrite(endpoint)) - { - return false; - } - return subjectDescriptor.authMode == Access::AuthMode::kCase && - GetAtomicWriteScopedNodeId(endpoint) == ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); -} - -bool ThermostatAttrAccess::InAtomicWrite(CommandHandler * commandObj, EndpointId endpoint) -{ - if (!InAtomicWrite(endpoint)) - { - return false; - } - ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - return GetAtomicWriteScopedNodeId(endpoint) == sourceNodeId; + return (ep >= ArraySize(gDelegateTable) ? nullptr : gDelegateTable[ep]); } -ScopedNodeId ThermostatAttrAccess::GetAtomicWriteScopedNodeId(EndpointId endpoint) +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - ScopedNodeId originatorNodeId = ScopedNodeId(); uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - - if (ep < ArraySize(mAtomicWriteSessions)) + // if endpoint is found, add the delegate in the delegate table + if (ep < ArraySize(gDelegateTable)) { - originatorNodeId = mAtomicWriteSessions[ep].nodeId; + gDelegateTable[ep] = delegate; } - return originatorNodeId; } CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) @@ -669,7 +243,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A VerifyOrDie(aPath.mClusterId == Thermostat::Id); uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == Status::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -684,8 +258,8 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A if (localTemperatureNotExposedSupported) { BitMask valueRemoteSensing; - imcode status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); - if (status != imcode::Success) + Status status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); + if (status != Status::Success) { StatusIB statusIB(status); return statusIB.ToChipError(); @@ -725,7 +299,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); auto & subjectDescriptor = aEncoder.GetSubjectDescriptor(); - if (InAtomicWrite(subjectDescriptor, aPath.mEndpointId)) + if (InAtomicWrite(aPath.mEndpointId, subjectDescriptor, MakeOptional(aPath.mAttributeId))) { return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { for (uint8_t i = 0; true; i++) @@ -801,12 +375,12 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); // Presets are not editable, return INVALID_IN_STATE. - VerifyOrReturnError(InAtomicWrite(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), + VerifyOrReturnError(InAtomicWrite(endpoint, MakeOptional(aPath.mAttributeId)), CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); // OK, we're in an atomic write, make sure the requesting node is the same one that started the atomic write, // otherwise return BUSY. - if (!InAtomicWrite(subjectDescriptor, endpoint)) + if (!InAtomicWrite(endpoint, subjectDescriptor, MakeOptional(aPath.mAttributeId))) { ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); return CHIP_IM_GLOBAL_STATUS(Busy); @@ -848,14 +422,14 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } // This is not an atomic attribute, so check to make sure we don't have an atomic write going for this client - if (InAtomicWrite(subjectDescriptor, endpoint)) + if (InAtomicWrite(endpoint, subjectDescriptor)) { ChipLogError(Zcl, "Can not write to non-atomic attributes during atomic write"); return CHIP_IM_GLOBAL_STATUS(InvalidInState); } uint32_t ourFeatureMap; - bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && + bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == Status::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); switch (aPath.mAttributeId) @@ -869,7 +443,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } - imcode status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); + Status status = RemoteSensing::Set(aPath.mEndpointId, valueRemoteSensing); StatusIB statusIB(status); return statusIB.ToChipError(); } @@ -882,73 +456,14 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, return CHIP_NO_ERROR; } -CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * delegate, const PresetStruct::Type & preset) -{ - if (!IsValidPresetEntry(preset)) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - if (preset.presetHandle.IsNull()) - { - if (IsBuiltIn(preset)) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - } - else - { - auto & presetHandle = preset.presetHandle.Value(); - - // Per spec we need to check that: - // (a) There is an existing non-pending preset with this handle. - PresetStructWithOwnedMembers matchingPreset; - if (!GetMatchingPresetInPresets(delegate, preset, matchingPreset)) - { - return CHIP_IM_GLOBAL_STATUS(NotFound); - } - - // (b) There is no existing pending preset with this handle. - if (CountPresetsInPendingListWithPresetHandle(delegate, presetHandle) > 0) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - // (c)/(d) The built-in fields do not have a mismatch. - // TODO: What's the story with nullability on the BuiltIn field? - if (!preset.builtIn.IsNull() && !matchingPreset.GetBuiltIn().IsNull() && - preset.builtIn.Value() != matchingPreset.GetBuiltIn().Value()) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - } - - if (!PresetScenarioExistsInPresetTypes(delegate, preset.presetScenario)) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - if (preset.name.HasValue() && !PresetTypeSupportsNames(delegate, preset.presetScenario)) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - return delegate->AppendToPendingPresetList(preset); -} - void ThermostatAttrAccess::OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) { for (size_t i = 0; i < ArraySize(mAtomicWriteSessions); ++i) { - auto atomicWriteState = mAtomicWriteSessions[i]; - if (atomicWriteState.state == kAtomicWriteState_Open && atomicWriteState.nodeId.GetFabricIndex() == fabricIndex) + auto & atomicWriteState = mAtomicWriteSessions[i]; + if (atomicWriteState.state == AtomicWriteState::Open && atomicWriteState.nodeId.GetFabricIndex() == fabricIndex) { - auto delegate = GetDelegate(atomicWriteState.endpointId); - if (delegate == nullptr) - { - continue; - } - resetAtomicWrite(delegate, atomicWriteState.endpointId); + ResetAtomicWrite(atomicWriteState.endpointId); } } } @@ -1003,7 +518,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr bool CoolSupported = false; bool OccupancySupported = false; - if (FeatureMap::Get(endpoint, &OurFeatureMap) != imcode::Success) + if (FeatureMap::Get(endpoint, &OurFeatureMap) != Status::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -1020,63 +535,63 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (AutoSupported) { - if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != imcode::Success) + if (MinSetpointDeadBand::Get(endpoint, &DeadBand) != Status::Success) { DeadBand = kDefaultDeadBand; } DeadBandTemp = static_cast(DeadBand * 10); } - if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != imcode::Success) + if (AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit) != Status::Success) AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; - if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != imcode::Success) + if (AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit) != Status::Success) AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; - if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != imcode::Success) + if (MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit) != Status::Success) MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != imcode::Success) + if (MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit) != Status::Success) MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; - if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != imcode::Success) + if (AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit) != Status::Success) AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; - if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != imcode::Success) + if (AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit) != Status::Success) AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; - if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != imcode::Success) + if (MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit) != Status::Success) MinHeatSetpointLimit = AbsMinHeatSetpointLimit; - if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != imcode::Success) + if (MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit) != Status::Success) MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; if (CoolSupported) - if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != imcode::Success) + if (OccupiedCoolingSetpoint::Get(endpoint, &OccupiedCoolingSetpoint) != Status::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Cooling Setpoint"); - return imcode::Failure; + return Status::Failure; } if (HeatSupported) - if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != imcode::Success) + if (OccupiedHeatingSetpoint::Get(endpoint, &OccupiedHeatingSetpoint) != Status::Success) { ChipLogError(Zcl, "Error: Can not read Occupied Heating Setpoint"); - return imcode::Failure; + return Status::Failure; } if (CoolSupported && OccupancySupported) - if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != imcode::Success) + if (UnoccupiedCoolingSetpoint::Get(endpoint, &UnoccupiedCoolingSetpoint) != Status::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Cooling Setpoint"); - return imcode::Failure; + return Status::Failure; } if (HeatSupported && OccupancySupported) - if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != imcode::Success) + if (UnoccupiedHeatingSetpoint::Get(endpoint, &UnoccupiedHeatingSetpoint) != Status::Success) { ChipLogError(Zcl, "Error: Can not read Unoccupied Heating Setpoint"); - return imcode::Failure; + return Status::Failure; } switch (attributePath.mAttributeId) @@ -1084,143 +599,143 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case OccupiedHeatingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!HeatSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinHeatSetpointLimit || requested < MinHeatSetpointLimit || requested > AbsMaxHeatSetpointLimit || requested > MaxHeatSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested > OccupiedCoolingSetpoint - DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case OccupiedCoolingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!CoolSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinCoolSetpointLimit || requested < MinCoolSetpointLimit || requested > AbsMaxCoolSetpointLimit || requested > MaxCoolSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested < OccupiedHeatingSetpoint + DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case UnoccupiedHeatingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!(HeatSupported && OccupancySupported)) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinHeatSetpointLimit || requested < MinHeatSetpointLimit || requested > AbsMaxHeatSetpointLimit || requested > MaxHeatSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested > UnoccupiedCoolingSetpoint - DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case UnoccupiedCoolingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!(CoolSupported && OccupancySupported)) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinCoolSetpointLimit || requested < MinCoolSetpointLimit || requested > AbsMaxCoolSetpointLimit || requested > MaxCoolSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested < UnoccupiedHeatingSetpoint + DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case MinHeatSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!HeatSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinHeatSetpointLimit || requested > MaxHeatSetpointLimit || requested > AbsMaxHeatSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested > MinCoolSetpointLimit - DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case MaxHeatSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!HeatSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinHeatSetpointLimit || requested < MinHeatSetpointLimit || requested > AbsMaxHeatSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested > MaxCoolSetpointLimit - DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case MinCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!CoolSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinCoolSetpointLimit || requested > MaxCoolSetpointLimit || requested > AbsMaxCoolSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested < MinHeatSetpointLimit + DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case MaxCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); if (!CoolSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < AbsMinCoolSetpointLimit || requested < MinCoolSetpointLimit || requested > AbsMaxCoolSetpointLimit) - return imcode::InvalidValue; + return Status::InvalidValue; if (AutoSupported) { if (requested < MaxHeatSetpointLimit + DeadBandTemp) - return imcode::InvalidValue; + return Status::InvalidValue; } - return imcode::Success; + return Status::Success; } case MinSetpointDeadBand::Id: { requested = *value; if (!AutoSupported) - return imcode::UnsupportedAttribute; + return Status::UnsupportedAttribute; if (requested < 0 || requested > 25) - return imcode::InvalidValue; - return imcode::Success; + return Status::InvalidValue; + return Status::Success; } case ControlSequenceOfOperation::Id: { uint8_t requestedCSO; requestedCSO = *value; if (requestedCSO > to_underlying(ControlSequenceOfOperationEnum::kCoolingAndHeatingWithReheat)) - return imcode::InvalidValue; - return imcode::Success; + return Status::InvalidValue; + return Status::Success; } case SystemMode::Id: { ControlSequenceOfOperationEnum ControlSequenceOfOperation; - imcode status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); - if (status != imcode::Success) + Status status = ControlSequenceOfOperation::Get(endpoint, &ControlSequenceOfOperation); + if (status != Status::Success) { - return imcode::InvalidValue; + return Status::InvalidValue; } auto RequestedSystemMode = static_cast(*value); if (ControlSequenceOfOperation > ControlSequenceOfOperationEnum::kCoolingAndHeatingWithReheat || RequestedSystemMode > SystemModeEnum::kFanOnly) { - return imcode::InvalidValue; + return Status::InvalidValue; } switch (ControlSequenceOfOperation) @@ -1228,22 +743,22 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case ControlSequenceOfOperationEnum::kCoolingOnly: case ControlSequenceOfOperationEnum::kCoolingWithReheat: if (RequestedSystemMode == SystemModeEnum::kHeat || RequestedSystemMode == SystemModeEnum::kEmergencyHeat) - return imcode::InvalidValue; + return Status::InvalidValue; else - return imcode::Success; + return Status::Success; case ControlSequenceOfOperationEnum::kHeatingOnly: case ControlSequenceOfOperationEnum::kHeatingWithReheat: if (RequestedSystemMode == SystemModeEnum::kCool || RequestedSystemMode == SystemModeEnum::kPrecooling) - return imcode::InvalidValue; + return Status::InvalidValue; else - return imcode::Success; + return Status::Success; default: - return imcode::Success; + return Status::Success; } } default: - return imcode::Success; + return Status::Success; } } @@ -1279,363 +794,6 @@ bool emberAfThermostatClusterSetActiveScheduleRequestCallback( return false; } -bool emberAfThermostatClusterSetActivePresetRequestCallback( - CommandHandler * commandObj, const ConcreteCommandPath & commandPath, - const Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData) -{ - EndpointId endpoint = commandPath.mEndpointId; - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) - { - ChipLogError(Zcl, "Delegate is null"); - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; - } - - DataModel::Nullable newPresetHandle = commandData.presetHandle; - - // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. - if (!newPresetHandle.IsNull() && !IsPresetHandlePresentInPresets(delegate, newPresetHandle.Value())) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; - } - - CHIP_ERROR err = delegate->SetActivePresetHandle(newPresetHandle); - - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format()); - commandObj->AddStatus(commandPath, StatusIB(err).mStatus); - return true; - } - - commandObj->AddStatus(commandPath, imcode::Success); - return true; -} - -bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & commandData, bool requireBoth) -{ - auto attributeIdsIter = commandData.attributeRequests.begin(); - bool requestedPresets = false, requestedSchedules = false; - while (attributeIdsIter.Next()) - { - auto & attributeId = attributeIdsIter.GetValue(); - - switch (attributeId) - { - case Presets::Id: - if (requestedPresets) // Double-requesting an attribute is invalid - { - return false; - } - requestedPresets = true; - break; - case Schedules::Id: - if (requestedSchedules) // Double-requesting an attribute is invalid - { - return false; - } - requestedSchedules = true; - break; - default: - return false; - } - } - if (attributeIdsIter.GetStatus() != CHIP_NO_ERROR) - { - return false; - } - if (requireBoth) - { - return (requestedPresets && requestedSchedules); - } - // If the atomic request doesn't contain at least one of these attributes, it's invalid - return (requestedPresets || requestedSchedules); -} - -void sendAtomicResponse(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, imcode status, imcode presetsStatus, - imcode schedulesStatus, Optional timeout = NullOptional) -{ - Commands::AtomicResponse::Type response; - Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { - { .attributeID = Presets::Id, .statusCode = to_underlying(presetsStatus) }, - { .attributeID = Schedules::Id, .statusCode = to_underlying(schedulesStatus) } - }; - response.statusCode = to_underlying(status); - response.attributeStatus = attributeStatus; - response.timeout = timeout; - commandObj->AddResponse(commandPath, response); -} - -void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, - const Commands::AtomicRequest::DecodableType & commandData) -{ - EndpointId endpoint = commandPath.mEndpointId; - - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) - { - ChipLogError(Zcl, "Delegate is null"); - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - - if (gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint)) - { - // This client already has an open atomic write - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - - if (!commandData.timeout.HasValue()) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return; - } - - if (!validAtomicAttributes(commandData, false)) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return; - } - - if (gThermostatAttrAccess.InAtomicWrite(endpoint)) - { - sendAtomicResponse(commandObj, commandPath, imcode::Failure, imcode::Busy, imcode::Busy); - return; - } - - // This is a valid request to open an atomic write. Tell the delegate it - // needs to keep track of a pending preset list now. - delegate->InitializePendingPresets(); - - auto timeout = - delegate->GetAtomicWriteTimeout(commandData.attributeRequests, System::Clock::Milliseconds16(commandData.timeout.Value())); - - if (!timeout.has_value()) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return; - } - ScheduleTimer(endpoint, timeout.value()); - gThermostatAttrAccess.SetAtomicWrite(endpoint, GetSourceScopedNodeId(commandObj), kAtomicWriteState_Open); - sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success, - MakeOptional(timeout.value().count())); -} - -imcode commitPresets(Delegate * delegate, EndpointId endpoint) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - // For each preset in the presets attribute, check that the matching preset in the pending presets list does not - // violate any spec constraints. - for (uint8_t i = 0; true; i++) - { - PresetStructWithOwnedMembers preset; - err = delegate->GetPresetAtIndex(i, preset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - break; - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, - "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error " - "%" CHIP_ERROR_FORMAT, - err.Format()); - return imcode::InvalidInState; - } - - bool found = MatchingPendingPresetExists(delegate, preset); - - // If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return - // CONSTRAINT_ERROR. - if (IsBuiltIn(preset) && !found) - { - return imcode::ConstraintError; - } - } - - // If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle - // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle - // attribute set, continue with other checks. - uint8_t buffer[kPresetHandleSize]; - MutableByteSpan activePresetHandleSpan(buffer); - auto activePresetHandle = DataModel::MakeNullable(activePresetHandleSpan); - - err = delegate->GetActivePresetHandle(activePresetHandle); - - if (err != CHIP_NO_ERROR) - { - return imcode::InvalidInState; - } - - if (!activePresetHandle.IsNull()) - { - uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle.Value()); - if (count == 0) - { - return imcode::InvalidInState; - } - } - - // For each preset in the pending presets list, check that the preset does not violate any spec constraints. - for (uint8_t i = 0; true; i++) - { - PresetStructWithOwnedMembers pendingPreset; - err = delegate->GetPendingPresetAtIndex(i, pendingPreset); - - if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) - { - break; - } - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, - "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error " - "%" CHIP_ERROR_FORMAT, - err.Format()); - return imcode::InvalidInState; - } - - // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. - // TODO: This code does not work, because it's modifying our temporary copy. - Optional coolingSetpointValue = pendingPreset.GetCoolingSetpoint(); - if (coolingSetpointValue.HasValue()) - { - pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); - } - - Optional heatingSetpointValue = pendingPreset.GetHeatingSetpoint(); - if (heatingSetpointValue.HasValue()) - { - pendingPreset.SetHeatingSetpoint(MakeOptional(EnforceHeatingSetpointLimits(heatingSetpointValue.Value(), endpoint))); - } - } - - uint8_t totalCount = CountNumberOfPendingPresets(delegate); - - uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets(); - - if (numberOfPresetsSupported == 0) - { - ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); - return imcode::InvalidInState; - } - - // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, - // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. - if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) - { - return imcode::ResourceExhausted; - } - - // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that - // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. - - // Call the delegate API to apply the pending presets to the presets attribute and update it. - err = delegate->ApplyPendingPresets(); - - if (err != CHIP_NO_ERROR) - { - return imcode::InvalidInState; - } - - return imcode::Success; -} - -void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, - const Commands::AtomicRequest::DecodableType & commandData) -{ - if (!validAtomicAttributes(commandData, true)) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return; - } - EndpointId endpoint = commandPath.mEndpointId; - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); - if (!inAtomicWrite) - { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) - { - ChipLogError(Zcl, "Delegate is null"); - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - - auto presetsStatus = commitPresets(delegate, endpoint); - // TODO: copy over schedules code - auto schedulesStatus = imcode::Success; - resetAtomicWrite(delegate, endpoint); - imcode status = (presetsStatus == imcode::Success && schedulesStatus == imcode::Success) ? imcode::Success : imcode::Failure; - sendAtomicResponse(commandObj, commandPath, status, presetsStatus, schedulesStatus); -} - -void handleAtomicRollback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, - const Commands::AtomicRequest::DecodableType & commandData) -{ - if (!validAtomicAttributes(commandData, true)) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return; - } - EndpointId endpoint = commandPath.mEndpointId; - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); - if (!inAtomicWrite) - { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) - { - ChipLogError(Zcl, "Delegate is null"); - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return; - } - resetAtomicWrite(delegate, endpoint); - sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success); -} - -bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, - const Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) -{ - auto & requestType = commandData.requestType; - - // If we've gotten this far, then the client has manage permission to call AtomicRequest, which is also the - // privilege necessary to write to the atomic attributes, so no need to check - - switch (requestType) - { - case Globals::AtomicRequestTypeEnum::kBeginWrite: - handleAtomicBegin(commandObj, commandPath, commandData); - return true; - case Globals::AtomicRequestTypeEnum::kCommitWrite: - handleAtomicCommit(commandObj, commandPath, commandData); - return true; - case Globals::AtomicRequestTypeEnum::kRollbackWrite: - handleAtomicRollback(commandObj, commandPath, commandData); - return true; - case Globals::AtomicRequestTypeEnum::kUnknownEnumValue: - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; - } - - return false; -} - bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::SetpointRaiseLower::DecodableType & commandData) @@ -1646,9 +804,9 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co EndpointId aEndpointId = commandPath.mEndpointId; int16_t HeatingSetpoint = kDefaultHeatingSetpoint, CoolingSetpoint = kDefaultCoolingSetpoint; // Set to defaults to be safe - imcode status = imcode::Failure; - imcode WriteCoolingSetpointStatus = imcode::Failure; - imcode WriteHeatingSetpointStatus = imcode::Failure; + Status status = Status::Failure; + Status WriteCoolingSetpointStatus = Status::Failure; + Status WriteHeatingSetpointStatus = Status::Failure; int16_t DeadBandTemp = 0; int8_t DeadBand = 0; uint32_t OurFeatureMap; @@ -1656,7 +814,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co bool HeatSupported = false; bool CoolSupported = false; - if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != imcode::Success) + if (FeatureMap::Get(aEndpointId, &OurFeatureMap) != Status::Success) OurFeatureMap = FEATURE_MAP_DEFAULT; if (OurFeatureMap & 1 << 5) // Bit 5 is Auto Mode supported @@ -1670,7 +828,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (AutoSupported) { - if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != imcode::Success) + if (MinSetpointDeadBand::Get(aEndpointId, &DeadBand) != Status::Success) DeadBand = kDefaultDeadBand; DeadBandTemp = static_cast(DeadBand * 10); } @@ -1681,13 +839,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && CoolSupported) { int16_t DesiredCoolingSetpoint, CoolLimit, DesiredHeatingSetpoint, HeatLimit; - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == Status::Success) { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == Status::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - @@ -1709,12 +867,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co } } WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, DesiredCoolingSetpoint); - if (WriteCoolingSetpointStatus != imcode::Success) + if (WriteCoolingSetpointStatus != Status::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, DesiredHeatingSetpoint); - if (WriteHeatingSetpointStatus != imcode::Success) + if (WriteHeatingSetpointStatus != Status::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } @@ -1726,12 +884,12 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (CoolSupported && !HeatSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == Status::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); WriteCoolingSetpointStatus = OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint); - if (WriteCoolingSetpointStatus != imcode::Success) + if (WriteCoolingSetpointStatus != Status::Success) { ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); } @@ -1740,34 +898,34 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co if (HeatSupported && !CoolSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == Status::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); WriteHeatingSetpointStatus = OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint); - if (WriteHeatingSetpointStatus != imcode::Success) + if (WriteHeatingSetpointStatus != Status::Success) { ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); } } } - if ((!HeatSupported || WriteHeatingSetpointStatus == imcode::Success) && - (!CoolSupported || WriteCoolingSetpointStatus == imcode::Success)) - status = imcode::Success; + if ((!HeatSupported || WriteHeatingSetpointStatus == Status::Success) && + (!CoolSupported || WriteCoolingSetpointStatus == Status::Success)) + status = Status::Success; break; case SetpointRaiseLowerModeEnum::kCool: if (CoolSupported) { - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == Status::Success) { CoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolingSetpoint = EnforceCoolingSetpointLimits(CoolingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == Status::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -1778,10 +936,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == Status::Success) { - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) - status = imcode::Success; + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == Status::Success) + status = Status::Success; } else ChipLogError(Zcl, "Error: SetOccupiedHeatingSetpoint failed!"); @@ -1789,7 +947,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust heating setpoint to maintain dead band!"); - status = imcode::InvalidCommand; + status = Status::InvalidCommand; } } else @@ -1807,20 +965,20 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedCoolingSetpoint failed!"); } else - status = imcode::InvalidCommand; + status = Status::InvalidCommand; break; case SetpointRaiseLowerModeEnum::kHeat: if (HeatSupported) { - if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) + if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == Status::Success) { HeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatingSetpoint = EnforceHeatingSetpointLimits(HeatingSetpoint, aEndpointId); if (AutoSupported) { // Need to check if we can move the cooling setpoint while maintaining the dead band - if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == imcode::Success) + if (OccupiedCoolingSetpoint::Get(aEndpointId, &CoolingSetpoint) == Status::Success) { if (CoolingSetpoint - HeatingSetpoint < DeadBandTemp) { @@ -1831,10 +989,10 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { // Desired cooling setpoint is enforcable // Set the new cooling and heating setpoints - if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == imcode::Success) + if (OccupiedCoolingSetpoint::Set(aEndpointId, CoolingSetpoint) == Status::Success) { - if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == imcode::Success) - status = imcode::Success; + if (OccupiedHeatingSetpoint::Set(aEndpointId, HeatingSetpoint) == Status::Success) + status = Status::Success; } else ChipLogError(Zcl, "Error: SetOccupiedCoolingSetpoint failed!"); @@ -1842,7 +1000,7 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co else { ChipLogError(Zcl, "Error: Could Not adjust cooling setpoint to maintain dead band!"); - status = imcode::InvalidCommand; + status = Status::InvalidCommand; } } else @@ -1860,11 +1018,11 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co ChipLogError(Zcl, "Error: GetOccupiedHeatingSetpoint failed!"); } else - status = imcode::InvalidCommand; + status = Status::InvalidCommand; break; default: - status = imcode::InvalidCommand; + status = Status::InvalidCommand; break; } @@ -1877,14 +1035,3 @@ void MatterThermostatPluginServerInitCallback() Server::GetInstance().GetFabricTable().AddFabricDelegate(&gThermostatAttrAccess); AttributeAccessInterfaceRegistry::Instance().Register(&gThermostatAttrAccess); } - -void MatterThermostatClusterServerShutdownCallback(EndpointId endpoint) -{ - ChipLogProgress(Zcl, "Shutting down thermostat server cluster on endpoint %d", endpoint); - Delegate * delegate = GetDelegate(endpoint); - - if (delegate != nullptr) - { - resetAtomicWrite(delegate, endpoint); - } -} diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index ddede8a9bb13f9..cc941cfa766d92 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -26,6 +26,7 @@ #include "thermostat-delegate.h" +#include #include #include @@ -34,25 +35,62 @@ namespace app { namespace Clusters { namespace Thermostat { +enum class AtomicWriteState +{ + Closed = 0, + Open, +}; + static constexpr size_t kThermostatEndpointCount = MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; -enum AtomicWriteState -{ - kAtomicWriteState_Closed = 0, - kAtomicWriteState_Open, -}; /** * @brief Thermostat Attribute Access Interface. */ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface, public chip::FabricTable::Delegate { + public: ThermostatAttrAccess() : AttributeAccessInterface(Optional::Missing(), Thermostat::Id) {} CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override; +private: + /** + * @brief Set the Active Preset to a given preset handle, or null + * + * @param endpoint The endpoint + * @param presetHandle The handle of the preset to set active, or null to clear the active preset + * @return Success if the active preset was updated, an error code if not + */ + Protocols::InteractionModel::Status SetActivePreset(EndpointId endpoint, DataModel::Nullable presetHandle); + + /** + * @brief Apply a preset to the pending lists of presets during an atomic write + * + * @param delegate The current ThermostatDelegate + * @param preset The preset to append + * @return CHIP_NO_ERROR if successful, an error code if not + */ + CHIP_ERROR AppendPendingPreset(Thermostat::Delegate * delegate, const Structs::PresetStruct::Type & preset); + + /** + * @brief Verifies if the pending presets for a given endpoint are valid + * + * @param endpoint The endpoint + * @return Success if the list of pending presets is valid, an error code if not + */ + Protocols::InteractionModel::Status PrecommitPresets(EndpointId endpoint); + + /** + * @brief Callback for when the server is removed from a given fabric; all associated atomic writes are reset + * + * @param fabricTable The fabric table + * @param fabricIndex The fabric index + */ + void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override; + /** * @brief Gets the scoped node id of the originator that sent the last successful * AtomicRequest of type BeginWrite for the given endpoint. @@ -61,7 +99,7 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface, public * * @return the scoped node id for the given endpoint if set. Otherwise returns ScopedNodeId(). */ - ScopedNodeId GetAtomicWriteScopedNodeId(EndpointId endpoint); + ScopedNodeId GetAtomicWriteOriginatorScopedNodeId(EndpointId endpoint); /** * @brief Sets the atomic write state for the given endpoint and originatorNodeId @@ -69,46 +107,119 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface, public * @param[in] endpoint The endpoint. * @param[in] originatorNodeId The originator scoped node id. * @param[in] state Whether or not an atomic write is open or closed. + * @param attributeStatuses The set of attribute status structs the atomic write should be associated with + * @return true if it was able to update the atomic write state + * @return false if it was unable to update the atomic write state */ - void SetAtomicWrite(EndpointId endpoint, ScopedNodeId originatorNodeId, AtomicWriteState state); + bool + SetAtomicWrite(EndpointId endpoint, ScopedNodeId originatorNodeId, AtomicWriteState state, + Platform::ScopedMemoryBufferWithSize & attributeStatuses); /** - * @brief Gets whether an atomic write is in progress for the given endpoint + * @brief Sets the atomic write state for the given endpoint and originatorNodeId * - * @param[in] endpoint The endpoint. + */ + /** + * @brief Resets the atomic write for a given endpoint * - * @return Whether an atomic write is in progress for the given endpoint + * @param endpoint The endpoint */ - bool InAtomicWrite(EndpointId endpoint); + void ResetAtomicWrite(EndpointId endpoint); /** - * @brief Gets whether an atomic write is in progress for the given endpoint + * @brief Checks if a given endpoint has an atomic write open, optionally filtered by an attribute ID * - * @param[in] subjectDescriptor The subject descriptor. - * @param[in] endpoint The endpoint. + * @param endpoint The endpoint + * @param attributeId The optional attribute ID to filter on + * @return true if the endpoint has an open atomic write + * @return false if the endpoint does not have an open atomic write + */ + bool InAtomicWrite(EndpointId endpoint, Optional attributeId = NullOptional); + + /** + * @brief Checks if a given endpoint has an atomic write open for a given subject descriptor, optionally filtered by an + * attribute ID * - * @return Whether an atomic write is in progress for the given endpoint + * @param endpoint The endpoint + * @param subjectDescriptor The subject descriptor for the client making a read or write request + * @param attributeId The optional attribute ID to filter on + * @return true if the endpoint has an open atomic write + * @return false if the endpoint does not have an open atomic write */ - bool InAtomicWrite(const Access::SubjectDescriptor & subjectDescriptor, EndpointId endpoint); + bool InAtomicWrite(EndpointId endpoint, const Access::SubjectDescriptor & subjectDescriptor, + Optional attributeId = NullOptional); /** - * @brief Gets whether an atomic write is in progress for the given endpoint + * @brief Checks if a given endpoint has an atomic write open for a given command invocation, optionally filtered by an + * attribute ID * - * @param[in] commandObj The command handler. - * @param[in] endpoint The endpoint. + * @param endpoint The endpoint + * @param commandObj The CommandHandler for the invoked command + * @param attributeId The optional attribute ID to filter on + * @return true if the endpoint has an open atomic write + * @return false if the endpoint does not have an open atomic write + */ + bool InAtomicWrite(EndpointId endpoint, CommandHandler * commandObj, Optional attributeId = NullOptional); + + /** + * @brief Checks if a given endpoint has an atomic write open for a given command invocation and a list of attributes * - * @return Whether an atomic write is in progress for the given endpoint + * @param endpoint The endpoint + * @param commandObj The CommandHandler for the invoked command + * @param attributeStatuses The list of attribute statuses whose attributeIds must match the open atomic write + * @return true if the endpoint has an open atomic write + * @return false if the endpoint does not have an open atomic write */ - bool InAtomicWrite(CommandHandler * commandObj, EndpointId endpoint); + bool + InAtomicWrite(EndpointId endpoint, CommandHandler * commandObj, + Platform::ScopedMemoryBufferWithSize & attributeStatuses); -private: - CHIP_ERROR AppendPendingPreset(Thermostat::Delegate * delegate, const Structs::PresetStruct::Type & preset); + /** + * @brief Handles an AtomicRequest of type BeginWrite + * + * @param commandObj The AtomicRequest command handler + * @param commandPath The path for the Atomic Request command + * @param commandData The payload data for the Atomic Request + */ + void BeginAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData); - void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override; + /** + * @brief Handles an AtomicRequest of type CommitWrite + * + * @param commandObj The AtomicRequest command handler + * @param commandPath The path for the Atomic Request command + * @param commandData The payload data for the Atomic Request + */ + void CommitAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData); + + /** + * @brief Handles an AtomicRequest of type RollbackWrite + * + * @param commandObj The AtomicRequest command handler + * @param commandPath The path for the Atomic Request command + * @param commandData The payload data for the Atomic Request + */ + void RollbackAtomicWrite(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData); + + friend void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext); + + friend void MatterThermostatClusterServerShutdownCallback(EndpointId endpoint); + + friend bool emberAfThermostatClusterSetActivePresetRequestCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData); + + friend bool + emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData); struct AtomicWriteSession { - AtomicWriteState state = kAtomicWriteState_Closed; + AtomicWriteState state = AtomicWriteState::Closed; + Platform::ScopedMemoryBufferWithSize attributeIds; ScopedNodeId nodeId; EndpointId endpointId = kInvalidEndpointId; }; @@ -124,6 +235,8 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface, public */ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); +Delegate * GetDelegate(EndpointId endpoint); + } // namespace Thermostat } // namespace Clusters } // namespace app diff --git a/src/python_testing/TC_TSTAT_4_2.py b/src/python_testing/TC_TSTAT_4_2.py index 5c289ced50604e..563d6f3f2eddfc 100644 --- a/src/python_testing/TC_TSTAT_4_2.py +++ b/src/python_testing/TC_TSTAT_4_2.py @@ -61,15 +61,30 @@ class TC_TSTAT_4_2(MatterBaseTest): def check_atomic_response(self, response: object, expected_status: Status = Status.Success, expected_overall_status: Status = Status.Success, - expected_preset_status: Status = Status.Success): + expected_preset_status: Status = Status.Success, + expected_schedules_status: Status = None, + expected_timeout: int = None): asserts.assert_equal(expected_status, Status.Success, "We expected we had a valid response") asserts.assert_equal(response.statusCode, expected_overall_status, "Response should have the right overall status") found_preset_status = False + found_schedules_status = False for attrStatus in response.attributeStatus: if attrStatus.attributeID == cluster.Attributes.Presets.attribute_id: asserts.assert_equal(attrStatus.statusCode, expected_preset_status, "Preset attribute should have the right status") found_preset_status = True + if attrStatus.attributeID == cluster.Attributes.Schedules.attribute_id: + asserts.assert_equal(attrStatus.statusCode, expected_schedules_status, + "Schedules attribute should have the right status") + found_schedules_status = True + if expected_timeout is not None: + asserts.assert_equal(response.timeout, expected_timeout, + "Timeout should have the right value") + asserts.assert_true(found_preset_status, "Preset attribute should have a status") + if expected_schedules_status is not None: + asserts.assert_true(found_schedules_status, "Schedules attribute should have a status") + asserts.assert_equal(attrStatus.statusCode, expected_schedules_status, + "Schedules attribute should have the right status") asserts.assert_true(found_preset_status, "Preset attribute should have a status") async def write_presets(self, @@ -87,17 +102,21 @@ async def write_presets(self, async def send_atomic_request_begin_command(self, dev_ctrl: ChipDeviceCtrl = None, endpoint: int = None, + timeout: int = 1800, expected_status: Status = Status.Success, expected_overall_status: Status = Status.Success, - expected_preset_status: Status = Status.Success): + expected_preset_status: Status = Status.Success, + expected_schedules_status: Status = None, + expected_timeout: int = None): try: response = await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=Globals.Enums.AtomicRequestTypeEnum.kBeginWrite, attributeRequests=[ cluster.Attributes.Presets.attribute_id], - timeout=1800), + timeout=timeout), dev_ctrl=dev_ctrl, endpoint=endpoint) - self.check_atomic_response(response, expected_status, expected_overall_status, expected_preset_status) + self.check_atomic_response(response, expected_status, expected_overall_status, + expected_preset_status, expected_schedules_status, expected_timeout) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") @@ -107,13 +126,15 @@ async def send_atomic_request_commit_command(self, endpoint: int = None, expected_status: Status = Status.Success, expected_overall_status: Status = Status.Success, - expected_preset_status: Status = Status.Success): + expected_preset_status: Status = Status.Success, + expected_schedules_status: Status = None): try: response = await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=Globals.Enums.AtomicRequestTypeEnum.kCommitWrite, - attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), + attributeRequests=[cluster.Attributes.Presets.attribute_id]), dev_ctrl=dev_ctrl, endpoint=endpoint) - self.check_atomic_response(response, expected_status, expected_overall_status, expected_preset_status) + self.check_atomic_response(response, expected_status, expected_overall_status, + expected_preset_status, expected_schedules_status) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") @@ -122,13 +143,16 @@ async def send_atomic_request_rollback_command(self, endpoint: int = None, expected_status: Status = Status.Success, expected_overall_status: Status = Status.Success, - expected_preset_status: Status = Status.Success): + expected_preset_status: Status = Status.Success, + expected_schedules_status: Status = None): try: response = await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=Globals.Enums.AtomicRequestTypeEnum.kRollbackWrite, - attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), + attributeRequests=[cluster.Attributes.Presets.attribute_id]), dev_ctrl=dev_ctrl, endpoint=endpoint) - self.check_atomic_response(response, expected_status, expected_overall_status, expected_preset_status) + self.check_atomic_response(response, expected_status, expected_overall_status, + expected_preset_status, expected_schedules_status) + except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") @@ -219,7 +243,6 @@ async def test_TC_TSTAT_4_2(self): await self.write_presets(endpoint=endpoint, presets=new_presets, expected_status=Status.InvalidInState) self.step("3") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.Cfe.Rsp")): await self.send_atomic_request_begin_command() @@ -260,7 +283,7 @@ async def test_TC_TSTAT_4_2(self): if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.Cfe.Rsp")): # Send the AtomicRequest begin command - await self.send_atomic_request_begin_command() + await self.send_atomic_request_begin_command(timeout=5000, expected_timeout=3000) # Write to the presets attribute after removing a built in preset from the list. Remove the first entry. test_presets = new_presets_with_handle.copy() @@ -406,10 +429,7 @@ async def test_TC_TSTAT_4_2(self): self.step("14") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.Cfe.Rsp")): - - # Send the AtomicRequest begin command await self.send_atomic_request_begin_command() - # Send the AtomicRequest begin command from separate controller, which should receive busy status = await self.send_atomic_request_begin_command(dev_ctrl=secondary_controller, expected_overall_status=Status.Failure, expected_preset_status=Status.Busy) From fe34e8198d8b27058b7d446516f5737e190d7326 Mon Sep 17 00:00:00 2001 From: Wang Qixiang <43193572+wqx6@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:17:10 +0800 Subject: [PATCH 42/53] esp32: fix compiling when enabling ble commissioner (#35085) * esp32: fix compiling when enabling ble commissioner * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/ESP32/nimble/BLEManagerImpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index 4f6ab4f73f7200..d4d90f45362dbe 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -659,7 +659,7 @@ CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const C if (pBuf->DataLength() > UINT16_MAX) { ChipLogError(Ble, "Buffer data Length is too long"); - return false; + return CHIP_ERROR_INVALID_ARGUMENT; } rc = ble_gattc_write_flat(conId, chr->chr.val_handle, pBuf->Start(), static_cast(pBuf->DataLength()), OnWriteComplete, this); @@ -1746,12 +1746,12 @@ void BLEManagerImpl::DriveBLEState(intptr_t arg) #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER CHIP_ERROR BLEManagerImpl::HandleRXNotify(struct ble_gap_event * ble_event) { - size_t dataLen = OS_MBUF_PKTLEN(ble_event->notify_rx.om); + uint16_t dataLen = OS_MBUF_PKTLEN(ble_event->notify_rx.om); System::PacketBufferHandle buf = System::PacketBufferHandle::New(dataLen, 0); VerifyOrReturnError(!buf.IsNull(), CHIP_ERROR_NO_MEMORY); - VerifyOrExit(buf->AvailableDataLength() >= data_len, err = CHIP_ERROR_BUFFER_TOO_SMALL); - ble_hs_mbuf_to_flat(ble_event->notify_rx.om, buf->Start(), data_len, NULL); - buf->SetDataLength(data_len); + VerifyOrReturnError(buf->AvailableDataLength() >= dataLen, CHIP_ERROR_BUFFER_TOO_SMALL); + ble_hs_mbuf_to_flat(ble_event->notify_rx.om, buf->Start(), dataLen, NULL); + buf->SetDataLength(dataLen); ChipLogDetail(DeviceLayer, "Indication received, conn = %d", ble_event->notify_rx.conn_handle); From 9520bef5d88e4ec9f208390182dce8d1b3f8a664 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 23 Aug 2024 12:06:22 -0400 Subject: [PATCH 43/53] Remove writeAttributeWithEndpointID implementation from MTRDevice. (#35170) This is implemented (differently) by the different subclasses. Once this implementation is removed, removeExpectedValueForAttributePath becomes unused and can be removed. Also removes the unused setExpectedValues declaration in MTRDevice_Internal.h and the implementations of it. --- src/darwin/Framework/CHIP/MTRDevice.mm | 136 ++---------------- .../Framework/CHIP/MTRDevice_Concrete.mm | 5 - .../Framework/CHIP/MTRDevice_Internal.h | 4 - 3 files changed, 9 insertions(+), 136 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 3f2acce5f5587e..f913f29388f5fb 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -1831,11 +1831,12 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) attributeID:(NSNumber *)attributeID params:(MTRReadParams * _Nullable)params { -#define ErrorStr "MTRDevice readAttributeWithEndpointID:clusterID:attributeID:params: must be handled by subclasses" - MTR_LOG_ERROR(ErrorStr); +#define MTRDeviceErrorStr "MTRDevice readAttributeWithEndpointID:clusterID:attributeID:params: must be handled by subclasses" + MTR_LOG_ERROR(MTRDeviceErrorStr); #ifdef DEBUG - NSAssert(NO, @ErrorStr); + NSAssert(NO, @MTRDeviceErrorStr); #endif // DEBUG +#undef MTRDeviceErrorStr return nil; } @@ -1846,120 +1847,12 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID expectedValueInterval:(NSNumber *)expectedValueInterval timedWriteTimeout:(NSNumber * _Nullable)timeout { - if (timeout) { - timeout = MTRClampedNumber(timeout, @(1), @(UINT16_MAX)); - } - expectedValueInterval = MTRClampedNumber(expectedValueInterval, @(1), @(UINT32_MAX)); - MTRAttributePath * attributePath = [MTRAttributePath attributePathWithEndpointID:endpointID - clusterID:clusterID - - attributeID:attributeID]; - - __block BOOL useValueAsExpectedValue = YES; +#define MTRDeviceErrorStr "MTRDevice writeAttributeWithEndpointID:clusterID:attributeID:value:expectedValueInterval:timedWriteTimeout: must be handled by subclasses" + MTR_LOG_ERROR(MTRDeviceErrorStr); #ifdef DEBUG - os_unfair_lock_lock(&self->_lock); - [self _callFirstDelegateSynchronouslyWithBlock:^(id delegate) { - if ([delegate respondsToSelector:@selector(unitTestShouldSkipExpectedValuesForWrite:)]) { - useValueAsExpectedValue = ![delegate unitTestShouldSkipExpectedValuesForWrite:self]; - } - }]; - os_unfair_lock_unlock(&self->_lock); -#endif - - uint64_t expectedValueID = 0; - if (useValueAsExpectedValue) { - // Commit change into expected value cache - NSDictionary * newExpectedValueDictionary = @{ MTRAttributePathKey : attributePath, MTRDataKey : value }; - [self setExpectedValues:@[ newExpectedValueDictionary ] - expectedValueInterval:expectedValueInterval - expectedValueID:&expectedValueID]; - } - - MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; - uint64_t workItemID = workItem.uniqueID; // capture only the ID, not the work item - NSNumber * nodeID = _nodeID; - - // Write request data is an array of items (for now always length 1). Each - // item is an array containing: - // - // [ attribute path, value, timedWriteTimeout, expectedValueID ] - // - // where expectedValueID is stored as NSNumber and NSNull represents nil timeouts - auto * writeData = @[ attributePath, [value copy], timeout ?: [NSNull null], @(expectedValueID) ]; - - NSMutableArray * writeRequests = [NSMutableArray arrayWithObject:writeData]; - - [workItem setBatchingID:MTRDeviceWorkItemBatchingWriteID data:writeRequests handler:^(id opaqueDataCurrent, id opaqueDataNext) { - mtr_hide(self); // don't capture self accidentally - NSMutableArray * writeRequestsCurrent = opaqueDataCurrent; - NSMutableArray * writeRequestsNext = opaqueDataNext; - - if (writeRequestsCurrent.count != 1) { - // Very unexpected! - MTR_LOG_ERROR("Batching write attribute work item [%llu]: Unexpected write request count %lu", workItemID, static_cast(writeRequestsCurrent.count)); - return MTRNotBatched; - } - - MTRBatchingOutcome outcome = MTRNotBatched; - while (writeRequestsNext.count) { - // If paths don't match, we cannot replace the earlier write - // with the later one. - if (![writeRequestsNext[0][MTRDeviceWriteRequestFieldPathIndex] - isEqual:writeRequestsCurrent[0][MTRDeviceWriteRequestFieldPathIndex]]) { - MTR_LOG("Batching write attribute work item [%llu]: cannot replace with next work item due to path mismatch", workItemID); - return outcome; - } - - // Replace our one request with the first one from the next item. - auto writeItem = writeRequestsNext.firstObject; - [writeRequestsNext removeObjectAtIndex:0]; - [writeRequestsCurrent replaceObjectAtIndex:0 withObject:writeItem]; - MTR_LOG("Batching write attribute work item [%llu]: replaced with new write value %@ [0x%016llX]", - workItemID, writeItem, nodeID.unsignedLongLongValue); - outcome = MTRBatchedPartially; - } - NSCAssert(writeRequestsNext.count == 0, @"should have batched everything or returned early"); - return MTRBatchedFully; - }]; - // The write operation will install a duplicate check handler, to return NO for "isDuplicate". Since a write operation may - // change values, only read requests after this should be considered for duplicate requests. - [workItem setDuplicateTypeID:MTRDeviceWorkItemDuplicateReadTypeID handler:^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { - *isDuplicate = NO; - *stop = YES; - }]; - [workItem setReadyHandler:^(MTRDevice * self, NSInteger retryCount, MTRAsyncWorkCompletionBlock completion) { - MTRBaseDevice * baseDevice = [self newBaseDevice]; - // Make sure to use writeRequests here, because that's what our batching - // handler will modify as needed. - NSCAssert(writeRequests.count == 1, @"Incorrect number of write requests: %lu", static_cast(writeRequests.count)); - - auto * request = writeRequests[0]; - MTRAttributePath * path = request[MTRDeviceWriteRequestFieldPathIndex]; - - id timedWriteTimeout = request[MTRDeviceWriteRequestFieldTimeoutIndex]; - if (timedWriteTimeout == [NSNull null]) { - timedWriteTimeout = nil; - } - - [baseDevice - writeAttributeWithEndpointID:path.endpoint - clusterID:path.cluster - attributeID:path.attribute - value:request[MTRDeviceWriteRequestFieldValueIndex] - timedWriteTimeout:timedWriteTimeout - queue:self.queue - completion:^(NSArray *> * _Nullable values, NSError * _Nullable error) { - if (error) { - MTR_LOG_ERROR("Write attribute work item [%llu] failed: %@", workItemID, error); - if (useValueAsExpectedValue) { - NSNumber * expectedValueID = request[MTRDeviceWriteRequestFieldExpectedValueIDIndex]; - [self removeExpectedValueForAttributePath:attributePath expectedValueID:expectedValueID.unsignedLongLongValue]; - } - } - completion(MTRAsyncWorkComplete); - }]; - }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; + NSAssert(NO, @MTRDeviceErrorStr); +#endif // DEBUG +#undef MTRDeviceErrorStr } - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID @@ -2796,11 +2689,6 @@ - (NSArray *)_getAttributesToReportWithNewExpectedValues:(NSArray *> *)values expectedValueInterval:(NSNumber *)expectedValueInterval -{ - [self setExpectedValues:values expectedValueInterval:expectedValueInterval expectedValueID:nil]; -} - // expectedValueID is an out-argument that returns an identifier to be used when removing expected values - (void)setExpectedValues:(NSArray *> *)values expectedValueInterval:(NSNumber *)expectedValueInterval @@ -2833,12 +2721,6 @@ - (void)removeExpectedValuesForAttributePaths:(NSArray *)att } } -- (void)removeExpectedValueForAttributePath:(MTRAttributePath *)attributePath expectedValueID:(uint64_t)expectedValueID -{ - std::lock_guard lock(_lock); - [self _removeExpectedValueForAttributePath:attributePath expectedValueID:expectedValueID]; -} - - (void)_removeExpectedValueForAttributePath:(MTRAttributePath *)attributePath expectedValueID:(uint64_t)expectedValueID { os_unfair_lock_assert_owner(&self->_lock); diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index 12614ea4091b0c..b7e7bf78027b4f 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -3644,11 +3644,6 @@ - (NSArray *)_getAttributesToReportWithNewExpectedValues:(NSArray *> *)values expectedValueInterval:(NSNumber *)expectedValueInterval -{ - [self setExpectedValues:values expectedValueInterval:expectedValueInterval expectedValueID:nil]; -} - // expectedValueID is an out-argument that returns an identifier to be used when removing expected values - (void)setExpectedValues:(NSArray *> *)values expectedValueInterval:(NSNumber *)expectedValueInterval diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index b6a59ac9321d42..dae183eec217f6 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -125,10 +125,6 @@ MTR_DIRECT_MEMBERS - (instancetype)initForSubclassesWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller; - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller; -// Called from MTRClusters for writes and commands -- (void)setExpectedValues:(NSArray *> *)values - expectedValueInterval:(NSNumber *)expectedValueIntervalMs; - // called by controller to clean up and shutdown - (void)invalidate; From c1b3304fa69f356f21b8803c572c670c0ad1be17 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 23 Aug 2024 13:16:06 -0400 Subject: [PATCH 44/53] Address followup issues for preset/atomic-write implementation. (#35175) * Puts some file-local functions in an anonymous namespace. * Fixes the "is this attribute supported?" check to correctly check for global attributes that are not in Ember metadata. * Moves the comment explaining why it's OK to skip the spec-required ACL check to the place where that check is being skipped. * Removes a non-spec-compliant "error if the timeout is 0" bit. Fixes https://github.com/project-chip/connectedhomeip/issues/35168 --- src/app/GlobalAttributes.h | 13 ++++++++ .../thermostat-server-atomic.cpp | 31 ++++++++++++------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/app/GlobalAttributes.h b/src/app/GlobalAttributes.h index 5096792309a880..461294267f38c0 100644 --- a/src/app/GlobalAttributes.h +++ b/src/app/GlobalAttributes.h @@ -40,5 +40,18 @@ constexpr AttributeId GlobalAttributesNotInMetadata[] = { static_assert(ArrayIsSorted(GlobalAttributesNotInMetadata), "Array of global attribute ids must be sorted"); +inline bool IsSupportedGlobalAttributeNotInMetadata(AttributeId attributeId) +{ + for (auto & attr : GlobalAttributesNotInMetadata) + { + if (attr == attributeId) + { + return true; + } + } + + return false; +} + } // namespace app } // namespace chip diff --git a/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp b/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp index 2a6e52e504887e..19a6ffa3387e12 100644 --- a/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server-atomic.cpp @@ -17,6 +17,7 @@ #include "thermostat-server.h" +#include #include using namespace chip; @@ -47,6 +48,8 @@ void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) gThermostatAttrAccess.ResetAtomicWrite(endpoint); } +namespace { + /** * @brief Schedules a timer for the given timeout in milliseconds. * @@ -185,15 +188,25 @@ Status BuildAttributeStatuses(const EndpointId endpoint, const DataModel::Decoda const EmberAfAttributeMetadata * metadata = emberAfLocateAttributeMetadata(endpoint, Thermostat::Id, attributeStatus.attributeID); - if (metadata == nullptr) + if (metadata != nullptr) + { + // This is definitely an attribute we know about. + continue; + } + + if (IsSupportedGlobalAttributeNotInMetadata(attributeStatus.attributeID)) { - // This is not a valid attribute on the Thermostat cluster on the supplied endpoint - return Status::InvalidCommand; + continue; } + + // This is not a valid attribute on the Thermostat cluster on the supplied endpoint + return Status::InvalidCommand; } return Status::Success; } +} // anonymous namespace + bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint, Optional attributeId) { @@ -422,6 +435,10 @@ void ThermostatAttrAccess::BeginAtomicWrite(CommandHandler * commandObj, const C status = Status::Success; for (size_t i = 0; i < attributeStatuses.AllocatedSize(); ++i) { + // If we've gotten this far, then the client has manage permission to call AtomicRequest, + // which is also the privilege necessary to write to the atomic attributes, so no need to do + // the "If the client does not have sufficient privilege to write to the attribute" check + // from the spec. auto & attributeStatus = attributeStatuses[i]; auto statusCode = Status::Success; switch (attributeStatus.attributeID) @@ -442,11 +459,6 @@ void ThermostatAttrAccess::BeginAtomicWrite(CommandHandler * commandObj, const C } auto timeout = std::min(System::Clock::Milliseconds16(commandData.timeout.Value()), maximumTimeout); - if (timeout.count() == 0) - { - commandObj->AddStatus(commandPath, Status::InvalidInState); - return; - } if (status == Status::Success) { @@ -605,9 +617,6 @@ bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, { auto & requestType = commandData.requestType; - // If we've gotten this far, then the client has manage permission to call AtomicRequest, which is also the - // privilege necessary to write to the atomic attributes, so no need to check - switch (requestType) { case Globals::AtomicRequestTypeEnum::kBeginWrite: From b3507cebe7defed94c3394b8bf3d574115279531 Mon Sep 17 00:00:00 2001 From: Anush Nadathur Date: Fri, 23 Aug 2024 12:28:24 -0700 Subject: [PATCH 45/53] [Darwin] Enable taking assertion on MTRDeviceController (#35148) * [Darwin] Enable taking assertion on MTRDeviceController - Added ability to take assertion on MTRDeviceController to keep it running until all assertions are removed - A request to shutdown will take place only if there are no assertions are present * Fixed format string * Account for existing controller that is asserted in factory when creating a new one * Simplified to use lock for assertion tracking * Fixed build error * Removed unneeded includes * Fixed bugs with wrong match logic * resytle fixes * Restyle fixes * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Fixed build failure from review suggestions and added comment per review feedback --------- Co-authored-by: Boris Zbarsky --- .../Framework/CHIP/MTRDeviceController.mm | 94 +++++++++++++++++++ .../CHIP/MTRDeviceControllerFactory.mm | 19 ++++ .../CHIP/MTRDeviceControllerStartupParams.mm | 23 +++++ ...TRDeviceControllerStartupParams_Internal.h | 4 + .../CHIP/MTRDeviceController_Internal.h | 40 ++++++++ 5 files changed, 180 insertions(+) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 11fd481b48b2fc..4630ff7fe00b4f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -46,6 +46,7 @@ #import "MTRSetupPayload.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" +#import "MTRUtilities.h" #import "NSDataSpanConversion.h" #import "NSStringSpanConversion.h" #import @@ -129,6 +130,11 @@ @implementation MTRDeviceController { std::atomic> _storedCompressedFabricID; MTRP256KeypairBridge _signingKeypairBridge; MTRP256KeypairBridge _operationalKeypairBridge; + + // Counters to track assertion status and access controlled by the _assertionLock + NSUInteger _keepRunningAssertionCounter; + BOOL _shutdownPending; + os_unfair_lock _assertionLock; } - (os_unfair_lock_t)deviceMapLock @@ -142,6 +148,11 @@ - (instancetype)initForSubclasses // nothing, as superclass of MTRDeviceController is NSObject } _underlyingDeviceMapLock = OS_UNFAIR_LOCK_INIT; + + // Setup assertion variables + _keepRunningAssertionCounter = 0; + _shutdownPending = NO; + _assertionLock = OS_UNFAIR_LOCK_INIT; return self; } @@ -178,6 +189,12 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory // Make sure our storage is all set up to work as early as possible, // before we start doing anything else with the controller. _uniqueIdentifier = uniqueIdentifier; + + // Setup assertion variables + _keepRunningAssertionCounter = 0; + _shutdownPending = NO; + _assertionLock = OS_UNFAIR_LOCK_INIT; + if (storageDelegate != nil) { if (storageDelegateQueue == nil) { MTR_LOG_ERROR("storageDelegate provided without storageDelegateQueue"); @@ -295,6 +312,9 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory _storedFabricIndex = chip::kUndefinedFabricIndex; _storedCompressedFabricID = std::nullopt; + self.nodeID = nil; + self.fabricID = nil; + self.rootPublicKey = nil; _storageBehaviorConfiguration = storageBehaviorConfiguration; } @@ -311,8 +331,69 @@ - (BOOL)isRunning return _cppCommissioner != nullptr; } +- (BOOL)matchesPendingShutdownWithParams:(MTRDeviceControllerParameters *)parameters +{ + if (!parameters.operationalCertificate || !parameters.rootCertificate) { + return FALSE; + } + NSNumber * nodeID = [MTRDeviceControllerParameters nodeIDFromNOC:parameters.operationalCertificate]; + NSNumber * fabricID = [MTRDeviceControllerParameters fabricIDFromNOC:parameters.operationalCertificate]; + NSData * publicKey = [MTRDeviceControllerParameters publicKeyFromCertificate:parameters.rootCertificate]; + + std::lock_guard lock(_assertionLock); + + // If any of the local above are nil, the return will be false since MTREqualObjects handles them correctly + return _keepRunningAssertionCounter > 0 && _shutdownPending && MTREqualObjects(nodeID, self.nodeID) && MTREqualObjects(fabricID, self.fabricID) && MTREqualObjects(publicKey, self.rootPublicKey); +} + +- (void)addRunAssertion +{ + std::lock_guard lock(_assertionLock); + + // Only take an assertion if running + if ([self isRunning]) { + ++_keepRunningAssertionCounter; + MTR_LOG("%@ Adding keep running assertion, total %lu", self, static_cast(_keepRunningAssertionCounter)); + } +} + +- (void)removeRunAssertion; +{ + std::lock_guard lock(_assertionLock); + + if (_keepRunningAssertionCounter > 0) { + --_keepRunningAssertionCounter; + MTR_LOG("%@ Removing keep running assertion, total %lu", self, static_cast(_keepRunningAssertionCounter)); + + if ([self isRunning] && _keepRunningAssertionCounter == 0 && _shutdownPending) { + MTR_LOG("%@ All assertions removed and shutdown is pending, shutting down", self); + [self finalShutdown]; + } + } +} + +- (void)clearPendingShutdown +{ + std::lock_guard lock(_assertionLock); + _shutdownPending = NO; +} + - (void)shutdown { + std::lock_guard lock(_assertionLock); + + if (_keepRunningAssertionCounter > 0) { + MTR_LOG("%@ Pending shutdown since %lu assertions are present", self, static_cast(_keepRunningAssertionCounter)); + _shutdownPending = YES; + return; + } + [self finalShutdown]; +} + +- (void)finalShutdown +{ + os_unfair_lock_assert_owner(&_assertionLock); + MTR_LOG("%@ shutdown called", self); if (_cppCommissioner == nullptr) { // Already shut down. @@ -369,11 +450,16 @@ - (void)shutDownCppController // shuts down. _storedFabricIndex = chip::kUndefinedFabricIndex; _storedCompressedFabricID = std::nullopt; + self.nodeID = nil; + self.fabricID = nil; + self.rootPublicKey = nil; + delete commissionerToShutDown; if (_operationalCredentialsDelegate != nil) { _operationalCredentialsDelegate->SetDeviceCommissioner(nullptr); } } + _shutdownPending = NO; } - (void)deinitFromFactory @@ -609,6 +695,14 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams self->_storedFabricIndex = fabricIdx; self->_storedCompressedFabricID = _cppCommissioner->GetCompressedFabricId(); + + chip::Crypto::P256PublicKey rootPublicKey; + if (_cppCommissioner->GetRootPublicKey(rootPublicKey) == CHIP_NO_ERROR) { + self.rootPublicKey = [NSData dataWithBytes:rootPublicKey.Bytes() length:rootPublicKey.Length()]; + self.nodeID = @(_cppCommissioner->GetNodeId()); + self.fabricID = @(_cppCommissioner->GetFabricId()); + } + commissionerInitialized = YES; MTR_LOG("%@ startup succeeded for nodeID 0x%016llX", self, self->_cppCommissioner->GetNodeId()); diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 5b089b392074e6..bd0b90450b9ac4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -1133,12 +1133,31 @@ - (void)operationalInstanceAdded:(chip::PeerId &)operationalID } } +- (nullable MTRDeviceController *)_findControllerWithPendingShutdownMatchingParams:(MTRDeviceControllerParameters *)parameters +{ + std::lock_guard lock(_controllersLock); + for (MTRDeviceController * controller in _controllers) { + if ([controller matchesPendingShutdownWithParams:parameters]) { + MTR_LOG("%@ Found existing controller %@ that is pending shutdown and matching parameters, re-using it", self, controller); + [controller clearPendingShutdown]; + return controller; + } + } + return nil; +} + - (nullable MTRDeviceController *)initializeController:(MTRDeviceController *)controller withParameters:(MTRDeviceControllerParameters *)parameters error:(NSError * __autoreleasing *)error { [self _assertCurrentQueueIsNotMatterQueue]; + // If there is a controller already running with matching parameters that is conceptually shut down from the API consumer's viewpoint, re-use it. + MTRDeviceController * existingController = [self _findControllerWithPendingShutdownMatchingParams:parameters]; + if (existingController) { + return existingController; + } + return [self _startDeviceController:controller startupParams:parameters fabricChecker:^MTRDeviceControllerStartupParamsInternal *( diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm index c5923ad4e54619..5850a8c4efe384 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm @@ -306,6 +306,29 @@ - (void)setOTAProviderDelegate:(id)otaProviderDelegate q _otaProviderDelegateQueue = queue; } ++ (nullable NSNumber *)nodeIDFromNOC:(MTRCertificateDERBytes)noc +{ + NSNumber * nodeID = nil; + ExtractNodeIDFromNOC(noc, &nodeID); + return nodeID; +} + ++ (nullable NSNumber *)fabricIDFromNOC:(MTRCertificateDERBytes)noc +{ + NSNumber * fabricID = nil; + ExtractFabricIDFromNOC(noc, &fabricID); + return fabricID; +} + ++ (nullable NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate +{ + Crypto::P256PublicKey pubKey; + if (ExtractPubkeyFromX509Cert(AsByteSpan(certificate), pubKey) != CHIP_NO_ERROR) { + return nil; + } + return [NSData dataWithBytes:pubKey.Bytes() length:pubKey.Length()]; +} + @end @implementation MTRDeviceControllerExternalCertificateParameters diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h index 6b8c762633578a..0b4065f491873b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h @@ -85,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong, readonly, nullable) id otaProviderDelegate; @property (nonatomic, strong, readonly, nullable) dispatch_queue_t otaProviderDelegateQueue; ++ (nullable NSNumber *)nodeIDFromNOC:(MTRCertificateDERBytes)noc; ++ (nullable NSNumber *)fabricIDFromNOC:(MTRCertificateDERBytes)noc; ++ (nullable NSData *)publicKeyFromCertificate:(MTRCertificateDERBytes)certificate; + @end @interface MTRDeviceControllerStartupParamsInternal : MTRDeviceControllerStartupParams diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index 54d5cfd8d340fa..e625d13a80e77e 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -45,6 +45,7 @@ #import #import +@class MTRDeviceControllerParameters; @class MTRDeviceControllerStartupParamsInternal; @class MTRDeviceControllerFactory; @class MTRDevice; @@ -117,6 +118,21 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, readonly) MTRAsyncWorkQueue * concurrentSubscriptionPool; +/** + * Fabric ID tied to controller + */ +@property (nonatomic, retain, nullable) NSNumber * fabricID; + +/** + * Node ID tied to controller + */ +@property (nonatomic, retain, nullable) NSNumber * nodeID; + +/** + * Root Public Key tied to controller + */ +@property (nonatomic, retain, nullable) NSData * rootPublicKey; + /** * Init a newly created controller. * @@ -289,6 +305,30 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)directlyGetSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion; +/** + * Takes an assertion to keep the controller running. If `-[MTRDeviceController shutdown]` is called while an assertion + * is held, the shutdown will be honored only after all assertions are released. Invoking this method multiple times increases + * the number of assertions and needs to be matched with equal amount of '-[MTRDeviceController removeRunAssertion]` to release + * the assertion. + */ +- (void)addRunAssertion; + +/** + * Removes an assertion to allow the controller to shutdown once all assertions have been released. + * Invoking this method once all assertions have been released in a noop. + */ +- (void)removeRunAssertion; + +/** + * This method returns TRUE if this controller matches the fabric reference and node ID as listed in the parameters. + */ +- (BOOL)matchesPendingShutdownWithParams:(MTRDeviceControllerParameters *)parameters; + +/** + * Clear any pending shutdown request. + */ +- (void)clearPendingShutdown; + @end /** From 0b5af2a0bcdbc1c0f96b239b631a8eb3148fce12 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:31:26 -0400 Subject: [PATCH 46/53] Cleanup/updates tied with latest sdk update (#35140) --- examples/platform/silabs/FreeRTOSConfig.h | 2 +- src/platform/silabs/ConfigurationManagerImpl.cpp | 2 +- .../silabs/efr32/Efr32PsaOpaqueKeypair.cpp | 15 +++++---------- .../silabs/efr32/OTAImageProcessorImpl.cpp | 2 +- .../silabs/multi-ota/OTACustomProcessor.cpp | 2 +- .../silabs/multi-ota/OTAFirmwareProcessor.cpp | 2 +- .../multi-ota/OTAMultiImageProcessorImpl.cpp | 2 +- .../silabs/platformAbstraction/GsdkSpam.cpp | 16 +++++++++++++++- src/test_driver/efr32/include/FreeRTOSConfig.h | 2 +- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/examples/platform/silabs/FreeRTOSConfig.h b/examples/platform/silabs/FreeRTOSConfig.h index b27c775d9b7a54..1c2db9621f61ee 100644 --- a/examples/platform/silabs/FreeRTOSConfig.h +++ b/examples/platform/silabs/FreeRTOSConfig.h @@ -118,8 +118,8 @@ extern uint32_t SystemCoreClock; #include "RTE_Components.h" #include CMSIS_device_header -#include "em_assert.h" #include "em_device.h" +#include "sl_assert.h" #endif #if defined(SL_COMPONENT_CATALOG_PRESENT) diff --git a/src/platform/silabs/ConfigurationManagerImpl.cpp b/src/platform/silabs/ConfigurationManagerImpl.cpp index 5a511038c799ed..122799952acab5 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/ConfigurationManagerImpl.cpp @@ -121,7 +121,7 @@ CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason) matterBootCause = BootReasonType::kPowerOnReboot; } else if (rebootCause & EMU_RSTCAUSE_AVDDBOD || rebootCause & EMU_RSTCAUSE_DVDDBOD || rebootCause & EMU_RSTCAUSE_DECBOD || - rebootCause & EMU_RSTCAUSE_VREGIN || rebootCause & EMU_RSTCAUSE_IOVDD0BOD || rebootCause & EMU_RSTCAUSE_DVDDLEBOD) + rebootCause & EMU_RSTCAUSE_IOVDD0BOD || rebootCause & EMU_RSTCAUSE_DVDDLEBOD) { matterBootCause = BootReasonType::kBrownOutReset; } diff --git a/src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp b/src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp index 7a74c137596070..542142cd1a1d5c 100644 --- a/src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp +++ b/src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp @@ -18,6 +18,7 @@ #include "Efr32OpaqueKeypair.h" #include "em_device.h" #include +#include #include #include @@ -47,14 +48,6 @@ namespace Internal { static_assert((kEFR32OpaqueKeyIdPersistentMax - kEFR32OpaqueKeyIdPersistentMin) < PSA_KEY_ID_FOR_MATTER_SIZE, "Not enough PSA range to store all allowed opaque key IDs"); -#if defined(SEMAILBOX_PRESENT) && (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT) -#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_SE_OPAQUE -#elif defined(CRYPTOACC_PRESENT) && defined(SEPUF_PRESENT) && defined(SL_TRUSTZONE_NONSECURE) -#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_CRYPTOACC_OPAQUE -#else -#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_LOCAL_STORAGE -#endif - static void _log_PSA_error(psa_status_t status) { if (status != PSA_SUCCESS) @@ -190,7 +183,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey if (opaque_id == kEFR32OpaqueKeyIdVolatile) { psa_set_key_lifetime( - &attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_VOLATILE, PSA_CRYPTO_LOCATION_FOR_DEVICE)); + &attr, + PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_VOLATILE, sl_psa_get_most_secure_key_location())); } else { @@ -210,7 +204,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey psa_set_key_id(&attr, key_id); psa_set_key_lifetime( - &attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_PERSISTENT, PSA_CRYPTO_LOCATION_FOR_DEVICE)); + &attr, + PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_PERSISTENT, sl_psa_get_most_secure_key_location())); } switch (usage) diff --git a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp index 598ee5a2093605..846d4f720ac930 100644 --- a/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/efr32/OTAImageProcessorImpl.cpp @@ -22,7 +22,7 @@ extern "C" { #include "btl_interface.h" -#include "em_bus.h" // For CORE_CRITICAL_SECTION +#include "sl_core.h" #if SL_WIFI #include "spi_multiplex.h" #endif // SL_WIFI diff --git a/src/platform/silabs/multi-ota/OTACustomProcessor.cpp b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp index 85ceb7d44d4eaf..ef761d003e0499 100644 --- a/src/platform/silabs/multi-ota/OTACustomProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp @@ -24,7 +24,7 @@ extern "C" { #include "btl_interface.h" -#include "em_bus.h" // For CORE_CRITICAL_SECTION +#include "sl_core.h" #if SL_WIFI #include "spi_multiplex.h" #endif // SL_WIFI diff --git a/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp index 3fc66e53913b87..d8545d01f40996 100644 --- a/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp @@ -24,7 +24,7 @@ extern "C" { #include "btl_interface.h" -#include "em_bus.h" // For CORE_CRITICAL_SECTION +#include "sl_core.h" #if SL_WIFI #include "spi_multiplex.h" #endif // SL_WIFI diff --git a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp index 9dfb42fc879c4b..a95cb4e1ada4b4 100644 --- a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp +++ b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp @@ -32,7 +32,7 @@ static chip::OTAMultiImageProcessorImpl gImageProcessor; extern "C" { #include "btl_interface.h" -#include "em_bus.h" // For CORE_CRITICAL_SECTION +#include "sl_core.h" #if SL_WIFI #include "spi_multiplex.h" #endif // SL_WIFI diff --git a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp index 514003305868cf..eb8704ecfc1116 100644 --- a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp +++ b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp @@ -17,7 +17,11 @@ #include +#if defined(_SILICON_LABS_32B_SERIES_2) #include "em_rmu.h" +#else +#include "sl_hal_emu.h" +#endif #include "sl_system_kernel.h" #ifdef ENABLE_WSTK_LEDS @@ -71,9 +75,19 @@ SilabsPlatform::SilabsButtonCb SilabsPlatform::mButtonCallback = nullptr; CHIP_ERROR SilabsPlatform::Init(void) { +#ifdef _SILICON_LABS_32B_SERIES_2 + // Read the cause of last reset. mRebootCause = RMU_ResetCauseGet(); - // Clear register so it does accumualate the causes of each reset + + // Clear the register, as the causes cumulate over resets. RMU_ResetCauseClear(); +#else + // Read the cause of last reset. + mRebootCause = sl_hal_emu_get_reset_cause(); + + // Clear the register, as the causes cumulate over resets. + sl_hal_emu_clear_reset_cause(); +#endif // _SILICON_LABS_32B_SERIES_2 #if SILABS_LOG_OUT_UART && defined(SL_CATALOG_CLI_PRESENT) sl_iostream_set_default(sl_iostream_stdio_handle); diff --git a/src/test_driver/efr32/include/FreeRTOSConfig.h b/src/test_driver/efr32/include/FreeRTOSConfig.h index 7a02673c27b5b0..5cd17b4a7257e0 100644 --- a/src/test_driver/efr32/include/FreeRTOSConfig.h +++ b/src/test_driver/efr32/include/FreeRTOSConfig.h @@ -108,8 +108,8 @@ extern "C" { #include "RTE_Components.h" #include CMSIS_device_header -#include "em_assert.h" #include "em_device.h" +#include "sl_assert.h" #if defined(SL_COMPONENT_CATALOG_PRESENT) #include "sl_component_catalog.h" From f01ec93099f1d3f9c542ff50d2ff1c3cbdb52271 Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Sat, 24 Aug 2024 02:02:50 +0530 Subject: [PATCH 47/53] [Silabs] Adding the gn build header for the lwip IPv4 and RS9116 (#35142) * adding the gn build header for the lwip and rs9116 * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../platform/silabs/efr32/rs911x/rsi_wlan_config.h | 4 ++++ src/lwip/silabs/lwipopts-rs911x.h | 10 ++++++++++ src/lwip/silabs/lwipopts-wf200.h | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h index 96bd71bb80539a..b851cd79580a22 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h +++ b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h @@ -20,6 +20,10 @@ #include "rsi_wlan_defines.h" +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_wifi_config.h" +#endif // SL_MATTER_GN_BUILD + //! Enable feature #define RSI_ENABLE 1 //! Disable feature diff --git a/src/lwip/silabs/lwipopts-rs911x.h b/src/lwip/silabs/lwipopts-rs911x.h index 4f8075461b0c6d..c563a706ac9737 100644 --- a/src/lwip/silabs/lwipopts-rs911x.h +++ b/src/lwip/silabs/lwipopts-rs911x.h @@ -32,6 +32,10 @@ #include +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_wifi_config.h" +#endif // SL_MATTER_GN_BUILD + #define NO_SYS 0 #define MEM_ALIGNMENT (4) #define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN + 1) @@ -90,6 +94,12 @@ #define MEMP_NUM_NETCONN (0) +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 +#define LWIP_IPV4 1 +#else +#define LWIP_IPV4 0 +#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 + #ifndef LWIP_ARP #define LWIP_ARP (LWIP_IPV4) #endif /* LWIP_ARP */ diff --git a/src/lwip/silabs/lwipopts-wf200.h b/src/lwip/silabs/lwipopts-wf200.h index cc9b45b144278a..9ea7e4f6bbf07c 100644 --- a/src/lwip/silabs/lwipopts-wf200.h +++ b/src/lwip/silabs/lwipopts-wf200.h @@ -32,6 +32,10 @@ #include +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_wifi_config.h" +#endif // SL_MATTER_GN_BUILD + #define NO_SYS 0 #define MEM_ALIGNMENT (4) #define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN + 1) @@ -91,6 +95,12 @@ #define MEMP_NUM_NETCONN (0) +#if CHIP_DEVICE_CONFIG_ENABLE_IPV4 +#define LWIP_IPV4 1 +#else +#define LWIP_IPV4 0 +#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 + #ifndef LWIP_ARP #define LWIP_ARP (LWIP_IPV4) #endif /* LWIP_ARP */ From 26e59b68b795ff36f1e8a14dd602c46d1e442c57 Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Sat, 24 Aug 2024 02:17:24 +0530 Subject: [PATCH 48/53] [Silabs] [WiFi] Fixing the retry logic for the WiFi Devices (#34225) * Modifying the retry logic for the wifi devices * Baseapplication.cpp modification of the delegate fix * Restyled by clang-format * removing the soc and sleepy condition * Restyled by clang-format * Restyled by gn * moving the variable to efr32_sdk.gni to make it available everywhere * correcting the path of the 917 ncp file * fixing the build for the 917 ncp * addressing the review comments * fixing the build and replacing the define * removing the unused else case * Update third_party/silabs/efr32_sdk.gni Co-authored-by: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> * addressing the review comments * Restyled by whitespace * Restyled by clang-format * fixing the build * fixing the efr32 build --------- Co-authored-by: Restyled.io Co-authored-by: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> --- examples/platform/silabs/BaseApplication.cpp | 3 + examples/platform/silabs/BaseApplication.h | 5 +- examples/platform/silabs/SiWx917/BUILD.gn | 4 +- .../silabs/SiWx917/SiWx917/sl_wifi_if.cpp | 22 +- examples/platform/silabs/efr32/BUILD.gn | 2 - .../platform/silabs/efr32/rs911x/rs9117.gni | 2 +- .../platform/silabs/efr32/rs911x/rs911x.gni | 2 +- .../platform/silabs/efr32/rs911x/rsi_if.c | 103 +++----- .../platform/silabs/efr32/wf200/host_if.cpp | 28 +-- .../platform/silabs/efr32/wf200/wf200.gni | 2 +- examples/platform/silabs/wfx_rsi.h | 1 - .../platform/silabs}/wifi/wfx_notify.cpp | 130 +++++------ .../silabs/SiWx917/wifi/wfx_host_events.h | 8 +- .../silabs/efr32/wifi/wfx_host_events.h | 13 +- src/platform/silabs/efr32/wifi/wfx_notify.cpp | 220 ------------------ third_party/silabs/efr32_sdk.gni | 2 + 16 files changed, 131 insertions(+), 416 deletions(-) rename {src/platform/silabs/SiWx917 => examples/platform/silabs}/wifi/wfx_notify.cpp (64%) delete mode 100644 src/platform/silabs/efr32/wifi/wfx_notify.cpp diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 99123c5bf764d1..8cf5b3891dfe8e 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -190,6 +190,9 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed() #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 if (BaseApplication::GetProvisionStatus()) { + // After the device is provisioned and the commissioning passed + // resetting the isCommissioningStarted to false + isComissioningStarted = false; #ifdef DISPLAY_ENABLED #ifdef QR_CODE_ENABLED SilabsLCD::Screen_e screen; diff --git a/examples/platform/silabs/BaseApplication.h b/examples/platform/silabs/BaseApplication.h index 9052e9355aab90..5d757b8ca4672d 100644 --- a/examples/platform/silabs/BaseApplication.h +++ b/examples/platform/silabs/BaseApplication.h @@ -65,9 +65,12 @@ class BaseApplicationDelegate : public AppDelegate, public chip::FabricTable::Delegate { +public: + bool isCommissioningInProgress() { return isComissioningStarted; } + private: // AppDelegate - bool isComissioningStarted; + bool isComissioningStarted = false; void OnCommissioningSessionStarted() override; void OnCommissioningSessionStopped() override; void OnCommissioningWindowClosed() override; diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 80d247b56c4df4..2780e2ecbcc16e 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -50,8 +50,6 @@ declare_args() { # Sanity check assert(chip_enable_wifi) - -silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" silabs_plat_si91x_wifi_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi" import("${silabs_common_plat_dir}/args.gni") @@ -193,10 +191,10 @@ source_set("siwx917-common") { "${silabs_common_plat_dir}/SoftwareFaultReports.cpp", "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", + "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", "${silabs_plat_si91x_wifi_dir}/dhcp_client.cpp", "${silabs_plat_si91x_wifi_dir}/ethernetif.cpp", "${silabs_plat_si91x_wifi_dir}/lwip_netif.cpp", - "${silabs_plat_si91x_wifi_dir}/wfx_notify.cpp", "SiWx917/sl_wifi_if.cpp", "SiWx917/wfx_rsi_host.cpp", ] diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp index 03b51540cf4b6d..92d5ca4808195c 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp @@ -101,11 +101,6 @@ bool hasNotifiedIPV4 = false; #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ bool hasNotifiedWifiConnectivity = false; -/* Declare a flag to differentiate between after boot-up first IP connection or reconnection */ -bool is_wifi_disconnection_event = false; - -/* Declare a variable to hold connection time intervals */ -uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS; volatile bool scan_results_complete = false; volatile bool bg_scan_results_complete = false; extern osSemaphoreId_t sl_rs_ble_init_sem; @@ -247,12 +242,7 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t callback_status = *(sl_status_t *) result; ChipLogError(DeviceLayer, "join_callback_handler: failed: 0x%lx", static_cast(callback_status)); wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTED); - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); - if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) - { - WfxEvent.eventType = WFX_EVT_STA_START_JOIN; - WfxPostEvent(&WfxEvent); - } + wfx_retry_connection(++wfx_rsi.join_retries); return SL_STATUS_FAIL; } /* @@ -264,10 +254,7 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t WfxEvent.eventType = WFX_EVT_STA_CONN; WfxPostEvent(&WfxEvent); wfx_rsi.join_retries = 0; - retryInterval = WLAN_MIN_RETRY_TIMER_MS; - // Once the join passes setting the disconnection event to true to differentiate between the first connection and reconnection - is_wifi_disconnection_event = true; - callback_status = SL_STATUS_OK; + callback_status = SL_STATUS_OK; return SL_STATUS_OK; } @@ -693,12 +680,11 @@ static sl_status_t wfx_rsi_do_join(void) // failure only happens when the firmware returns an error ChipLogError(DeviceLayer, "wfx_rsi_do_join: sl_wifi_connect failed: 0x%lx", static_cast(status)); - VerifyOrReturnError((is_wifi_disconnection_event || wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT), status); + VerifyOrReturnError((wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT), status); wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); ChipLogProgress(DeviceLayer, "wfx_rsi_do_join: retry attempt %d", wfx_rsi.join_retries); - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); - wfx_rsi.join_retries++; + wfx_retry_connection(++wfx_rsi.join_retries); event.eventType = WFX_EVT_STA_START_JOIN; WfxPostEvent(&event); return status; diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 22b7458588d97c..3691091a0bc3c7 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -48,8 +48,6 @@ declare_args() { sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF" } -silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" - import("${silabs_common_plat_dir}/args.gni") # Sanity check diff --git a/examples/platform/silabs/efr32/rs911x/rs9117.gni b/examples/platform/silabs/efr32/rs911x/rs9117.gni index c068e7aa3efaff..356b72f55f75d4 100644 --- a/examples/platform/silabs/efr32/rs911x/rs9117.gni +++ b/examples/platform/silabs/efr32/rs911x/rs9117.gni @@ -8,7 +8,7 @@ rs911x_src_plat = [ "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c", "${examples_plat_dir}/rs911x/hal/sl_si91x_ncp_utility.c", "${examples_plat_dir}/rs911x/hal/efx32_ncp_host.c", - "${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp", + "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", ] rs9117_inc_plat = [ diff --git a/examples/platform/silabs/efr32/rs911x/rs911x.gni b/examples/platform/silabs/efr32/rs911x/rs911x.gni index ebf7c546f6a068..54507de66e0ced 100644 --- a/examples/platform/silabs/efr32/rs911x/rs911x.gni +++ b/examples/platform/silabs/efr32/rs911x/rs911x.gni @@ -9,7 +9,7 @@ rs911x_src_plat = [ "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c", "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c", "${examples_plat_dir}/rs911x/hal/efx_spi.c", - "${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp", + "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", ] # diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index e4d6f51bf0ded9..f0121285383d00 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -70,12 +70,6 @@ bool hasNotifiedIPV4 = false; #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ bool hasNotifiedWifiConnectivity = false; -/* Declare a flag to differentiate between after boot-up first IP connection or reconnection */ -bool is_wifi_disconnection_event = false; - -/* Declare a variable to hold connection time intervals */ -uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS; - #if (RSI_BLE_ENABLE) extern rsi_semaphore_handle_t sl_rs_ble_init_sem; #endif @@ -279,13 +273,8 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t /* * We should enable retry.. (Need config variable for this) */ - SILABS_LOG("%s: failed. retry: %d", __func__, wfx_rsi.join_retries); - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); - if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) - { - WfxEvent.eventType = WFX_EVT_STA_START_JOIN; - WfxPostEvent(&WfxEvent); - } + SILABS_LOG("wfx_rsi_join_cb: failed. retry: %d", wfx_rsi.join_retries); + wfx_retry_connection(++wfx_rsi.join_retries); } else { @@ -293,11 +282,10 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t * Join was complete - Do the DHCP */ memset(&temp_reset, 0, sizeof(wfx_wifi_scan_ext_t)); - SILABS_LOG("%s: join completed.", __func__); + SILABS_LOG("wfx_rsi_join_cb: join completed."); WfxEvent.eventType = WFX_EVT_STA_CONN; WfxPostEvent(&WfxEvent); wfx_rsi.join_retries = 0; - retryInterval = WLAN_MIN_RETRY_TIMER_MS; } } @@ -313,12 +301,11 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t *********************************************************************/ static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len) { - SILABS_LOG("%s: error: failed status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_join_fail_cb: error: failed status: %02x", status); WfxEvent_t WfxEvent; wfx_rsi.join_retries += 1; wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); - is_wifi_disconnection_event = true; - WfxEvent.eventType = WFX_EVT_STA_START_JOIN; + WfxEvent.eventType = WFX_EVT_STA_START_JOIN; WfxPostEvent(&WfxEvent); } /************************************************************************************* @@ -354,23 +341,23 @@ static int32_t wfx_rsi_init(void) uint8_t buf[RSI_RESPONSE_HOLD_BUFF_SIZE]; extern void rsi_hal_board_init(void); - SILABS_LOG("%s: starting(HEAP_SZ = %d)", __func__, SL_HEAP_SIZE); + SILABS_LOG("wfx_rsi_init: starting(HEAP_SZ = %d)", SL_HEAP_SIZE); //! Driver initialization status = rsi_driver_init(wfx_rsi_drv_buf, WFX_RSI_BUF_SZ); if ((status < RSI_DRIVER_STATUS) || (status > WFX_RSI_BUF_SZ)) { - SILABS_LOG("%s: error: RSI Driver initialization failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: RSI Driver initialization failed with status: %02x", status); return status; } - SILABS_LOG("%s: rsi_device_init", __func__); + SILABS_LOG("wfx_rsi_init: rsi_device_init", __func__); /* ! Redpine module intialisation */ if ((status = rsi_device_init(LOAD_NWP_FW)) != RSI_SUCCESS) { - SILABS_LOG("%s: error: rsi_device_init failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: rsi_device_init failed with status: %02x", status); return status; } - SILABS_LOG("%s: start wireless drv task", __func__); + SILABS_LOG("wfx_rsi_init: start wireless drv task", __func__); /* * Create the driver task */ @@ -378,7 +365,7 @@ static int32_t wfx_rsi_init(void) WLAN_TASK_PRIORITY, driverRsiTaskStack, &driverRsiTaskBuffer); if (NULL == wfx_rsi.drv_task) { - SILABS_LOG("%s: error: rsi_wireless_driver_task failed", __func__); + SILABS_LOG("wfx_rsi_init: error: rsi_wireless_driver_task failed", __func__); return RSI_ERROR_INVALID_PARAM; } @@ -389,40 +376,40 @@ static int32_t wfx_rsi_init(void) if ((status = rsi_wireless_init(OPER_MODE_0, COEX_MODE_0)) != RSI_SUCCESS) { #endif - SILABS_LOG("%s: error: Initialize WiSeConnect failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: Initialize WiSeConnect failed with status: %02x", status); return status; } - SILABS_LOG("%s: get FW version..", __func__); + SILABS_LOG("wfx_rsi_init: get FW version..", __func__); /* * Get the MAC and other info to let the user know about it. */ if (rsi_wlan_get(RSI_FW_VERSION, buf, sizeof(buf)) != RSI_SUCCESS) { - SILABS_LOG("%s: error: rsi_wlan_get(RSI_FW_VERSION) failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: rsi_wlan_get(RSI_FW_VERSION) failed with status: %02x", status); return status; } buf[sizeof(buf) - 1] = 0; - SILABS_LOG("%s: RSI firmware version: %s", __func__, buf); + SILABS_LOG("wfx_rsi_init: RSI firmware version: %s", buf); //! Send feature frame if ((status = rsi_send_feature_frame()) != RSI_SUCCESS) { - SILABS_LOG("%s: error: rsi_send_feature_frame failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: rsi_send_feature_frame failed with status: %02x", status); return status; } - SILABS_LOG("%s: sent rsi_send_feature_frame", __func__); + SILABS_LOG("wfx_rsi_init: sent rsi_send_feature_frame", __func__); /* initializes wlan radio parameters and WLAN supplicant parameters. */ (void) rsi_wlan_radio_init(); /* Required so we can get MAC address */ if ((status = rsi_wlan_get(RSI_MAC_ADDRESS, &wfx_rsi.sta_mac.octet[0], RESP_BUFF_SIZE)) != RSI_SUCCESS) { - SILABS_LOG("%s: error: rsi_wlan_get failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: error: rsi_wlan_get failed with status: %02x", status); return status; } - SILABS_LOG("%s: WLAN: MAC %02x:%02x:%02x %02x:%02x:%02x", __func__, wfx_rsi.sta_mac.octet[0], wfx_rsi.sta_mac.octet[1], + SILABS_LOG("wfx_rsi_init: WLAN: MAC %02x:%02x:%02x %02x:%02x:%02x", wfx_rsi.sta_mac.octet[0], wfx_rsi.sta_mac.octet[1], wfx_rsi.sta_mac.octet[2], wfx_rsi.sta_mac.octet[3], wfx_rsi.sta_mac.octet[4], wfx_rsi.sta_mac.octet[5]); // Create the message queue @@ -445,12 +432,12 @@ static int32_t wfx_rsi_init(void) */ if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS) { - SILABS_LOG("%s: RSI callback register join failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: RSI callback register join failed with status: %02x", status); return status; } if ((status = rsi_wlan_register_callbacks(RSI_WLAN_DATA_RECEIVE_NOTIFY_CB, wfx_rsi_wlan_pkt_cb)) != RSI_SUCCESS) { - SILABS_LOG("%s: RSI callback register data-notify failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_init: RSI callback register data-notify failed with status: %02x", status); return status; } @@ -459,7 +446,7 @@ static int32_t wfx_rsi_init(void) #endif wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY; - SILABS_LOG("%s: RSI: OK", __func__); + SILABS_LOG("wfx_rsi_init: RSI: OK", __func__); return RSI_SUCCESS; } @@ -488,7 +475,7 @@ static void wfx_rsi_save_ap_info() // translation #else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ wfx_rsi.sec.security = WFX_SEC_WPA2; #endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ - SILABS_LOG("%s: warn: failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_save_ap_info: warn: failed with status: %02x", status); return; } wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; @@ -524,7 +511,8 @@ static void wfx_rsi_save_ap_info() // translation break; } - SILABS_LOG("%s: WLAN: connecting to %s, sec=%d, status=%02x", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security, status); + SILABS_LOG("wfx_rsi_save_ap_info: WLAN: connecting to %s, sec=%d, status=%02x", &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security, + status); } /******************************************************************************************** @@ -541,7 +529,7 @@ static void wfx_rsi_do_join(void) if (wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED)) { - SILABS_LOG("%s: not joining - already in progress", __func__); + SILABS_LOG("wfx_rsi_do_join: not joining - already in progress"); } else { @@ -564,11 +552,11 @@ static void wfx_rsi_do_join(void) connect_security_mode = RSI_OPEN; break; default: - SILABS_LOG("%s: error: unknown security type.", __func__); + SILABS_LOG("wfx_rsi_do_join: error: unknown security type."); return; } - SILABS_LOG("%s: WLAN: connecting to %s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); + SILABS_LOG("wfx_rsi_do_join: WLAN: connecting to %s, sec=%d", &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); /* * Join the network @@ -580,33 +568,18 @@ static void wfx_rsi_do_join(void) if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS) { - SILABS_LOG("%s: RSI callback register join failed with status: %02x", __func__, status); + SILABS_LOG("wfx_rsi_do_join: RSI callback register join failed with status: %02x", status); } /* Try to connect Wifi with given Credentials * untill there is a success or maximum number of tries allowed */ - while (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) + if ((status = rsi_wlan_connect_async((int8_t *) &wfx_rsi.sec.ssid[0], connect_security_mode, &wfx_rsi.sec.passkey[0], + wfx_rsi_join_cb)) != RSI_SUCCESS) { - /* Call rsi connect call with given ssid and password - * And check there is a success - */ - if ((status = rsi_wlan_connect_async((int8_t *) &wfx_rsi.sec.ssid[0], connect_security_mode, &wfx_rsi.sec.passkey[0], - wfx_rsi_join_cb)) != RSI_SUCCESS) - { - - wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING; - SILABS_LOG("%s: rsi_wlan_connect_async failed with status: %02x on try %d", __func__, status, wfx_rsi.join_retries); - - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); - wfx_rsi.join_retries++; - } - else - { - SILABS_LOG("%s: starting JOIN to %s after %d tries\n", __func__, (char *) &wfx_rsi.sec.ssid[0], - wfx_rsi.join_retries); - break; // exit while loop - } + wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING; + SILABS_LOG("wfx_rsi_do_join: rsi_wlan_connect_async failed with status: %02x on try %d", status, wfx_rsi.join_retries); + wfx_retry_connection(++wfx_rsi.join_retries); } } } @@ -701,7 +674,7 @@ void ProcessEvent(WfxEvent_t inEvent) switch (inEvent.eventType) { case WFX_EVT_STA_CONN: - SILABS_LOG("%s: starting LwIP STA", __func__); + SILABS_LOG("Starting LwIP STA"); wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED; ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_up(); @@ -715,7 +688,7 @@ void ProcessEvent(WfxEvent_t inEvent) // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE); - SILABS_LOG("%s: disconnect notify", __func__); + SILABS_LOG("Disconnect notify"); /* TODO: Implement disconnect notify */ ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) -> @@ -813,7 +786,7 @@ void wfx_rsi_task(void * arg) uint32_t rsi_status = wfx_rsi_init(); if (rsi_status != RSI_SUCCESS) { - SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status); + SILABS_LOG("wfx_rsi_task: error: wfx_rsi_init with status: %02x", rsi_status); return; } WfxEvent_t wfxEvent; @@ -853,7 +826,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip) wfx_rsi.ip4_addr[1] = (ip >> 8) & HEX_VALUE_FF; wfx_rsi.ip4_addr[2] = (ip >> 16) & HEX_VALUE_FF; wfx_rsi.ip4_addr[3] = (ip >> 24) & HEX_VALUE_FF; - SILABS_LOG("%s: DHCP OK: IP=%d.%d.%d.%d", __func__, wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2], + SILABS_LOG("wfx_dhcp_got_ipv4: DHCP OK: IP=%d.%d.%d.%d", wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2], wfx_rsi.ip4_addr[3]); /* Notify the Connectivity Manager - via the app */ wfx_rsi.dev_state |= WFX_RSI_ST_STA_DHCP_DONE; diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index ac3ad07773d9d3..44e65e2728fa4b 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -99,12 +99,6 @@ bool hasNotifiedWifiConnectivity = false; static uint8_t retryJoin = 0; bool retryInProgress = false; -/* Declare a flag to differentiate between after boot-up first IP connection or reconnection */ -bool is_wifi_disconnection_event = false; - -/* Declare a variable to hold connection time intervals */ -uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS; - #ifdef SL_WFX_CONFIG_SCAN static struct scan_result_holder { @@ -401,14 +395,14 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication } } - if ((status != WFM_STATUS_SUCCESS) && (!is_wifi_disconnection_event ? (retryJoin < MAX_JOIN_RETRIES_COUNT) : true)) + if (status != WFM_STATUS_SUCCESS) { retryJoin += 1; retryInProgress = false; SILABS_LOG("WFX Retry to connect to network count: %d", retryJoin); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) & ~static_cast(SL_WFX_STARTED)); - xEventGroupSetBits(sl_wfx_event_group, SL_WFX_RETRY_CONNECT); + wfx_retry_connection(retryJoin); } } @@ -424,9 +418,8 @@ static void sl_wfx_disconnect_callback(uint8_t * mac, uint16_t reason) SILABS_LOG("WFX Disconnected %d\r\n", reason); sl_wfx_context->state = static_cast(static_cast(sl_wfx_context->state) & ~static_cast(SL_WFX_STA_INTERFACE_CONNECTED)); - retryInProgress = false; - is_wifi_disconnection_event = true; - xEventGroupSetBits(sl_wfx_event_group, SL_WFX_RETRY_CONNECT); + retryInProgress = false; + wfx_retry_connection(retryJoin); } #ifdef SL_WFX_CONFIG_SOFTAP @@ -541,13 +534,8 @@ static void wfx_events_task(void * p_arg) pdTRUE, pdFALSE, pdMS_TO_TICKS(250)); /* 250 msec delay converted to ticks */ if (flags & SL_WFX_RETRY_CONNECT) { - if (!retryInProgress) - { - retryInProgress = true; - wfx_retry_interval_handler(is_wifi_disconnection_event, retryJoin); - SILABS_LOG("WFX sending the connect command"); - wfx_connect_to_ap(); - } + SILABS_LOG("WFX sending the connect command"); + wfx_connect_to_ap(); } if (wifi_extra & WE_ST_STA_CONN) @@ -599,8 +587,7 @@ static void wfx_events_task(void * p_arg) hasNotifiedWifiConnectivity = false; SILABS_LOG("WIFI: Connected to AP"); wifi_extra |= WE_ST_STA_CONN; - retryJoin = 0; - retryInterval = WLAN_MIN_RETRY_TIMER_MS; + retryJoin = 0; wfx_lwip_set_sta_link_up(); #if CHIP_CONFIG_ENABLE_ICD_SERVER if (!(wfx_get_wifi_state() & SL_WFX_AP_INTERFACE_UP)) @@ -750,6 +737,7 @@ static void wfx_wifi_hw_start(void) /* Initialize the LwIP stack */ SILABS_LOG("WF200:Start LWIP"); wfx_lwip_start(); + wfx_started_notify(); wifiContext.state = SL_WFX_STARTED; /* Really this is a bit mask */ SILABS_LOG("WF200:ready.."); } diff --git a/examples/platform/silabs/efr32/wf200/wf200.gni b/examples/platform/silabs/efr32/wf200/wf200.gni index 7e3b4ae6f18d75..307b6815374c38 100644 --- a/examples/platform/silabs/efr32/wf200/wf200.gni +++ b/examples/platform/silabs/efr32/wf200/wf200.gni @@ -4,7 +4,7 @@ import("${efr32_sdk_build_root}/efr32_sdk.gni") wf200_plat_incs = [ "${examples_plat_dir}/wf200" ] wf200_plat_src = [ - "${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp", + "${silabs_common_plat_dir}/wifi/wfx_notify.cpp", "${examples_plat_dir}/wf200/sl_wfx_task.c", "${examples_plat_dir}/wf200/wf200_init.c", "${examples_plat_dir}/wf200/efr_spi.c", diff --git a/examples/platform/silabs/wfx_rsi.h b/examples/platform/silabs/wfx_rsi.h index c559e1e7610880..502dd1a96e772d 100644 --- a/examples/platform/silabs/wfx_rsi.h +++ b/examples/platform/silabs/wfx_rsi.h @@ -31,7 +31,6 @@ #define WFX_RSI_WLAN_TASK_SZ (1024 + 512 + 256) /* Stack for the WLAN task */ #define WFX_RSI_TASK_SZ (1024 + 1024) /* Stack for the WFX/RSI task */ #define WFX_RSI_BUF_SZ (1024 * 10) /* May need tweak */ -#define WFX_RSI_CONFIG_MAX_JOIN (5) /* Max join retries */ // TODO: Default values are usually in minutes, but this is in ms. Confirm if this is correct #define WFX_RSI_DHCP_POLL_INTERVAL (250) /* Poll interval in ms for DHCP */ #define WFX_RSI_NUM_TIMERS (2) /* Number of RSI timers to alloc */ diff --git a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp b/examples/platform/silabs/wifi/wfx_notify.cpp similarity index 64% rename from src/platform/silabs/SiWx917/wifi/wfx_notify.cpp rename to examples/platform/silabs/wifi/wfx_notify.cpp index ded8e8389d256d..a37b102c334804 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp +++ b/examples/platform/silabs/wifi/wfx_notify.cpp @@ -15,6 +15,9 @@ * limitations under the License. */ +#include "AppConfig.h" +#include "BaseApplication.h" +#include #include #include #include @@ -29,32 +32,33 @@ #include "wfx_rsi.h" #endif -#if SL_ICD_ENABLED -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif // SL_ICD_ENABLED - #include -// #include -#include -#include using namespace ::chip; using namespace ::chip::DeviceLayer; -#include - -extern uint32_t retryInterval; +namespace { +constexpr uint8_t kWlanMinRetryIntervalsInSec = 1; +constexpr uint8_t kWlanMaxRetryIntervalsInSec = 60; +constexpr uint8_t kWlanRetryIntervalInSec = 5; +uint8_t retryInterval = kWlanMinRetryIntervalsInSec; +osTimerId_t sRetryTimer; +} // namespace /* * Notifications to the upper-layer * All done in the context of the RSI/WiFi task (rsi_if.c) */ +static void RetryConnectionTimerHandler(void * arg) +{ +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + wfx_rsi_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + if (wfx_connect_to_ap() != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); + } +} /*********************************************************************************** * @fn wfx_started_notify() * @brief @@ -67,6 +71,10 @@ void wfx_started_notify() sl_wfx_startup_ind_t evt; sl_wfx_mac_address_t mac; + // Creating a timer which will be used to retry connection with AP + sRetryTimer = osTimerNew(RetryConnectionTimerHandler, osTimerOnce, NULL, NULL); + VerifyOrReturn(sRetryTimer != NULL); + memset(&evt, 0, sizeof(evt)); evt.header.id = SL_WFX_STARTUP_IND_ID; evt.header.length = sizeof evt; @@ -90,13 +98,7 @@ void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap) { sl_wfx_connect_ind_t evt; - if (status != SUCCESS_STATUS) - { - ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status); - return; - } - - ChipLogProgress(DeviceLayer, "%s: connected.", __func__); + VerifyOrReturn(status != SUCCESS_STATUS); memset(&evt, 0, sizeof(evt)); evt.header.id = SL_WFX_CONNECT_IND_ID; @@ -143,16 +145,6 @@ void wfx_ipv6_notify(int got_ip) eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP; eventData.header.length = sizeof(eventData.header); PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); - - /* So the other threads can run and have the connectivity OK */ - if (got_ip) - { - /* Should remember this */ - vTaskDelay(1); - chip::DeviceLayer::PlatformMgr().LockChipStack(); - chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/); - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - } } /************************************************************************************** @@ -170,67 +162,67 @@ void wfx_ip_changed_notify(int got_ip) eventData.header.id = got_ip ? IP_EVENT_STA_GOT_IP : IP_EVENT_STA_LOST_IP; eventData.header.length = sizeof(eventData.header); PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); - - /* So the other threads can run and have the connectivity OK */ - if (got_ip) - { - /* Should remember this */ - vTaskDelay(1); - chip::DeviceLayer::PlatformMgr().LockChipStack(); - chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/); - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - } } /************************************************************************************** - * @fn void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin) + * @fn void wfx_retry_connection(uint16_t retryAttempt) * @brief - * Based on condition will delay for a certain period of time. - * @param[in] is_wifi_disconnection_event, retryJoin + * During commissioning, we retry to join the network MAX_JOIN_RETRIES_COUNT times. + * If DUT is disconnected from the AP or device is power cycled, then retry connection + * with AP continously after a certain time interval. + * @param[in] retryAttempt * @return None ********************************************************************************************/ -void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin) +void wfx_retry_connection(uint16_t retryAttempt) { - if (!is_wifi_disconnection_event) + // During commissioning, we retry to join the network MAX_JOIN_RETRIES_COUNT + if (BaseApplication::sAppDelegate.isCommissioningInProgress()) { - /* After the reboot or a commissioning time device failed to connect with AP. - * Device will retry to connect with AP upto WFX_RSI_CONFIG_MAX_JOIN retries. - */ - if (retryJoin < MAX_JOIN_RETRIES_COUNT) + if (retryAttempt < MAX_JOIN_RETRIES_COUNT) { - ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %d Seconds", - CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS)); -#if SL_ICD_ENABLED - // TODO: cleanup the retry logic MATTER-1921 - if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) + ChipLogProgress(DeviceLayer, "wfx_retry_connection : Next attempt after %d Seconds", kWlanRetryIntervalInSec); + if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(CONVERT_SEC_TO_MS(kWlanRetryIntervalInSec))) != osOK) { - wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); + ChipLogProgress(DeviceLayer, "Failed to start retry timer"); + // Sending the join command if retry timer failed to start + if (wfx_connect_to_ap() != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); + } + return; } -#endif // SL_ICD_ENABLED - vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS)); } else { - ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryJoin); + ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryAttempt); } } else { - /* After disconnection + /* After disconnection or power cycle the DUT * At the telescopic time interval device try to reconnect with AP, upto WLAN_MAX_RETRY_TIMER_MS intervals * are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at * WLAN_MAX_RETRY_TIMER_MS intervals. */ - if (retryInterval > WLAN_MAX_RETRY_TIMER_MS) + if (retryInterval > kWlanMaxRetryIntervalsInSec) + { + retryInterval = kWlanMaxRetryIntervalsInSec; + } + if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(CONVERT_SEC_TO_MS(retryInterval))) != osOK) { - retryInterval = WLAN_MAX_RETRY_TIMER_MS; + ChipLogProgress(DeviceLayer, "Failed to start retry timer"); + // Sending the join command if retry timer failed to start + if (wfx_connect_to_ap() != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); + } + return; } - ChipLogProgress(DeviceLayer, "wfx_retry_interval_handler : Next attempt after %ld Seconds", - CONVERT_MS_TO_SEC(retryInterval)); -#if SL_ICD_ENABLED +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); -#endif // SL_ICD_ENABLED - vTaskDelay(pdMS_TO_TICKS(retryInterval)); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + ChipLogProgress(DeviceLayer, "wfx_retry_connection : Next attempt after %d Seconds", retryInterval); retryInterval += retryInterval; + return; } } diff --git a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h index beee667f58f261..319a1c508e658d 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h +++ b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h @@ -60,11 +60,7 @@ #define BLE_DRIVER_TASK_PRIORITY (2) #define MAX_JOIN_RETRIES_COUNT (5) -// WLAN retry time intervals in milli seconds -#define WLAN_MAX_RETRY_TIMER_MS 30000 -#define WLAN_MIN_RETRY_TIMER_MS 1000 -#define WLAN_RETRY_TIMER_MS 5000 -#define CONVERT_MS_TO_SEC(TimeInMS) (TimeInMS / 1000) +#define CONVERT_SEC_TO_MS(TimeInS) (TimeInS * 1000) // WLAN related Macros #define ETH_FRAME (0) @@ -255,7 +251,7 @@ void sl_button_on_change(uint8_t btn, uint8_t btnAction); #endif /* SL_ICD_ENABLED */ void wfx_ipv6_notify(int got_ip); -void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin); +void wfx_retry_connection(uint16_t retryAttempt); #ifdef __cplusplus } diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index 24e5b6ea707a7a..51f96d7b9dbc73 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -139,12 +139,10 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #define WLAN_TASK_PRIORITY 1 #define WLAN_DRIVER_TASK_PRIORITY 1 #define BLE_DRIVER_TASK_PRIORITY 1 -#define MAX_JOIN_RETRIES_COUNT 5 #else /* WF200 */ #define WLAN_TASK_STACK_SIZE 1024 #define WLAN_TASK_PRIORITY 1 -#define MAX_JOIN_RETRIES_COUNT 5 #endif // RS911X_WIFI // MAX SSID LENGTH excluding NULL character @@ -152,11 +150,10 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s // MAX PASSKEY LENGTH including NULL character #define WFX_MAX_PASSKEY_LENGTH (64) -// WLAN retry time intervals in milli seconds -#define WLAN_MAX_RETRY_TIMER_MS 30000 -#define WLAN_MIN_RETRY_TIMER_MS 1000 -#define WLAN_RETRY_TIMER_MS 5000 -#define CONVERT_MS_TO_SEC(TimeInMS) (TimeInMS / 1000) +#define CONVERT_SEC_TO_MS(TimeInS) (TimeInS * 1000) + +// WLAN MAX retry +#define MAX_JOIN_RETRIES_COUNT 5 // WLAN related Macros #define ETH_FRAME 0 @@ -388,7 +385,7 @@ void sl_wfx_host_gpio_init(void); sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); #endif -void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin); +void wfx_retry_connection(uint16_t retryAttempt); #ifdef __cplusplus } diff --git a/src/platform/silabs/efr32/wifi/wfx_notify.cpp b/src/platform/silabs/efr32/wifi/wfx_notify.cpp deleted file mode 100644 index fd183100e7b913..00000000000000 --- a/src/platform/silabs/efr32/wifi/wfx_notify.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * - * Copyright (c) 2022 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 "em_bus.h" -#include "em_cmu.h" -#include "em_gpio.h" -#include "em_ldma.h" -#include "em_usart.h" -#include "gpiointerrupt.h" - -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" - -#include "wfx_host_events.h" - -#ifdef RS911X_WIFI -#include "wfx_rsi.h" -#endif - -#include -#include -#include -#include - -using namespace ::chip; -using namespace ::chip::DeviceLayer; - -extern uint32_t retryInterval; - -/* - * Notifications to the upper-layer - * All done in the context of the RSI/WiFi task (rsi_if.c) - */ - -/*********************************************************************************** - * @fn wfx_started_notify() - * @brief - * Wifi device started notification - * @param[in]: None - * @return None - *************************************************************************************/ -void wfx_started_notify() -{ - sl_wfx_startup_ind_t evt; - sl_wfx_mac_address_t mac; - - memset(&evt, 0, sizeof(evt)); - evt.header.id = SL_WFX_STARTUP_IND_ID; - evt.header.length = sizeof evt; - evt.body.status = 0; - wfx_get_wifi_mac_addr(SL_WFX_STA_INTERFACE, &mac); - memcpy(&evt.body.mac_addr[0], &mac.octet[0], MAC_ADDRESS_FIRST_OCTET); - - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); -} - -/*********************************************************************************** - * @fn void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t *ap) - * @brief - * For now we are not notifying anything other than AP Mac - - * Other stuff such as DTIM etc. may be required for later - * @param[in] status: - * @param[in] ap: access point - * @return None - *************************************************************************************/ -void wfx_connected_notify(int32_t status, sl_wfx_mac_address_t * ap) -{ - sl_wfx_connect_ind_t evt; - - if (status != SUCCESS_STATUS) - { - ChipLogProgress(DeviceLayer, "%s: error: failed status: %ld.", __func__, status); - return; - } - - ChipLogProgress(DeviceLayer, "%s: connected.", __func__); - - memset(&evt, 0, sizeof(evt)); - evt.header.id = SL_WFX_CONNECT_IND_ID; - evt.header.length = sizeof evt; - -#ifdef RS911X_WIFI - evt.body.channel = wfx_rsi.ap_chan; -#endif - memcpy(&evt.body.mac[0], &ap->octet[0], MAC_ADDRESS_FIRST_OCTET); - - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); -} - -/************************************************************************************** - * @fn void wfx_disconnected_notify(int32_t status) - * @brief - * notification of disconnection - * @param[in] status: - * @return None - ********************************************************************************************/ -void wfx_disconnected_notify(int32_t status) -{ - sl_wfx_disconnect_ind_t evt; - - memset(&evt, 0, sizeof(evt)); - evt.header.id = SL_WFX_DISCONNECT_IND_ID; - evt.header.length = sizeof evt; - evt.body.reason = status; - PlatformMgrImpl().HandleWFXSystemEvent(WIFI_EVENT, (sl_wfx_generic_message_t *) &evt); -} - -/************************************************************************************** - * @fn void wfx_ipv6_notify(int got_ip) - * @brief - * notification of ipv6 - * @param[in] got_ip: - * @return None - ********************************************************************************************/ -void wfx_ipv6_notify(int got_ip) -{ - sl_wfx_generic_message_t eventData; - - memset(&eventData, 0, sizeof(eventData)); - eventData.header.id = got_ip ? IP_EVENT_GOT_IP6 : IP_EVENT_STA_LOST_IP; - eventData.header.length = sizeof(eventData.header); - PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); - - /* So the other threads can run and have the connectivity OK */ - if (got_ip) - { - /* Should remember this */ - vTaskDelay(1); - chip::DeviceLayer::PlatformMgr().LockChipStack(); - chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/); - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - } -} - -/************************************************************************************** - * @fn void wfx_ip_changed_notify(int got_ip) - * @brief - * notification of ip change - * @param[in] got_ip: - * @return None - ********************************************************************************************/ -void wfx_ip_changed_notify(int got_ip) -{ - sl_wfx_generic_message_t eventData; - - memset(&eventData, 0, sizeof(eventData)); - eventData.header.id = got_ip ? IP_EVENT_STA_GOT_IP : IP_EVENT_STA_LOST_IP; - eventData.header.length = sizeof(eventData.header); - PlatformMgrImpl().HandleWFXSystemEvent(IP_EVENT, &eventData); - - /* So the other threads can run and have the connectivity OK */ - if (got_ip) - { - /* Should remember this */ - vTaskDelay(1); - chip::DeviceLayer::PlatformMgr().LockChipStack(); - chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/); - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - } -} - -/************************************************************************************** - * @fn void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin) - * @brief - * Based on condition will delay for a certain period of time. - * @param[in] is_wifi_disconnection_event, retryJoin - * @return None - ********************************************************************************************/ -void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin) -{ - if (!is_wifi_disconnection_event) - { - /* After the reboot or a commissioning time device failed to connect with AP. - * Device will retry to connect with AP upto WFX_RSI_CONFIG_MAX_JOIN retries. - */ - if (retryJoin < MAX_JOIN_RETRIES_COUNT) - { - ChipLogProgress(DeviceLayer, "%s: Next attempt after %d Seconds", __func__, CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS)); - vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS)); - } - else - { - ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryJoin); - } - } - else - { - /* After disconnection - * At the telescopic time interval device try to reconnect with AP, upto WLAN_MAX_RETRY_TIMER_MS intervals - * are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at - * WLAN_MAX_RETRY_TIMER_MS intervals. - */ - if (retryInterval > WLAN_MAX_RETRY_TIMER_MS) - { - retryInterval = WLAN_MAX_RETRY_TIMER_MS; - } - ChipLogProgress(DeviceLayer, "%s: Next attempt after %ld Seconds", __func__, CONVERT_MS_TO_SEC(retryInterval)); - vTaskDelay(pdMS_TO_TICKS(retryInterval)); - retryInterval += retryInterval; - } -} diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 617dfd10facb95..ce7b09e3e012ac 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -89,6 +89,8 @@ declare_args() { examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi" +silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" + is_series_2 = silabs_family == "mgm24" || silabs_family == "efr32mg24" || silabs_family == "efr32mg26" From be0009e75879cb61e57ad09e7d2e67677d52f679 Mon Sep 17 00:00:00 2001 From: waqar rashid <6962179+wickywaka@users.noreply.github.com> Date: Sat, 24 Aug 2024 01:33:21 +0200 Subject: [PATCH 49/53] Fixed missing trailing zero in example documentation (#35149) Co-authored-by: Boris Zbarsky --- docs/getting_started/first_example.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started/first_example.md b/docs/getting_started/first_example.md index 4aba0d4e480204..fefa1916c2ef83 100644 --- a/docs/getting_started/first_example.md +++ b/docs/getting_started/first_example.md @@ -92,7 +92,7 @@ codes, discriminator and passcode from the logs. Open a new terminal to use chip tool. Commission the device using: -`./out/linux-x64-chip-tool/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G0` +`./out/linux-x64-chip-tool/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G00` NOTE: pairing is the old name for commissioning. 0x12344321 is the node ID you want to assign to the node. 0x12344321 is the default for testing. From a93f4b6a98535cd03905a06032ad362f20c48faf Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Sat, 24 Aug 2024 06:45:25 +0530 Subject: [PATCH 50/53] [Silabs] Fixing the build for the custom boards on NCP (#35055) * fixing the build for the custom boards on ncp * Restyled by clang-format * applying the restyler * addressing the review comments and adding sl_custom_board.h file * adding the warning message for 917 NCP * Restyled by whitespace * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Yufeng Wang * Restyled by clang-format --------- Co-authored-by: Restyled.io Co-authored-by: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Co-authored-by: Yufeng Wang --- .../silabs/efr32/rs911x/hal/efx32_ncp_host.c | 3 + .../silabs/efr32/rs911x/hal/efx_spi.c | 19 ++--- .../rs911x/hal/rsi_board_configuration.h | 3 +- .../efr32/rs911x/hal/sl_board_configuration.h | 3 +- .../efr32/rs911x/hal/sl_si91x_ncp_utility.c | 4 +- .../platform/silabs/efr32/sl_custom_board.h | 71 +++++++++++++++++++ .../platform/silabs/efr32/wf200/efr_spi.c | 5 -- .../silabs/efr32/wf200/sl_wfx_board.h | 3 +- 8 files changed, 88 insertions(+), 23 deletions(-) create mode 100644 examples/platform/silabs/efr32/sl_custom_board.h diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c index fded8defa30dce..0a2fad7d0deb6c 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c @@ -36,7 +36,10 @@ #include "sl_power_manager.h" #endif +#ifdef SL_BOARD_NAME #include "sl_board_control.h" +#endif // SL_BOARD_NAME + #include "sl_si91x_ncp_utility.h" #include "spi_multiplex.h" diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index 6c03b6f1f4835b..1f10640e04bad8 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -35,7 +35,6 @@ #include "em_gpio.h" #include "em_ldma.h" #include "gpiointerrupt.h" -#include "sl_board_control.h" #include "sl_device_init_clocks.h" #include "sl_device_init_hfxo.h" #include "sl_spidrv_instances.h" @@ -47,6 +46,10 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" +#ifdef SL_BOARD_NAME +#include "sl_board_control.h" +#endif // SL_BOARD_NAME + #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #include "sl_power_manager.h" #endif @@ -65,18 +68,12 @@ #include "sl_mx25_flash_shutdown_usart_config.h" #endif // SL_MX25CTRL_MUX -#if defined(EFR32MG24) #include "em_eusart.h" #include "sl_spidrv_eusart_exp_config.h" #include "spi_multiplex.h" -#else -#error "Unknown platform" -#endif -#if defined(EFR32MG24) #define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle #define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED SL_SPIDRV_EUSART_EXP_BITRATE -#endif #define CONCAT(A, B) (A##B) #define SPI_CLOCK(N) CONCAT(cmuClock_USART, N) @@ -113,10 +110,8 @@ void sl_wfx_host_gpio_init(void) // Enable GPIO clock. CMU_ClockEnable(cmuClock_GPIO, true); -#if defined(EFR32MG24) // Set CS pin to high/inactive GPIO_PinModeSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN, gpioModePushPull, PINOUT_SET); -#endif // EFR32MG24 GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, PINOUT_SET); GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModePushPull, PINOUT_CLEAR); @@ -195,9 +190,7 @@ sl_status_t sl_wfx_host_spi_cs_assert(void) if (!spi_enabled) // Reduce sl_spidrv_init_instances { sl_spidrv_init_instances(); -#if defined(EFR32MG24) GPIO_PinOutClear(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); -#endif // EFR32MG24 spi_enabled = true; } return SL_STATUS_OK; @@ -211,11 +204,9 @@ sl_status_t sl_wfx_host_spi_cs_deassert(void) status = SPIDRV_DeInit(SL_SPIDRV_HANDLE); if (SL_STATUS_OK == status) { -#if defined(EFR32MG24) GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN); GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR; -#endif // EFR32MG24 - spi_enabled = false; + spi_enabled = false; } } #if SL_SPICTRL_MUX diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h b/examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h index 4d8d9da1dd36a9..ed04acf5b3fa40 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h +++ b/examples/platform/silabs/efr32/rs911x/hal/rsi_board_configuration.h @@ -35,7 +35,8 @@ typedef struct #elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C) #include "brd4187c.h" #else -#error "Need SPI Pins" +#include "sl_custom_board.h" +#warning "Modify sl_custom_board.h configuration file to match your hardware SPIDRV USART peripheral" #endif /* EFR32MG24_BRD4186C */ #endif /* _RSI_BOARD_CONFIGURATION_H_ */ diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h index c1dceab06d8228..317bdc5bd22aa4 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h @@ -36,7 +36,8 @@ typedef struct #elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C) #include "brd4187c.h" #else -#error "Need SPI Pins" +#include "sl_custom_board.h" +#warning "Modify sl_custom_board.h configuration file to match your hardware SPIDRV USART peripheral" #endif #if EXP_BOARD #define RESET_PIN PIN(A, 6) diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c index 4b876883c12b0f..b16bbdc47579e0 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c @@ -36,7 +36,9 @@ #include "spidrv.h" #include "task.h" +#ifdef SL_BOARD_NAME #include "sl_board_control.h" +#endif // SL_BOARD_NAME #include "sl_device_init_clocks.h" #include "sl_device_init_hfxo.h" @@ -242,4 +244,4 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void) GPIO_PinOutSet(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN); return SL_STATUS_OK; } -#endif // SL_MX25CTRL_MUX \ No newline at end of file +#endif // SL_MX25CTRL_MUX diff --git a/examples/platform/silabs/efr32/sl_custom_board.h b/examples/platform/silabs/efr32/sl_custom_board.h new file mode 100644 index 00000000000000..420b715de9ba76 --- /dev/null +++ b/examples/platform/silabs/efr32/sl_custom_board.h @@ -0,0 +1,71 @@ +/* + * This file is used to set the pins for the SPI for Custom boards + * The SPI pins are defined in the file + * + * !!!! MODIFY THIS FILE TO THE CORRECT PINS !!!! + */ + +#ifndef _CUSTOM_BOARD_H_ +#define _CUSTOM_BOARD_H_ + +#define WAKE_INDICATOR_PIN PIN(D, 2) +#ifdef RS911X_WIFI +// SPI ports and pins +#define EUS1MOSI_PORT gpioPortC +#define EUS1MOSI_PIN 1 +#define EUS1MISO_PORT gpioPortC +#define EUS1MISO_PIN 2 +#define EUS1SCLK_PORT gpioPortC +#define EUS1SCLK_PIN 3 +#define EUS1CS_PORT gpioPortC +#define EUS1CS_PIN 0 + +#define MY_USART EUSART1 +#define MY_USART_CLOCK cmuClock_EUSART1 +#define MY_USART_TX_SIGNAL dmadrvPeripheralSignal_EUSART1_TXBL +#define MY_USART_RX_SIGNAL dmadrvPeripheralSignal_EUSART1_RXDATAV + +#define WFX_RESET_PIN PIN(A, 6) +#define WFX_INTERRUPT_PIN PIN(A, 7) +#ifdef EXP_BOARD +#define WFX_SLEEP_CONFIRM_PIN PIN(D, 2) /* Expansion header pin7 */ +#else +#define WFX_SLEEP_CONFIRM_PIN PIN(A, 5) +#endif /* EXP_BOARD */ +#define SL_WFX_HOST_PINOUT_SPI_IRQ 5 + +#else /* WF200 */ + +#define PIN_OUT_SET 1 +#define PIN_OUT_CLEAR 0 + +#define MY_USART USART0 +#define MY_USART_CLOCK cmuClock_USART0 +#define MY_USART_TX_SIGNAL dmadrvPeripheralSignal_USART0_TXBL +#define MY_USART_RX_SIGNAL dmadrvPeripheralSignal_USART0_RXDATAV + +#define SL_WFX_HOST_PINOUT_RESET_PORT gpioPortA +#define SL_WFX_HOST_PINOUT_RESET_PIN 5 +#define SL_WFX_HOST_PINOUT_SPI_WIRQ_PORT gpioPortA /* SPI IRQ port */ +#define SL_WFX_HOST_PINOUT_SPI_WIRQ_PIN 8 /* SPI IRQ pin */ +#define SL_WFX_HOST_PINOUT_WUP_PORT gpioPortB +#define SL_WFX_HOST_PINOUT_WUP_PIN 5 + +#define SL_WFX_HOST_PINOUT_SPI_TX_PORT gpioPortC +#define SL_WFX_HOST_PINOUT_SPI_TX_PIN 1 +#define SL_WFX_HOST_PINOUT_SPI_TX_LOC 1 + +#define SL_WFX_HOST_PINOUT_SPI_RX_PORT gpioPortC +#define SL_WFX_HOST_PINOUT_SPI_RX_PIN 2 +#define SL_WFX_HOST_PINOUT_SPI_RX_LOC 1 + +#define SL_WFX_HOST_PINOUT_SPI_CLK_PORT gpioPortC +#define SL_WFX_HOST_PINOUT_SPI_CLK_PIN 3 +#define SL_WFX_HOST_PINOUT_SPI_CLK_LOC 1 + +#define SL_WFX_HOST_PINOUT_SPI_CS_PORT gpioPortC +#define SL_WFX_HOST_PINOUT_SPI_CS_PIN 0 +#define SL_WFX_HOST_PINOUT_SPI_CS_LOC 1 + +#endif /* WF200/9116 */ +#endif /* _CUSTOM_BOARD_H_ */ diff --git a/examples/platform/silabs/efr32/wf200/efr_spi.c b/examples/platform/silabs/efr32/wf200/efr_spi.c index 122652e96da39d..3ef34c928e0363 100644 --- a/examples/platform/silabs/efr32/wf200/efr_spi.c +++ b/examples/platform/silabs/efr32/wf200/efr_spi.c @@ -98,11 +98,9 @@ sl_status_t sl_wfx_host_init_bus(void) * EUSARTROUTE register to do this. */ -#if defined(EFR32MG24) GPIO->USARTROUTE[0].ROUTEEN = GPIO_USART_ROUTEEN_RXPEN | // MISO GPIO_USART_ROUTEEN_TXPEN | // MOSI GPIO_USART_ROUTEEN_CLKPEN; -#endif spi_sem = xSemaphoreCreateBinaryStatic(&xEfrSpiSemaBuffer); xSemaphoreGive(spi_sem); @@ -338,11 +336,8 @@ void sl_wfx_host_gpio_init(void) { // Enable GPIO clock. CMU_ClockEnable(cmuClock_GPIO, true); - -#if defined(EFR32MG24) // configure WF200 CS pin. GPIO_PinModeSet(SL_SPIDRV_EXP_CS_PORT, SL_SPIDRV_EXP_CS_PIN, gpioModePushPull, 1); -#endif // Configure WF200 reset pin. GPIO_PinModeSet(SL_WFX_HOST_PINOUT_RESET_PORT, SL_WFX_HOST_PINOUT_RESET_PIN, gpioModePushPull, 0); // Configure WF200 WUP pin. diff --git a/examples/platform/silabs/efr32/wf200/sl_wfx_board.h b/examples/platform/silabs/efr32/wf200/sl_wfx_board.h index 3cbed666d68eab..35ce2f633d0c59 100644 --- a/examples/platform/silabs/efr32/wf200/sl_wfx_board.h +++ b/examples/platform/silabs/efr32/wf200/sl_wfx_board.h @@ -25,6 +25,7 @@ #elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C) || defined(EFR32MG24_BRD4187A) || defined(BRD4187A) #include "brd4187c.h" #else -#error "Need SPI Pins" +#include "sl_custom_board.h" +#warning "Modify sl_custom_board.h configuration file to match your hardware SPIDRV USART peripheral" #endif #endif /* _SL_WFX_BOARD_H_ */ From 05b60aa86a6d71aa3f8d011652f8b06cbea8ba3f Mon Sep 17 00:00:00 2001 From: Anush Nadathur Date: Sat, 24 Aug 2024 13:54:25 -0700 Subject: [PATCH 51/53] [Darwin] Adding missing property on MTRDeviceController_XPC (#35188) - Added controllerID to match the OverXPC interface --- src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 67049b280d81f3..d72dc211b70b4f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -78,6 +78,11 @@ - (NSXPCInterface *)_interfaceForClientProtocol return interface; } +- (id)controllerXPCID +{ + return [self.uniqueIdentifier UUIDString]; +} + - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection * (^)(void) )connectionBlock { if (self = [super initForSubclasses]) { From a296b6609ec064b201cca9880c577f0197217d43 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Sun, 25 Aug 2024 19:16:00 -0700 Subject: [PATCH 52/53] [Fabric-Bridge] Add state machine to CommissionerControlDelegate to guard various unexpected commands (#35186) * Add state machine to CommissionerControlDelegate to guard various unexpected commands * Restyled by whitespace * Restyled by clang-format * Do not reset state when commissionNode fail to allow retry --------- Co-authored-by: Restyled.io --- .../linux/CommissionerControl.cpp | 67 ++++++++++++++++--- .../linux/include/CommissionerControl.h | 13 ++++ 2 files changed, 71 insertions(+), 9 deletions(-) diff --git a/examples/fabric-bridge-app/linux/CommissionerControl.cpp b/examples/fabric-bridge-app/linux/CommissionerControl.cpp index 3613aeec9305e4..0466ab8b711b69 100644 --- a/examples/fabric-bridge-app/linux/CommissionerControl.cpp +++ b/examples/fabric-bridge-app/linux/CommissionerControl.cpp @@ -46,8 +46,33 @@ namespace app { namespace Clusters { namespace CommissionerControl { +void CommissionerControlDelegate::ResetDelegateState() +{ + // Reset the step to the initial state + mNextStep = Step::kIdle; + + // Reset identifiers and product information + mRequestId = 0; + mClientNodeId = kUndefinedNodeId; + mVendorId = VendorId::Unspecified; + mProductId = 0; + + // Clear the label buffer and optional label + memset(mLabelBuffer, 0, sizeof(mLabelBuffer)); + mLabel.ClearValue(); + + // Reset PBKDF salt and PAKE passcode verifier buffers + mPBKDFSalt = ByteSpan(); + memset(mPBKDFSaltBuffer, 0, sizeof(mPBKDFSaltBuffer)); + + mPAKEPasscodeVerifier = ByteSpan(); + memset(mPAKEPasscodeVerifierBuffer, 0, sizeof(mPAKEPasscodeVerifierBuffer)); +} + CHIP_ERROR CommissionerControlDelegate::HandleCommissioningApprovalRequest(const CommissioningApprovalRequest & request) { + VerifyOrReturnError(mNextStep == Step::kIdle, CHIP_ERROR_INCORRECT_STATE); + CommissionerControl::Events::CommissioningRequestResult::Type result; result.requestId = request.requestId; result.clientNodeId = request.clientNodeId; @@ -86,19 +111,34 @@ CHIP_ERROR CommissionerControlDelegate::HandleCommissioningApprovalRequest(const mLabel.ClearValue(); } - return CommissionerControlServer::Instance().GenerateCommissioningRequestResultEvent(result); + CHIP_ERROR err = CommissionerControlServer::Instance().GenerateCommissioningRequestResultEvent(result); + + if (err == CHIP_NO_ERROR) + { + mNextStep = Step::kWaitCommissionNodeRequest; + } + else + { + ResetDelegateState(); + } + + return err; } CHIP_ERROR CommissionerControlDelegate::ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) { CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturnError(mNextStep == Step::kWaitCommissionNodeRequest, CHIP_ERROR_INCORRECT_STATE); + // Verify if the CommissionNode command is sent from the same NodeId as the RequestCommissioningApproval. VerifyOrExit(mClientNodeId == clientNodeId, err = CHIP_ERROR_WRONG_NODE_ID); // Verify if the provided RequestId matches the value provided to the RequestCommissioningApproval. VerifyOrExit(mRequestId == requestId, err = CHIP_ERROR_INCORRECT_STATE); + mNextStep = Step::kStartCommissionNode; + exit: return err; } @@ -129,20 +169,29 @@ CHIP_ERROR CommissionerControlDelegate::GetCommissioningWindowParams(Commissioni CHIP_ERROR CommissionerControlDelegate::HandleCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, const Optional & port) { + CHIP_ERROR err = CHIP_NO_ERROR; + ChipLogProgress(NotSpecified, "CommissionerControlDelegate::HandleCommissionNode"); + VerifyOrReturnError(mNextStep == Step::kStartCommissionNode, CHIP_ERROR_INCORRECT_STATE); + #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE - return CommissionNode(Controller::CommissioningWindowPasscodeParams() - .SetSetupPIN(kSetupPinCode) - .SetTimeout(params.commissioningTimeout) - .SetDiscriminator(params.discriminator) - .SetIteration(params.iterations) - .SetSalt(params.salt), - mVendorId, mProductId); + err = CommissionNode(Controller::CommissioningWindowPasscodeParams() + .SetSetupPIN(kSetupPinCode) + .SetTimeout(params.commissioningTimeout) + .SetDiscriminator(params.discriminator) + .SetIteration(params.iterations) + .SetSalt(params.salt), + mVendorId, mProductId); #else ChipLogProgress(NotSpecified, "Failed to reverse commission bridge: PW_RPC_FABRIC_BRIDGE_SERVICE not defined"); - return CHIP_ERROR_NOT_IMPLEMENTED; + err = CHIP_ERROR_NOT_IMPLEMENTED; #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + + // Reset the delegate's state to prepare for a new commissioning sequence. + ResetDelegateState(); + + return err; } } // namespace CommissionerControl diff --git a/examples/fabric-bridge-app/linux/include/CommissionerControl.h b/examples/fabric-bridge-app/linux/include/CommissionerControl.h index 633be761ba1004..486668ffa212f7 100644 --- a/examples/fabric-bridge-app/linux/include/CommissionerControl.h +++ b/examples/fabric-bridge-app/linux/include/CommissionerControl.h @@ -38,8 +38,21 @@ class CommissionerControlDelegate : public Delegate ~CommissionerControlDelegate() = default; private: + enum class Step : uint8_t + { + // Ready to start reverse commissioning. + kIdle, + // Wait for the commission node command. + kWaitCommissionNodeRequest, + // Need to commission node. + kStartCommissionNode, + }; + + void ResetDelegateState(); + static constexpr size_t kLabelBufferSize = 64; + Step mNextStep = Step::kIdle; uint64_t mRequestId = 0; NodeId mClientNodeId = kUndefinedNodeId; VendorId mVendorId = VendorId::Unspecified; From acba7f83e2891e7d1bcb8f3e11a9d938d38f28e5 Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Sun, 25 Aug 2024 23:55:45 -0700 Subject: [PATCH 53/53] =?UTF-8?q?Move=20the=20constraint=20check=20for=20n?= =?UTF-8?q?umber=20of=20presets=20not=20to=20exceed=20the=20num=E2=80=A6?= =?UTF-8?q?=20(#35167)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move the constraint check for number of presets not to exceed the number of presets supported from the atomic write commit command handling to the write request * Minor fix * Do not check if totalExpectedCount > 0 since its an unsigned integer - Also no need to check if numberOfPresetsSupported is 0. * Update src/app/clusters/thermostat-server/thermostat-server-presets.cpp * Update src/app/clusters/thermostat-server/thermostat-server-presets.cpp --------- Co-authored-by: Boris Zbarsky --- .../thermostat-server-presets.cpp | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server-presets.cpp b/src/app/clusters/thermostat-server/thermostat-server-presets.cpp index e57c2f9c95f8fd..a56c94fa49834d 100644 --- a/src/app/clusters/thermostat-server/thermostat-server-presets.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server-presets.cpp @@ -402,6 +402,20 @@ CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * dele return CHIP_IM_GLOBAL_STATUS(ConstraintError); } + // Before adding this preset to the pending presets, if the expected length of the pending presets' list + // exceeds the total number of presets supported, return RESOURCE_EXHAUSTED. Note that the preset has not been appended yet. + + uint8_t numberOfPendingPresets = CountNumberOfPendingPresets(delegate); + + // We will be adding one more preset, so reject if the length is already at max. + if (numberOfPendingPresets >= delegate->GetNumberOfPresets()) + { + return CHIP_IM_GLOBAL_STATUS(ResourceExhausted); + } + + // TODO #34556 : Check if the number of presets for each presetScenario exceeds the max number of presets supported for that + // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. + return delegate->AppendToPendingPresetList(preset); } @@ -504,25 +518,6 @@ Status ThermostatAttrAccess::PrecommitPresets(EndpointId endpoint) } } - uint8_t totalCount = CountNumberOfPendingPresets(delegate); - - uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets(); - - if (numberOfPresetsSupported == 0) - { - ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); - return Status::InvalidInState; - } - - // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, - // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. - if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) - { - return Status::ResourceExhausted; - } - - // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that - // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. return Status::Success; }