From 5b8eccd48a602613034569b113fc9de5097da3d2 Mon Sep 17 00:00:00 2001 From: Philip Gregor Date: Thu, 29 Feb 2024 17:09:02 -0800 Subject: [PATCH] ZAP-generated Matter TV Casting Attribute and Cluster objects --- .../project.pbxproj | 24 +- .../MatterTvCastingBridge/MCCluster.mm | 2 +- .../MatterTvCastingBridge/MCClusterObjects.h | 47 - .../MatterTvCastingBridge/MCClusterObjects.mm | 52 - .../MatterTvCastingBridge/MCEndpoint.mm | 2 +- .../MatterTvCastingBridge.h | 2 +- .../templates/MCAttributeObjects-src.zapt | 4 - .../templates/MCAttributeObjects.zapt | 37 +- .../MCAttributeTLVValueDecoder-src.zapt | 106 - .../templates/MCClusterObjects-src.zapt | 54 +- .../templates/MCClusterObjects.zapt | 49 +- .../templates/MCCommandObjects-src.zapt | 4 +- .../templates/MCCommandObjects.zapt | 4 +- .../MTRAttributeSpecifiedCheck-src.zapt | 47 - .../templates/MTRBaseClusters-src.zapt | 341 -- .../templates/MTRBaseClusters.zapt | 276 -- .../templates/MTRBaseClusters_Internal.zapt | 9 - .../templates/MTRClusterConstants.zapt | 221 -- .../templates/MTRClusters-src.zapt | 222 -- .../templates/MTRClusters.zapt | 159 - .../templates/MTRClusters_Internal.zapt | 10 - .../templates/MTRCommandPayloadsObjc-src.zapt | 328 -- .../templates/MTRCommandPayloadsObjc.zapt | 145 - .../MTRCommandPayloads_Internal.zapt | 39 - .../templates/MTRCommandTimedCheck-src.zapt | 51 - .../templates/MTRDeviceTypeMetadata-src.zapt | 47 - .../MTREventTLVValueDecoder-src.zapt | 81 - .../templates/MTRStructsObjc-src.zapt | 182 - .../templates/MTRStructsObjc.zapt | 100 - .../templates/config-data.yaml | 8 +- .../templates/templates.json | 10 + .../zap-generated/MCAttributeObjects.h | 186 +- .../zap-generated/MCAttributeObjects.mm | 3114 ++++++++++++++++- .../zap-generated/MCClusterObjects.h | 614 ++++ .../zap-generated/MCClusterObjects.mm | 717 ++++ .../zap-generated/MCStructsObjc.h | 58 + .../zap-generated/MCStructsObjc.mm | 291 ++ scripts/tools/zap_regen_all.py | 1 + 38 files changed, 4905 insertions(+), 2739 deletions(-) delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.mm delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeSpecifiedCheck-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters_Internal.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusterConstants.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters_Internal.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloads_Internal.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandTimedCheck-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRDeviceTypeMetadata-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTREventTLVValueDecoder-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc-src.zapt delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc.zapt create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.h create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.mm diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj index d529f1346139fd..f55ca2b5242b20 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj @@ -7,10 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 39589F162B91556B00BE040C /* MCStructsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 39589F152B91556B00BE040C /* MCStructsObjc.h */; }; + 39589F182B91557700BE040C /* MCStructsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39589F172B91557700BE040C /* MCStructsObjc.mm */; }; 39BF57C52B8CFF790081653C /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */; }; 39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */; }; 39BF57C92B8D66540081653C /* NSStringSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57C82B8D66540081653C /* NSStringSpanConversion.h */; }; 39BF57CB2B8E54F80081653C /* NSDataSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57CA2B8E54F80081653C /* NSDataSpanConversion.h */; }; + 39BF57CD2B8FC0EF0081653C /* MCClusterObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39BF57CC2B8FC0EF0081653C /* MCClusterObjects.h */; }; + 39BF57CF2B8FC1030081653C /* MCClusterObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39BF57CE2B8FC1030081653C /* MCClusterObjects.mm */; }; 3C0474062B3F7E5F0012AE95 /* MCEndpointFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */; }; 3C04740C2B4604CF0012AE95 /* MCCryptoUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */; }; 3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */; }; @@ -38,8 +42,6 @@ 3C4F52282B51DB3000BB8A10 /* MCCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C4F52272B51DB3000BB8A10 /* MCCommand.h */; }; 3C4F522A2B51DFAE00BB8A10 /* MCCommand_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C4F52292B51DFAE00BB8A10 /* MCCommand_Internal.h */; }; 3C4F522C2B51E02800BB8A10 /* MCCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C4F522B2B51E02800BB8A10 /* MCCommand.mm */; }; - 3C4F52342B57338B00BB8A10 /* MCClusterObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C4F52332B57338B00BB8A10 /* MCClusterObjects.h */; }; - 3C4F52362B5733A200BB8A10 /* MCClusterObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C4F52352B5733A200BB8A10 /* MCClusterObjects.mm */; }; 3C621CA12B5F6CF8005CDBA3 /* MCCommandObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C621CA02B5F6CF8005CDBA3 /* MCCommandObjects.h */; }; 3C621CA32B5F6D08005CDBA3 /* MCCommandObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C621CA22B5F6D08005CDBA3 /* MCCommandObjects.mm */; }; 3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C621CA42B605A6A005CDBA3 /* MCAttribute.h */; }; @@ -82,10 +84,14 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 39589F152B91556B00BE040C /* MCStructsObjc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCStructsObjc.h; sourceTree = ""; }; + 39589F172B91557700BE040C /* MCStructsObjc.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCStructsObjc.mm; sourceTree = ""; }; 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = ""; }; 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = ""; }; 39BF57C82B8D66540081653C /* NSStringSpanConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSStringSpanConversion.h; sourceTree = ""; }; 39BF57CA2B8E54F80081653C /* NSDataSpanConversion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSDataSpanConversion.h; sourceTree = ""; }; + 39BF57CC2B8FC0EF0081653C /* MCClusterObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCClusterObjects.h; sourceTree = ""; }; + 39BF57CE2B8FC1030081653C /* MCClusterObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCClusterObjects.mm; sourceTree = ""; }; 3C0474052B3F7E5F0012AE95 /* MCEndpointFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCEndpointFilter.h; sourceTree = ""; }; 3C04740B2B4604CF0012AE95 /* MCCryptoUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCryptoUtils.h; sourceTree = ""; }; 3C04740D2B4605B40012AE95 /* MCCryptoUtils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCryptoUtils.mm; sourceTree = ""; }; @@ -118,8 +124,6 @@ 3C4F52272B51DB3000BB8A10 /* MCCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommand.h; sourceTree = ""; }; 3C4F52292B51DFAE00BB8A10 /* MCCommand_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommand_Internal.h; sourceTree = ""; }; 3C4F522B2B51E02800BB8A10 /* MCCommand.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommand.mm; sourceTree = ""; }; - 3C4F52332B57338B00BB8A10 /* MCClusterObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCClusterObjects.h; sourceTree = ""; }; - 3C4F52352B5733A200BB8A10 /* MCClusterObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCClusterObjects.mm; sourceTree = ""; }; 3C621CA02B5F6CF8005CDBA3 /* MCCommandObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandObjects.h; sourceTree = ""; }; 3C621CA22B5F6D08005CDBA3 /* MCCommandObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandObjects.mm; sourceTree = ""; }; 3C621CA42B605A6A005CDBA3 /* MCAttribute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttribute.h; sourceTree = ""; }; @@ -186,6 +190,10 @@ children = ( 39BF57C42B8CFF790081653C /* MCAttributeObjects.h */, 39BF57C62B8CFFB90081653C /* MCAttributeObjects.mm */, + 39BF57CC2B8FC0EF0081653C /* MCClusterObjects.h */, + 39BF57CE2B8FC1030081653C /* MCClusterObjects.mm */, + 39589F152B91556B00BE040C /* MCStructsObjc.h */, + 39589F172B91557700BE040C /* MCStructsObjc.mm */, ); path = "zap-generated"; sourceTree = ""; @@ -257,8 +265,6 @@ 3C621CA42B605A6A005CDBA3 /* MCAttribute.h */, 3C621CA82B605C52005CDBA3 /* MCAttribute_Internal.h */, 3C621CAA2B605C6E005CDBA3 /* MCAttribute.mm */, - 3C4F52332B57338B00BB8A10 /* MCClusterObjects.h */, - 3C4F52352B5733A200BB8A10 /* MCClusterObjects.mm */, 3C621CA02B5F6CF8005CDBA3 /* MCCommandObjects.h */, 3C621CA22B5F6D08005CDBA3 /* MCCommandObjects.mm */, 3C4F521F2B507C4A00BB8A10 /* MCEndpointClusterType.h */, @@ -332,6 +338,7 @@ 3CD6D01A298CDA2100D7569A /* CommissionerDiscoveryDelegateImpl.h in Headers */, 3CF71C0E2A992DA2003A5CE5 /* MCDataSource.h in Headers */, 3C4F52142B4F31DC00BB8A10 /* MCDeviceTypeStruct.h in Headers */, + 39BF57CD2B8FC0EF0081653C /* MCClusterObjects.h in Headers */, 3C26AC8C2926FE0C00BA6881 /* DeviceAttestationCredentialsProviderImpl.hpp in Headers */, 3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */, 3CD73F1C2A9E8396009D82D1 /* MCCommissionableDataProvider.h in Headers */, @@ -349,8 +356,8 @@ 3C4F522A2B51DFAE00BB8A10 /* MCCommand_Internal.h in Headers */, 3CD73F202A9EA060009D82D1 /* MCDeviceAttestationCredentials.h in Headers */, 3CCB8740286A593700771BAD /* CastingServerBridge.h in Headers */, - 3C4F52342B57338B00BB8A10 /* MCClusterObjects.h in Headers */, 3CE5ECCE2A673B30007CF331 /* CommissioningCallbackHandlers.h in Headers */, + 39589F162B91556B00BE040C /* MCStructsObjc.h in Headers */, 3CCB8742286A593700771BAD /* ConversionUtils.hpp in Headers */, 3C621CA72B605AA1005CDBA3 /* MCObserver.h in Headers */, 3C9437922B3B478E0096E5F4 /* MCErrorUtils.h in Headers */, @@ -466,7 +473,9 @@ 3C4E53B228E5184C00F293E8 /* TargetNavigatorTypes.mm in Sources */, 3C6920482AA1094000D0F613 /* MCDeviceAttestationCredentialsProvider.mm in Sources */, 3CE5ECD02A673E2C007CF331 /* CommissioningCallbackHandlers.m in Sources */, + 39BF57CF2B8FC1030081653C /* MCClusterObjects.mm in Sources */, 3CD73F192A9E68A7009D82D1 /* MCRotatingDeviceIdUniqueIdProvider.mm in Sources */, + 39589F182B91557700BE040C /* MCStructsObjc.mm in Sources */, 3CF8532728E37F1000F07B9F /* MatterError.mm in Sources */, 3C4F522C2B51E02800BB8A10 /* MCCommand.mm in Sources */, 3C4E53B628E5595A00F293E8 /* ContentLauncherTypes.mm in Sources */, @@ -478,7 +487,6 @@ 3C4F52122B4E18ED00BB8A10 /* MCEndpoint.mm in Sources */, 3C4E53B028E4F28100F293E8 /* MediaPlaybackTypes.mm in Sources */, 3C04740E2B4605B40012AE95 /* MCCryptoUtils.mm in Sources */, - 3C4F52362B5733A200BB8A10 /* MCClusterObjects.mm in Sources */, 3CD73F1E2A9E83C1009D82D1 /* MCCommissionableDataProvider.mm in Sources */, 3CD73F222A9EA078009D82D1 /* MCDeviceAttestationCredentials.mm in Sources */, 39BF57C72B8CFFB90081653C /* MCAttributeObjects.mm in Sources */, diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCluster.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCluster.mm index ecb7a9175925d2..7660de0c610017 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCluster.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCCluster.mm @@ -15,7 +15,7 @@ * limitations under the License. */ -#import "MCClusterObjects.h" +#import "zap-generated/MCClusterObjects.h" #import "MCCluster_Internal.h" #import "MCEndpoint_Internal.h" diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h deleted file mode 100644 index 836566e74ba2e5..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright (c) 2020-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. - */ - -#import "zap-generated/MCAttributeObjects.h" -#import "MCCluster.h" -#import "MCCommandObjects.h" -#import - -#ifndef MCClusterObjects_h -#define MCClusterObjects_h - -@interface MCContentLauncherCluster : MCCluster -/** - * @brief Returns non-nil pointer to MCContentLauncherClusterLaunchURLCommand if supported, nil otherwise - */ -- (MCContentLauncherClusterLaunchURLCommand * _Nullable)launchURLCommand; -@end - -@interface MCApplicationBasicCluster : MCCluster -/** - * @brief Returns non-nil pointer to MCApplicationBasicClusterVendorIDAttribute if supported, nil otherwise - */ -- (MCApplicationBasicClusterVendorIDAttribute * _Nullable)vendorIDAttribute; -@end - -@interface MCMediaPlaybackCluster : MCCluster -/** - * @brief Returns non-nil pointer to MCMediaPlaybackClusterCurrentStateAttribute if supported, nil otherwise - */ -- (MCMediaPlaybackClusterCurrentStateAttribute * _Nullable)currentStateAttribute; -@end - -#endif /* MCClusterObjects_h */ diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.mm deleted file mode 100644 index 397dc628ffb405..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.mm +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * 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. - */ - -#import "MCClusterObjects.h" - -#import "MCAttribute_Internal.h" -#import "MCCluster_Internal.h" -#import "MCCommand_Internal.h" - -#include "core/Attribute.h" -#include "core/Command.h" -#include - -#import - -@implementation MCContentLauncherCluster -- (id)launchURLCommand -{ - void * cppCommand = self.cppCluster->GetCommand(chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Id); - return cppCommand != nil ? [[MCContentLauncherClusterLaunchURLCommand alloc] initWithCppCommand:cppCommand] : nil; -} -@end - -@implementation MCApplicationBasicCluster -- (id)vendorIDAttribute -{ - void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::VendorID::Id); - return cppAttribute != nil ? [[MCApplicationBasicClusterVendorIDAttribute alloc] initWithCppAttribute:cppAttribute] : nil; -} -@end - -@implementation MCMediaPlaybackCluster -- (id)currentStateAttribute -{ - void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::CurrentState::Id); - return cppAttribute != nil ? [[MCMediaPlaybackClusterCurrentStateAttribute alloc] initWithCppAttribute:cppAttribute] : nil; -} -@end diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm index 006488aed03eb5..f5e5aac89abb69 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCEndpoint.mm @@ -21,7 +21,7 @@ #import "MCCluster_Internal.h" #import "MCDeviceTypeStruct.h" -#import "MCClusterObjects.h" +#import "zap-generated/MCClusterObjects.h" #import "clusters/Clusters.h" #import "core/Endpoint.h" diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MatterTvCastingBridge.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MatterTvCastingBridge.h index 67e3381539c82c..16ce4a0410be68 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MatterTvCastingBridge.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MatterTvCastingBridge.h @@ -32,7 +32,7 @@ FOUNDATION_EXPORT const unsigned char MatterTvCastingBridgeVersionString[]; #import "MCCastingPlayer.h" #import "MCCastingPlayerDiscovery.h" #import "MCCluster.h" -#import "MCClusterObjects.h" +#import "zap-generated/MCClusterObjects.h" #import "MCCommand.h" #import "MCCommandObjects.h" #import "MCCommissionableData.h" diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects-src.zapt index 205bf481c0fc6b..90b0f400523ae9 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects-src.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects-src.zapt @@ -13,10 +13,6 @@ #import - - - - {{#zcl_clusters}} {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} {{#if (isInConfigList name "MatterCastingClusters")}} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt index 85b5c0fb9a0a1e..10cef411bf341a 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt @@ -1,46 +1,13 @@ {{> header excludeZapComment=false}} +#import "MCStructsObjc.h" + #import "../MCAttribute.h" #import #ifndef MCAttributeObjects_h #define MCAttributeObjects_h -@interface MCMediaPlaybackClusterPlaybackPositionStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; -@property (nonatomic, copy) NSNumber * _Nullable position; -@end - -@interface MCMediaPlaybackClusterTrackAttributesStruct : NSObject -@property (nonatomic, copy) NSString * _Nonnull languageCode; -@property (nonatomic, copy) NSString * _Nullable displayName; -@end - -@interface MCMediaPlaybackClusterTrackStruct : NSObject -@property (nonatomic, copy) NSString * _Nonnull id; -@property (nonatomic, copy) MCMediaPlaybackClusterTrackAttributesStruct * _Nullable trackAttributes; -@end - -@interface MCApplicationBasicClusterApplicationStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; -@property (nonatomic, copy) NSString * _Nonnull applicationID; -@end - -@interface MCTargetNavigatorClusterTargetInfoStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull identifier; -@property (nonatomic, copy) NSString * _Nonnull name; -@end - -@interface MCApplicationLauncherClusterApplicationStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; -@property (nonatomic, copy) NSString * _Nonnull applicationID; -@end - -@interface MCApplicationLauncherClusterApplicationEPStruct : NSObject -@property (nonatomic, copy) MCApplicationLauncherClusterApplicationStruct * _Nonnull application; -@property (nonatomic, copy) NSNumber * _Nullable endpoint; -@end - {{#zcl_clusters}} {{#if (isSupported (asUpperCamelCase name))}} {{#if (isInConfigList name "MatterCastingClusters")}} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt deleted file mode 100644 index cac0769e095c0d..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt +++ /dev/null @@ -1,106 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRAttributeTLVValueDecoder_Internal.h" - -#import "MTRStructsObjc.h" -#import "NSStringSpanConversion.h" -#import "NSDataSpanConversion.h" - -#include -#include -#include -#include -#include -#include -#include - -using namespace chip; -using namespace chip::app; - -static id _Nullable DecodeGlobalAttributeValue(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) -{ - using namespace Clusters::Globals; - switch (aAttributeId) { - {{#zcl_attributes_server removeKeys='isOptional'}} - {{#unless clusterRef}} - {{#if (isSupported "" globalAttribute=(asUpperCamelCase name preserveAcronyms=true))}} - case Attributes::{{asUpperCamelCase name}}::Id: { - using TypeInfo = Attributes::{{asUpperCamelCase name}}::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nil; - } - {{asObjectiveCType type ""}} value; - {{>decode_value target="value" source="cppValue" cluster="" errorCode="*aError = err; return nil;" depth=0}} - return value; - } - {{/if}} - {{/unless}} - {{/zcl_attributes_server}} - default: { - break; - } - } - - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - return nil; -} - -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -static id _Nullable DecodeAttributeValueFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) -{ - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aAttributeId) { - {{#zcl_attributes_server removeKeys='isOptional'}} - {{#if clusterRef}} - {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} - case Attributes::{{asUpperCamelCase name}}::Id: { - using TypeInfo = Attributes::{{asUpperCamelCase name}}::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nil; - } - {{asObjectiveCType type parent.name}} value; - {{>decode_value target="value" source="cppValue" cluster=parent.name errorCode="*aError = err; return nil;" depth=0}} - return value; - } - {{/if}} - {{/if}} - {{/zcl_attributes_server}} - default: { - break; - } - } - - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - return nil; -} -{{/if}} -{{/zcl_clusters}} - -id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) -{ - if (IsGlobalAttribute(aPath.mAttributeId)) { - return DecodeGlobalAttributeValue(aPath.mAttributeId, aReader, aError); - } - - switch (aPath.mClusterId) { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - return DecodeAttributeValueFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(aPath.mAttributeId, aReader, aError); - } - {{/if}} - {{/zcl_clusters}} - default: { - break; - } - } - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - return nil; -} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects-src.zapt index d47ec86aec602f..53223b2f8e4b43 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects-src.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects-src.zapt @@ -1 +1,53 @@ -{{> header excludeZapComment=false}} \ No newline at end of file +{{> header excludeZapComment=false}} + +#import "MCClusterObjects.h" + +#import "../MCAttribute_Internal.h" +#import "../MCCluster_Internal.h" +#import "../MCCommand_Internal.h" + +#include "core/Attribute.h" +#include "core/Command.h" +#include + +#import + +{{#zcl_clusters}} +{{#if (isSupported (asUpperCamelCase name))}} +{{#if (isInConfigList name "MatterCastingClusters")}} + +// {{asUpperCamelCase name}} cluster: + +@implementation MC{{asUpperCamelCase name}}Cluster + +// {{asUpperCamelCase name}} cluster commands: + +{{#zcl_commands}} +{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} +{{#if (isInConfigList name "MatterCastingImplementedCommands")}} + +- (id){{asMethodName name}}Command +{ + void * cppCommand = self.cppCluster->GetCommand(chip::app::Clusters::{{asUpperCamelCase ../name}}::Commands::{{asUpperCamelCase name}}::Id); + return cppCommand != nil ? [[MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command alloc] initWithCppCommand:cppCommand] : nil; +} + +{{/if}} +{{/if}} +{{/zcl_commands}} + +// {{asUpperCamelCase name}} cluster attributes: +{{#zcl_attributes_server}} +{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} + +- (id){{asMethodName name}}Attribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::{{asUpperCamelCase ../name}}::Attributes::{{asUpperCamelCase name}}::Id); + return cppAttribute != nil ? [[MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +{{/if}} +{{/zcl_attributes_server}} +@end +{{/if}} +{{/if}} +{{/zcl_clusters}} \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt index d47ec86aec602f..07d5ee8e8b128c 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt @@ -1 +1,48 @@ -{{> header excludeZapComment=false}} \ No newline at end of file +{{> header excludeZapComment=false}} + +#import "MCAttributeObjects.h" +#import "../MCCluster.h" +#import "../MCCommandObjects.h" +#import + +#ifndef MCClusterObjects_h +#define MCClusterObjects_h + +{{#zcl_clusters}} +{{#if (isSupported (asUpperCamelCase name))}} +{{#if (isInConfigList name "MatterCastingClusters")}} + +// {{asUpperCamelCase name}} cluster: + +@interface MC{{asUpperCamelCase name}}Cluster : MCCluster + +// {{asUpperCamelCase name}} cluster commands: + +{{#zcl_commands}} +{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} +{{#if (isInConfigList name "MatterCastingImplementedCommands")}} + +/** + * @brief Returns non-nil pointer to MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command if supported, nil otherwise. + */ +- (MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command * _Nullable){{asMethodName name}}Command; +{{/if}} +{{/if}} +{{/zcl_commands}} + +// {{asUpperCamelCase name}} cluster attributes: +{{#zcl_attributes_server}} +{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} + +/** + * @brief Returns non-nil pointer to MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute if supported, nil otherwise. + */ +- (MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute * _Nullable){{asMethodName name}}Attribute; +{{/if}} +{{/zcl_attributes_server}} +@end +{{/if}} +{{/if}} +{{/zcl_clusters}} + +#endif /* MCClusterObjects_h */ \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects-src.zapt index d47ec86aec602f..6ea810b687b028 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects-src.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects-src.zapt @@ -1 +1,3 @@ -{{> header excludeZapComment=false}} \ No newline at end of file +{{> header excludeZapComment=false}} + +// TODO: To be implemented in the following PR. \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt index d47ec86aec602f..6ea810b687b028 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt @@ -1 +1,3 @@ -{{> header excludeZapComment=false}} \ No newline at end of file +{{> header excludeZapComment=false}} + +// TODO: To be implemented in the following PR. \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeSpecifiedCheck-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeSpecifiedCheck-src.zapt deleted file mode 100644 index 51c02bd7f47e34..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeSpecifiedCheck-src.zapt +++ /dev/null @@ -1,47 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRAttributeSpecifiedCheck.h" - -#include -#include - -using namespace chip; -using namespace chip::app; - -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -static BOOL AttributeIsSpecifiedIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(AttributeId aAttributeId) -{ - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aAttributeId) { - {{#zcl_attributes_server}} - {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} - case Attributes::{{asUpperCamelCase name}}::Id: { - return YES; - } - {{/if}} - {{/zcl_attributes_server}} - default: { - return NO; - } - } -} -{{/if}} -{{/zcl_clusters}} - -BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) -{ - switch (aClusterId) - { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - return AttributeIsSpecifiedIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(aAttributeId); - } - {{/if}} - {{/zcl_clusters}} - default: { - return NO; - } - } -} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters-src.zapt deleted file mode 100644 index de92791826c666..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters-src.zapt +++ /dev/null @@ -1,341 +0,0 @@ -{{> header excludeZapComment=true}} - -#import - -#import "MTRBaseClusters_Internal.h" -#import "MTRBaseDevice_Internal.h" -#import "MTRCallbackBridgeBase.h" -#import "MTRCluster_Internal.h" -#import "MTRClusterStateCacheContainer_Internal.h" -#import "MTRCommandPayloadsObjc.h" -#import "MTRDevice_Internal.h" -#import "MTRStructsObjc.h" -#import "NSStringSpanConversion.h" -#import "NSDataSpanConversion.h" -#import "MTRDefines_Internal.h" - -#include -#include -#include -#include -#include - -#include - -using chip::Callback::Callback; -using chip::Callback::Cancelable; -using namespace chip::app::Clusters; -using chip::Messaging::ExchangeManager; -using chip::SessionHandle; -using chip::Optional; -using chip::System::Clock::Timeout; -using chip::System::Clock::Seconds16; - -typedef void (*DefaultSuccessCallbackType)(void *); - -class MTRDefaultSuccessCallbackBridge : public MTRCallbackBridge -{ -public: - MTRDefaultSuccessCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, MTRActionBlock action) : - MTRCallbackBridge(queue, handler, action, OnSuccessFn){}; - - static void OnSuccessFn(void * context) { - DispatchSuccess(context, nil); - } -}; - -// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -@implementation MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandImpl"}} -{{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }} -{{#if (or (isSupported cluster command=command) - (isSupported (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} -{{#*inline "paramsType"}} -{{#unless (isSupported cluster command=command)}} -MTR{{compatClusterNameRemapping parent.name}}Cluster{{compatCommandNameRemapping parent.name name}}Params -{{else}} -MTR{{cluster}}Cluster{{command}}Params -{{/unless}} -{{/inline}} -{{#unless commandHasRequiredField}} -- (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion -{ - [self {{asLowerCamelCase name}}WithParams:nil completion:completion]; -} -{{/unless}} -- (void){{asLowerCamelCase name}}WithParams: ({{> paramsType}} * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion -{ - if (params == nil) { - params = [[{{> paramsType}} alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - {{#if hasSpecificResponse}} - completion(response, error); - {{else}} - completion(error); - {{/if}} - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - {{#if mustUseTimedInvoke}} - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - {{/if}} - - using RequestType = {{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout -{{#if hasSpecificResponse}} - responseClass:MTR{{cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params.class -{{else}} - responseClass:nil -{{/if}} - queue:self.callbackQueue - completion:responseHandler]; -} -{{/if}} -{{/inline}} -{{> commandImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server removeKeys='isOptional'}} -{{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }} -{{#if (or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) - (and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name))))}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} -- (void)read{{>attribute}}With -{{~#if_is_fabric_scoped_struct type~}} - Params:(MTRReadParams * _Nullable)params completion: -{{~else~}} - Completion: -{{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = {{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - {{#if_is_fabric_scoped_struct type}} - params:params - {{else}} - params:nil - {{/if_is_fabric_scoped_struct}} - queue:self.callbackQueue - completion:completion]; -} - -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion -{ - [self write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:nil completion:completion]; -} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; - - auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, - {{! For now, don't change the bridge API; instead just use an adapter - to invoke our completion handler. This is not great from a - type-safety perspective, of course. }} - ^(id _Nullable ignored, NSError * _Nullable error) { - completion(error); - }, - ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { - chip::Optional timedWriteTimeout; - if (params != nil) { - if (params.timedWriteTimeout != nil){ - timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); - } - } - {{#if mustUseTimedWrite}} - if (!timedWriteTimeout.HasValue()) { - timedWriteTimeout.SetValue(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - {{/if}} - - ListFreer listFreer; - using TypeInfo = {{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo; - TypeInfo::Type cppValue; - {{>encode_value target="cppValue" source="value" cluster=parent.name errorCode="return CHIP_ERROR_INVALID_ARGUMENT;" depth=0}} - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); - }); - std::move(*bridge).DispatchAction(self.device); -} - -{{/if}} -{{#if isReportableAttribute}} -- (void) subscribe{{>attribute}}WithParams:(MTRSubscribeParams * _Nonnull)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished -reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = {{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = {{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -{{/if}} -{{/if}} -{{/zcl_attributes_server}} - -@end -{{/if}} -{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}} -{{#if (isSupported (compatClusterNameRemapping name))}} - -@implementation MTRBaseCluster{{compatClusterNameRemapping name}} -@end -{{/if}} -{{/unless}} - -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) - (isSupported (compatClusterNameRemapping name)))}} -@implementation MTRBaseCluster{{compatClusterNameRemapping name}} (Deprecated) - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandImpl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) - (isSupported cluster command=command))}} -- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler -{ - [self {{asLowerCamelCase name}}WithParams:params completion: - {{#if hasSpecificResponse}} - ^(MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - } - {{else}} - completionHandler - {{/if}} - ]; -} -{{#unless commandHasRequiredField}} -{{#unless (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#unless (and (isStrEqual cluster "GroupKeyManagement") - (isStrEqual command "KeySetReadAllIndices"))}} -- (void){{asLowerCamelCase command}}WithCompletionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler -{ - [self {{asLowerCamelCase command}}WithParams:nil completionHandler:completionHandler]; -} -{{/unless}} -{{/unless}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandImpl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server removeKeys='isOptional'}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))}} -{{#*inline "attribute"}}Attribute{{compatAttributeNameRemapping parent.name name}}{{/inline}} -- (void)read{{>attribute}}With -{{~#if_is_fabric_scoped_struct type~}} - Params:(MTRReadParams * _Nullable)params completionHandler: -{{~else~}} - CompletionHandler: -{{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttribute{{asUpperCamelCase name preserveAcronyms=true}}With{{#if_is_fabric_scoped_struct type}}Params:params completion:{{else}}Completion:{{/if_is_fabric_scoped_struct}} - ^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast<{{asObjectiveCClass type parent.name compatRemapClusterName=true}} *>(value), error); - }]; -} -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:value params:nil completion:completionHandler]; -} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:value params:params completion:completionHandler]; -} -{{/if}} -{{#if isReportableAttribute}} -- (void) subscribe{{>attribute}}WithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast<{{asObjectiveCClass type parent.name compatRemapClusterName=true}} *>(value), error) ; - }]; -} -+ (void) read{{>attribute}}WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast<{{asObjectiveCClass type parent.name compatRemapClusterName=true}} *>(value), error); - }]; -} -{{/if}} -{{/if}} -{{/zcl_attributes_server}} - -- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device - endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue -{ - return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; -} - -@end -{{/if}} - -{{/zcl_clusters}} - -// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters.zapt deleted file mode 100644 index 7488fda7019126..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters.zapt +++ /dev/null @@ -1,276 +0,0 @@ -{{> header excludeZapComment=true}} - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} - - -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -/** - * Cluster {{name}} - * - * {{description}} - */ -{{availability (asUpperCamelCase name preserveAcronyms=true)}} -@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericBaseCluster - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandDecl"}} -{{#if (isSupported cluster command=command)}} -/** - * Command {{name}} - * - * {{description}} - */ -- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="First major API revamp"}}; -{{#unless commandHasRequiredField}} -- (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#if (and (isStrEqual command "KeySetReadAllIndices") - (isStrEqual cluster "GroupKeyManagement"))}} -{{availability cluster command=command minimalRelease="Fall 2023"}}; -{{else}} -{{#if (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{availability cluster command=command minimalRelease="Early 2024"}}; -{{else}} -{{availability cluster command=command minimalRelease="First major API revamp"}}; -{{/if}} -{{/if}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server removeKeys='isOptional'}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} -- (void)read{{>attribute}}With -{{~#if_is_fabric_scoped_struct type~}} - Params:(MTRReadParams * _Nullable)params completion: -{{~else~}} - Completion: -{{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -{{/if}} -{{#if isReportableAttribute}} -- (void) subscribe{{>attribute}}WithParams:(MTRSubscribeParams *)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; -{{/if}} -{{/if}} -{{/zcl_attributes_server}} - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; - -@end - -@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} (Availability) - -/** - * For all instance methods (reads, writes, commands) that take a completion, - * the completion will be called on the provided queue. - */ -- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device - endpointID:(NSNumber *)endpointID - queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; - -@end -{{/if}} - -{{/zcl_clusters}} - -{{#zcl_clusters}} -{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}} -{{#if (isSupported (compatClusterNameRemapping name))}} -{{availability (compatClusterNameRemapping name) deprecationMessage=(concat "Please use MTRBaseCluster" (asUpperCamelCase name preserveAcronyms=true))}} -@interface MTRBaseCluster{{compatClusterNameRemapping name}} : MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} -@end - -{{/if}} -{{/unless}} -{{/zcl_clusters}} - -{{#zcl_clusters}} -{{#zcl_enums}} -{{#*inline "enumDef"}} -typedef NS_ENUM({{asUnderlyingZclType name}}, {{objCEnumName clusterName enumName}}) { - {{#zcl_enum_items}} - {{#if (isSupported ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{objCEnumName ../clusterName ../enumName}}{{asUpperCamelCase label preserveAcronyms=true}} {{availability ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, - {{/if}} - {{#*inline "oldNameItemDecl"}} - {{#if oldItemName}} - {{#if (isSupported ../clusterName enum=../enumName enumValue=oldItemName)}} - {{objCEnumName ../clusterName ../enumName}}{{objCEnumItemLabel oldItemName}} {{availability ../clusterName enum=../enumName enumValue=oldItemName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, - {{/if}} - {{/if}} - {{/inline}} - {{> oldNameItemDecl oldItemName=(oldName ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{/zcl_enum_items}} - {{!We had extra "Not Supported" values for DoorLockUserStatus/DoorLockUserType that we have to wedge in here manually for now.}} - {{#if (and (isStrEqual clusterName "DoorLock") - (or (isStrEqual enumName "UserTypeEnum") (isStrEqual enumName "UserStatusEnum")) - (isSupported clusterName enum=enumName enumValue="NotSupported"))}} - {{objCEnumName clusterName enumName}}{{objCEnumItemLabel "NotSupported"}} {{availability clusterName enum=enumName enumValue="NotSupported" deprecationMessage="This value is not part of the specification and will be removed"}} = 0xFF, - {{/if}} -} -{{/inline}} -{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true))}} -{{> enumDef name=name clusterName=(asUpperCamelCase ../name preserveAcronyms=true) enumName=(asUpperCamelCase label preserveAcronyms=true)}} {{availability (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage="This enum is unused and will be removed"}}; -{{/if}} -{{! Takes the name of the enum to use as enumName. }} -{{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping ../name) enum=enumName)}} - -{{> enumDef name=name clusterName=(compatClusterNameRemapping ../name) enumName=enumName}} {{availability (compatClusterNameRemapping ../name) enum=enumName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../name preserveAcronyms=true) label))}}; -{{/if}} -{{/inline}} -{{! Takes the old name of the enum, if any, as oldEnumName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldEnumName - (hasOldName (asUpperCamelCase ../name preserveAcronyms=true)))}} -{{#if oldEnumName}} -{{> oldNameDecl enumName=oldEnumName}} -{{else}} -{{> oldNameDecl enumName=(asUpperCamelCase label preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldEnumName=(oldName (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true))}} - -{{/zcl_enums}} -{{#zcl_bitmaps}} -{{#*inline "bitmapDef"}} -typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName bitmapName}}) { - {{#zcl_bitmap_items}} - {{#if (isSupported ../clusterName bitmap=../bitmapName bitmapValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{objCEnumName ../clusterName ../bitmapName}}{{asUpperCamelCase label preserveAcronyms=true}} {{availability ../clusterName bitmap=../bitmapName bitmapValue=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex mask}}, - {{/if}} - {{#*inline "oldNameItemDecl"}} - {{#if oldItemName}} - {{#if (isSupported ../clusterName bitmap=../bitmapName bitmapValue=oldItemName)}} - {{objCEnumName ../clusterName ../bitmapName}}{{objCEnumItemLabel oldItemName}} {{availability ../clusterName bitmap=../bitmapName bitmapValue=oldItemName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex mask}}, - {{/if}} - {{/if}} - {{/inline}} - {{! The cluster or the bitmap or the value could have been renamed, so this is a bit of a pain... Just cover the cases that matter to us for now }} - {{#if (hasOldName ../clusterName bitmap=../bitmapName bitmapValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{> oldNameItemDecl oldItemName=(oldName ../clusterName bitmap=../bitmapName bitmapValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{else if (hasOldName (asUpperCamelCase ../../name preserveAcronyms=true) bitmap=(asUpperCamelCase ../name preserveAcronyms=true) bitmapValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{> oldNameItemDecl oldItemName=(oldName (asUpperCamelCase ../../name preserveAcronyms=true) bitmap=(asUpperCamelCase ../name preserveAcronyms=true) bitmapValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{/if}} - {{/zcl_bitmap_items}} -} -{{/inline}} -{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) bitmap=(asUpperCamelCase label preserveAcronyms=true))}} -{{> bitmapDef name=name clusterName=(asUpperCamelCase ../name preserveAcronyms=true) bitmapName=(asUpperCamelCase label preserveAcronyms=true)}} {{availability (asUpperCamelCase ../name preserveAcronyms=true) bitmap=(asUpperCamelCase label preserveAcronyms=true)}}; -{{/if}} -{{! Takes the name of the bitmap to use as bitmapName. }} -{{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping ../name) bitmap=bitmapName)}} - -{{> bitmapDef name=name clusterName=(compatClusterNameRemapping ../name) bitmapName=bitmapName}} {{availability (compatClusterNameRemapping ../name) bitmap=bitmapName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../name preserveAcronyms=true) label))}}; -{{/if}} -{{/inline}} -{{! Takes the old name of the bitmap, if any, as oldBitmapName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldBitmapName - (hasOldName (asUpperCamelCase ../name preserveAcronyms=true)))}} -{{#if oldBitmapName}} -{{> oldNameDecl bitmapName=oldBitmapName}} -{{else}} -{{> oldNameDecl bitmapName=(asUpperCamelCase label preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldBitmapName=(oldName (asUpperCamelCase ../name preserveAcronyms=true) bitmap=(asUpperCamelCase label preserveAcronyms=true))}} - - -{{/zcl_bitmaps}} -{{/zcl_clusters}} - -{{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) - (isSupported (compatClusterNameRemapping name)))}} -@interface MTRBaseCluster{{compatClusterNameRemapping name}} (Deprecated) - -- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device - endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage="Please use initWithDevice:endpointID:queue:"}}; - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) - (isSupported cluster command=command))}} -- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler - {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:completion:")}}; -{{#unless commandHasRequiredField}} -{{! No need for these backwards-compat APIs for commands that never shipped them. }} -{{#unless (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#unless (and (isStrEqual cluster "GroupKeyManagement") - (isStrEqual command "KeySetReadAllIndices"))}} -- (void){{asLowerCamelCase command}}WithCompletionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler - {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithCompletion:")}}; -{{/unless}} -{{/unless}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandDecl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server removeKeys='isOptional'}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))}} -{{#*inline "attribute"}}Attribute{{compatAttributeNameRemapping parent.name name}}{{/inline}} -- (void)read{{>attribute}}With -{{~#if_is_fabric_scoped_struct type~}} - Params:(MTRReadParams * _Nullable)params completionHandler: -{{~else~}} - CompletionHandler: -{{~/if_is_fabric_scoped_struct~}} -(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" fabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:completion:") nonFabricScopedDeprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithCompletion:") type=type}}; -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:completion:")}}; -- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue:params:completion:")}}; -{{/if}} -{{#if isReportableAttribute}} -- (void) subscribe{{>attribute}}WithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params -subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use subscribeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams:subscriptionEstablished:")}}; -+ (void) read{{>attribute}}WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{availability (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithAttributeCache:endpoint:queue:completion:")}}; -{{/if}} -{{/if}} -{{/zcl_attributes_server}} - -@end - -{{/if}} -{{/zcl_clusters}} - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters_Internal.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters_Internal.zapt deleted file mode 100644 index c5790da1795a81..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRBaseClusters_Internal.zapt +++ /dev/null @@ -1,9 +0,0 @@ -{{> header excludeZapComment=true}} - -#import - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" - -// Nothing here for now, but leaving this file in place in case we need to add -// something. diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusterConstants.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusterConstants.zapt deleted file mode 100644 index ba2e57a45bc491..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusterConstants.zapt +++ /dev/null @@ -1,221 +0,0 @@ -{{> header excludeZapComment=true}} - -#import -#import - -#pragma mark - Clusters IDs - -typedef NS_ENUM(uint32_t, MTRClusterIDType) { -{{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name) isForIds=true) - (isSupported (compatClusterNameRemapping name) isForIds=true))}} -MTRCluster{{compatClusterNameRemapping label}}ID {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRClusterIDType" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = {{asMEI manufacturerCode code}}, -{{/if}} -{{/zcl_clusters}} -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} -{{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} -MTRClusterIDType{{>cluster}}ID {{availability (asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " cluster will be removed")}} = {{asMEI manufacturerCode code}}, -{{/if}} -{{/zcl_clusters}} -}; - -#pragma mark - Attributes IDs - -typedef NS_ENUM(uint32_t, MTRAttributeIDType) { -// Deprecated global attribute names -{{#zcl_attributes_server}} -{{#unless clusterRef}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" "" globalAttribute=(asUpperCamelCase label) isForIds=true)}} -MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID -{{availability "" api="Deprecated global attribute names" deprecationMessage=(concat "Please use MTRAttributeIDTypeGlobalAttribute" (asUpperCamelCase label) "ID") isForIds=true}} -= {{asMEI manufacturerCode code}}, -{{/if}} -{{/unless}} -{{/zcl_attributes_server}} - -// Global attributes -{{#zcl_attributes_server}} -{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} -{{#unless clusterRef}} -{{#if (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} -MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID {{availability "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}}, -{{/if}} -{{/unless}} -{{/zcl_attributes_server}} - -{{#zcl_clusters}} -{{#*inline "attributeIDs"}} -{{#zcl_attributes_server}} -{{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} -{{#if (isSupported (compatClusterNameRemapping ../clusterName) isForIds=true)}} -// Cluster {{compatClusterNameRemapping ../clusterName}} deprecated attribute names -{{/if}} -{{/if}} -{{/first}} -{{! DeviceTypeList is special: we did not call it by that name - anywhere else in the API at the point when we shipped an id for it - here in the old id format but using the new name alongside the old name. }} -{{#if (isStrEqual (asUpperCamelCase ../clusterName) "Descriptor")}} -{{#if (isStrEqual (asUpperCamelCase label) "DeviceTypeList")}} -MTRClusterDescriptorAttributeDeviceTypeListID -{{availability "Descriptor" attribute="DeviceTypeList" deprecatedRelease="First major API revamp" deprecationMessage="Please use MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID" isForIds=true}} -= {{asMEI manufacturerCode code}}, -{{/if}} -{{/if}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true) - (isSupported (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true))}} -MTRCluster{{compatClusterNameRemapping ../clusterName}}Attribute{{compatAttributeNameRemapping ../clusterName label}}ID -{{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRAttributeIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID") isForIds=true}} = -{{#if clusterRef}} -{{asMEI manufacturerCode code}}, -{{else}} -MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID, -{{/if}} -{{/if}} -{{#last}} - -{{/last}} -{{/zcl_attributes_server}} -{{#zcl_attributes_server}} -{{~#*inline "cluster"}}{{asUpperCamelCase ../clusterName preserveAcronyms=true}}{{/inline~}} -{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} -{{#first}} -{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) isForIds=true)}} -// Cluster {{> cluster}} attributes -{{/if}} -{{/first}} -{{#if (and (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true) - (or clusterRef - (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)))}} -MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " attribute will be removed")}} = -{{#if clusterRef}} -{{asMEI manufacturerCode code}}, -{{else}} -MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID, -{{/if}} -{{/if}} -{{! Anything which has an old name, and the new name was introduced in the "First after major API revamp" release or later - (or just after the "First major API revamp" release, but we don't have a good way to test for that), - we need to generate the new-form id for the old name too, as long as it was not removed. }} -{{#if (and (hasOldName (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true) - (not (wasIntroducedBeforeRelease "First after major API revamp" (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)) - (isSupported (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true))}} -MTRAttributeIDTypeCluster{{compatClusterNameRemapping ../clusterName}}Attribute{{compatAttributeNameRemapping ../clusterName label}}ID {{availability (compatClusterNameRemapping ../clusterName) attribute=(compatAttributeNameRemapping ../clusterName label) isForIds=true minimalRelease="First major API revamp" deprecationMessage=(concat "Please use MTRAttributeIDType" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Attribute" (asUpperCamelCase label preserveAcronyms=true) "ID")}} = MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID, -{{/if}} -{{#last}} - -{{/last}} -{{/zcl_attributes_server}} -{{/inline}} - -{{> attributeIDs clusterName=label}} -{{/zcl_clusters}} -}; - -#pragma mark - Commands IDs - -typedef NS_ENUM(uint32_t, MTRCommandIDType) { -{{#zcl_clusters}} -{{#*inline "commandIDs"}} -{{#zcl_commands}} -{{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} -{{#if (isSupported (compatClusterNameRemapping ../clusterName) isForIds=true)}} -// Cluster {{compatClusterNameRemapping ../clusterName}} deprecated command id names -{{/if}} -{{/if}} -{{/first}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandIdDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command isForIds=true) - (isSupported cluster command=command isForIds=true))}} -MTRCluster{{cluster}}Command{{command}}ID -{{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTRCommandIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Command" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} -= {{asMEI manufacturerCode code}}, -{{/if}} -{{/inline}} -{{> commandIdDecl cluster=(compatClusterNameRemapping ../clusterName) - command=(compatCommandNameRemapping ../clusterName name)}} -{{#last}} - -{{/last}} -{{/zcl_commands}} -{{#zcl_commands}} -{{~#*inline "cluster"}}{{asUpperCamelCase ../clusterName preserveAcronyms=true}}{{/inline~}} -{{#first}} -{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) isForIds=true)}} -// Cluster {{>cluster}} commands -{{/if}} -{{/first}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandIdDecl"}} -{{#if (isSupported cluster command=command isForIds=true)}} -MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster command=command minimalRelease="First major API revamp" isForIds=true deprecationMessage=(concat "The " command " command will be removed")}} = {{asMEI manufacturerCode code}}, -{{/if}} -{{/inline}} -{{> commandIdDecl cluster=(asUpperCamelCase ../clusterName preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{! Anything which has an old name, and the new name was introduced in the "First after major API revamp" release or later - (or just after the "First major API revamp" release, but we don't have a good way to test for that), - we need to generate the new-form id for the old name too, as long as it was not removed. }} -{{#if (and (hasOldName (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true) - (not (wasIntroducedBeforeRelease "First after major API revamp" (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)) - (isSupported (compatClusterNameRemapping ../clusterName) command=(compatCommandNameRemapping ../clusterName name) isForIds=true))}} -{{> commandIdDecl cluster=(compatClusterNameRemapping ../clusterName) - command=(compatCommandNameRemapping ../clusterName name)}} -{{/if}} -{{#last}} - -{{/last}} -{{/zcl_commands}} -{{/inline}} - -{{> commandIDs clusterName=label}} -{{/zcl_clusters}} -}; - -#pragma mark - Events IDs - -typedef NS_ENUM(uint32_t, MTREventIDType) { -{{#zcl_clusters}} -{{#*inline "eventIDs"}} -{{#zcl_events}} -{{#first}} -{{#if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) isForIds=true)}} -{{#if (isSupported (compatClusterNameRemapping ../clusterName))}} -// Cluster {{compatClusterNameRemapping ../clusterName}} deprecated event names -{{/if}} -{{/if}} -{{/first}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) isForIds=true) - (isSupported (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) isForIds=true))}} -MTRCluster{{compatClusterNameRemapping ../clusterName}}Event{{asUpperCamelCase name}}ID -{{availability (compatClusterNameRemapping ../clusterName) event=(asUpperCamelCase name) deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use MTREventIDTypeCluster" (asUpperCamelCase ../clusterName preserveAcronyms=true) "Event" (asUpperCamelCase name preserveAcronyms=true) "ID") isForIds=true}} -= {{asMEI manufacturerCode code}}, -{{/if}} -{{#last}} - -{{/last}} -{{/zcl_events}} -{{#zcl_events}} -{{~#*inline "cluster"}}{{asUpperCamelCase ../clusterName preserveAcronyms=true}}{{/inline~}} -{{~#*inline "event"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline~}} -{{#first}} -{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true))}} -// Cluster {{>cluster}} events -{{/if}} -{{/first}} -{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)}} -MTREventIDTypeCluster{{>cluster}}Event{{>event}}ID {{availability (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp" isForIds=true}} = {{asMEI manufacturerCode code}}, -{{/if}} -{{#last}} - -{{/last}} -{{/zcl_events}} -{{/inline}} - -{{> eventIDs clusterName=label}} -{{/zcl_clusters}} -}; diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters-src.zapt deleted file mode 100644 index c42b95e71ef9b7..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters-src.zapt +++ /dev/null @@ -1,222 +0,0 @@ -{{> header excludeZapComment=true}} - -#import - -#import "MTRClusterConstants.h" -#import "MTRDevice_Internal.h" -#import "MTRCluster_Internal.h" -#import "MTRClusters_Internal.h" -#import "MTRStructsObjc.h" -#import "MTRCommandPayloadsObjc.h" -#import "MTRLogging_Internal.h" -#import "MTRDefines_Internal.h" - -#include -#include - -#include - -using chip::Callback::Callback; -using chip::Callback::Cancelable; -using namespace chip::app::Clusters; -using chip::Messaging::ExchangeManager; -using chip::SessionHandle; -using chip::Optional; -using chip::System::Clock::Timeout; -using chip::System::Clock::Seconds16; - -// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -@implementation MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} - -{{#zcl_commands}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandImpl"}} -{{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }} -{{#if (or (isSupported cluster command=command) - (isSupported (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} -{{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}{{else}}CommandSuccess{{/if}}{{/inline}} -{{#*inline "paramsType"}} -{{#unless (isSupported cluster command=command)}} -MTR{{compatClusterNameRemapping parent.name}}Cluster{{compatCommandNameRemapping parent.name name}}Params -{{else}} -MTR{{cluster}}Cluster{{command}}Params -{{/unless}} -{{/inline}} -{{#unless commandHasRequiredField}} -- (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion -{ - [self {{asLowerCamelCase name}}WithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; -} -{{/unless}} -- (void){{asLowerCamelCase name}}WithParams: ({{> paramsType}} * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion -{ - if (params == nil) { - params = [[{{> paramsType}} alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - {{#if hasSpecificResponse}} - completion(response, error); - {{else}} - completion(error); - {{/if}} - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - {{#if mustUseTimedInvoke}} - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - {{/if}} - - using RequestType = {{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout -{{#if hasSpecificResponse}} - responseClass:MTR{{cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params.class -{{else}} - responseClass:nil -{{/if}} - queue:self.callbackQueue - completion:responseHandler]; -} -{{/if}} -{{/inline}} -{{#if (is_str_equal source 'client')}} -{{> commandImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server}} -{{! This is used as the implementation for both the new-name and old-name bits, so check for both here. }} -{{#if (and - (or clusterRef - (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true))) - (or (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) - (and (isSupported (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)) - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) attribute=(compatAttributeNameRemapping parent.name name)))))}} -{{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} -- (NSDictionary * _Nullable)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDType{{>cluster}}ID) attributeID:@(MTRAttributeIDTypeCluster{{>cluster}}{{>attribute}}ID) params:params]; -} - -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -{{#*inline "callbackName"}}DefaultSuccess{{/inline}} -- (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self write{{>attribute}}WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; -} -- (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - NSNumber *timedWriteTimeout = params.timedWriteTimeout; - {{#if mustUseTimedWrite}} - if (!timedWriteTimeout) { - timedWriteTimeout = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - {{/if}} - - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDType{{>cluster}}ID) attributeID:@(MTRAttributeIDTypeCluster{{>cluster}}{{>attribute}}ID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; -} - -{{/if}} - -{{/if}} -{{/zcl_attributes_server}} - -@end -{{/if}} -{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}} -{{#if (isSupported (compatClusterNameRemapping name))}} -@implementation MTRCluster{{compatClusterNameRemapping name}} -@end -{{/if}} -{{/unless}} - -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) - (isSupported (compatClusterNameRemapping name)))}} -@implementation MTRCluster{{compatClusterNameRemapping name}} (Deprecated) - -- (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue -{ - return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; -} - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandImpl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) - (isSupported cluster command=command))}} -- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler -{ - [self {{asLowerCamelCase name}}WithParams:params expectedValues:expectedDataValueDictionaries expectedValueInterval:expectedValueIntervalMs completion: - {{#if hasSpecificResponse}} - ^(MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}Params * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - } - {{else}} - completionHandler - {{/if}} - ]; -} -{{#unless commandHasRequiredField}} -{{#unless (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#unless (and (isStrEqual cluster "GroupKeyManagement") - (isStrEqual command "KeySetReadAllIndices"))}} -- (void){{asLowerCamelCase command}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler -{ - [self {{asLowerCamelCase command}}WithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completionHandler:completionHandler]; -} -{{/unless}} -{{/unless}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandImpl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{/zcl_commands}} -{{~#zcl_attributes_server}} -{{~#*inline "attributeImpls"}} -{{#if (and (not (isStrEqual attribute (asUpperCamelCase name preserveAcronyms=true))) - (isSupported (compatClusterNameRemapping parent.name) attribute=attribute))}} -- (NSDictionary *)readAttribute{{attribute}}WithParams:(MTRReadParams * _Nullable)params -{ - return [self readAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithParams:params]; -} -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)writeAttribute{{attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs -{ - [self writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs]; -} -- (void)writeAttribute{{attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params -{ - [self writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:params]; -} -{{/if}} -{{/if}} -{{/inline~}} -{{> attributeImpls attribute=(compatAttributeNameRemapping parent.name name)}} -{{/zcl_attributes_server}} -@end -{{/if}} - -{{/zcl_clusters}} - -// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters.zapt deleted file mode 100644 index 4ea998e04b6f86..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters.zapt +++ /dev/null @@ -1,159 +0,0 @@ -{{> header excludeZapComment=true}} - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} - - -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -/** - * Cluster {{name}} - * {{description}} - */ -{{availability (asUpperCamelCase name preserveAcronyms=true)}} -@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericCluster - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandDecl"}} -{{#if (isSupported cluster command=command)}} -- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="First major API revamp"}}; -{{#unless commandHasRequiredField}} -- (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#if (and (isStrEqual command "KeySetReadAllIndices") - (isStrEqual cluster "GroupKeyManagement"))}} -{{availability cluster command=command minimalRelease="Fall 2023"}}; -{{else}} -{{#if (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{availability cluster command=command minimalRelease="Early 2024"}}; -{{else}} -{{availability cluster command=command minimalRelease="First major API revamp"}}; -{{/if}} -{{/if}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/zcl_commands}} - -{{#zcl_attributes_server}} -{{#if (and (or clusterRef - (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true))) - (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)))}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} -{{#*inline "availability"}} -{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)}} -{{/inline}} -- (NSDictionary * _Nullable)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params {{> availability}}; -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs {{> availability}}; -- (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params {{> availability}}; -{{/if}} -{{/if}} -{{/zcl_attributes_server}} - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; - -@end - -@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} (Availability) - -/** -{{#zcl_commands}} -{{#first}} - * For all instance methods that take a completion (i.e. command invocations), - * the completion will be called on the provided queue. -{{/first}} -{{else}} - * The queue is currently unused, but may be used in the future for calling completions - * for command invocations if commands are added to this cluster. -{{/zcl_commands}} - */ -- (instancetype _Nullable)initWithDevice:(MTRDevice *)device - endpointID:(NSNumber *)endpointID - queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; - -@end - -{{/if}} -{{/zcl_clusters}} - -{{#zcl_clusters}} -{{#unless (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatClusterNameRemapping name))}} -{{#if (isSupported (compatClusterNameRemapping name))}} -{{availability (compatClusterNameRemapping name) deprecationMessage=(concat "Please use MTRCluster" (asUpperCamelCase name preserveAcronyms=true))}} -@interface MTRCluster{{compatClusterNameRemapping name}} : MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} -@end - -{{/if}} -{{/unless}} -{{/zcl_clusters}} - -{{#zcl_clusters}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping name)) - (isSupported (compatClusterNameRemapping name)))}} -@interface MTRCluster{{compatClusterNameRemapping name}} (Deprecated) - -- (nullable instancetype)initWithDevice:(MTRDevice *)device - endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue {{availability (compatClusterNameRemapping name) deprecatedRelease="First major API revamp" deprecationMessage="Please use initWithDevice:endpoindID:queue:"}}; - -{{#zcl_commands}} -{{#if (is_str_equal source 'client')}} -{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }} -{{#*inline "commandDecl"}} -{{#if (and (wasIntroducedBeforeRelease "First major API revamp" cluster command=command) - (isSupported cluster command=command))}} -- (void){{asLowerCamelCase command}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithParams:expectedValues:expectedValueInterval:completion:")}}; -{{#unless commandHasRequiredField}} -{{! No need for these backwards-compat APIs for commands that never shipped them. }} -{{#unless (isInConfigList - (concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true)) - "LegacyCommandsWithOnlyOptionalArguments")}} -{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }} -{{#unless (and (isStrEqual cluster "GroupKeyManagement") - (isStrEqual command "KeySetReadAllIndices"))}} -- (void){{asLowerCamelCase command}}WithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completionHandler:({{>command_completion_type command=. compatRemapNames=true}})completionHandler {{availability cluster command=command deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use " (asLowerCamelCase name) "WithExpectedValues:expectedValueInterval:completion:")}}; -{{/unless}} -{{/unless}} -{{/unless}} -{{/if}} -{{/inline}} -{{> commandDecl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{/zcl_commands}} -{{~#zcl_attributes_server}} -{{~#*inline "attributeDecls"}} -{{#unless (isStrEqual attribute (asUpperCamelCase name preserveAcronyms=true))}} -- (NSDictionary *)readAttribute{{attribute}}WithParams:(MTRReadParams * _Nullable)params {{availability cluster attribute=attribute deprecatedRelease="First major API revamp" deprecationMessage=(concat "Please use readAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithParams on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; -{{#if (or isWritableAttribute - (isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}} -- (void)writeAttribute{{attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs {{availability cluster attribute=attribute deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; -- (void)writeAttribute{{attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params {{availability cluster attribute=attribute deprecationMessage=(concat "Please use writeAttribute" (asUpperCamelCase name preserveAcronyms=true) "WithValue on MTRCluster" (asUpperCamelCase parent.name preserveAcronyms=true))}}; -{{/if}} -{{/unless}} -{{/inline~}} -{{> attributeDecls cluster=(compatClusterNameRemapping parent.name) - attribute=(compatAttributeNameRemapping parent.name name)}} -{{/zcl_attributes_server}} -@end - -{{/if}} -{{/zcl_clusters}} - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters_Internal.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters_Internal.zapt deleted file mode 100644 index 7f34721b9d1290..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRClusters_Internal.zapt +++ /dev/null @@ -1,10 +0,0 @@ -{{> header excludeZapComment=true}} - -#import - -#import "MTRClusters.h" -#import "MTRDevice.h" -#import "MTRDevice_Internal.h" - -// Nothing here for now, but leaving this file in place in case we need to add -// something. diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc-src.zapt deleted file mode 100644 index c58c75f77d9d38..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc-src.zapt +++ /dev/null @@ -1,328 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRCommandPayloadsObjc.h" -#import "MTRCommandPayloads_Internal.h" -#import "MTRCommandPayloadExtensions_Internal.h" -#import "MTRBaseDevice_Internal.h" -#import "MTRError_Internal.h" -#import "MTRLogging_Internal.h" -#import "NSStringSpanConversion.h" -#import "NSDataSpanConversion.h" -#import "MTRBackwardsCompatShims.h" - -#include -#include -#include -#include -#include - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} -{{#zcl_commands}} -{{#*inline "completeImpl"}} -{{#if (isSupported cluster command=command isForCommandPayload=true)}} -@implementation MTR{{cluster}}Cluster{{command}}Params -- (instancetype)init -{ - if (self = [super init]) { -{{#zcl_command_arguments}} - - {{>init_struct_member label=label type=type cluster=parent.parent.name}} -{{/zcl_command_arguments}} -{{#if (or (isStrEqual source "client") - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} - _timedInvokeTimeoutMs = nil; -{{/if}} -{{#if (isStrEqual source "client")}} - _serverSideProcessingTimeout = nil; -{{/if}} - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTR{{cluster}}Cluster{{command}}Params alloc] init]; - - {{#zcl_command_arguments}} - other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; - {{/zcl_command_arguments}} -{{#if (or (isStrEqual source "client") - (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}} - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; -{{/if}} -{{#if (isStrEqual source "client")}} - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; -{{/if}} - - return other; -} - -- (NSString *)description -{ - NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_command_arguments}}{{asStructPropertyName label}}:%@; {{/zcl_command_arguments}}>", NSStringFromClass([self class]) {{#zcl_command_arguments}},{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}}{{/zcl_command_arguments}}]; - return descriptionString; -} -{{#zcl_command_arguments}} -{{#if (and includeRenamedProperties - (hasOldName ../cluster command=../command commandField=(asStructPropertyName label)))}} - -{{> renamed_struct_field_impl cluster=parent.parent.name type=type newName=label oldName=(oldName ../cluster command=../command commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} - -{{#if (isStrEqual source "server")}} -- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue - error:(NSError * __autoreleasing *)error -{ - if (!(self = [super init])) { - return nil; - } - - using DecodableType = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType; - chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue - clusterID:DecodableType::GetClusterId() - commandID:DecodableType::GetCommandId() - error:error]; - if (buffer.IsNull()) { - return nil; - } - - chip::TLV::TLVReader reader; - reader.Init(buffer->Start(), buffer->DataLength()); - - CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); - if (err == CHIP_NO_ERROR) { - DecodableType decodedStruct; - err = chip::app::DataModel::Decode(reader, decodedStruct); - if (err == CHIP_NO_ERROR) { - err = [self _setFieldsFromDecodableStruct:decodedStruct]; - {{#if (and (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) "OperationalCredentials") - (isStrEqual (asUpperCamelCase name preserveAcronyms=true) "AttestationResponse"))}} - if (err == CHIP_NO_ERROR) { - do { - // AttestationResponse has an extra attestationChallenge field. Once we - // have some sort of more direct decoding from the responseValue, we can - // probably make this less hardcoded. - // - // It might be simpler to look for the right profile tag in the TLV, but let's stick to examining - // the responseValue we were handed. - id data = responseValue[MTRDataKey]; - if (![data isKindOfClass:NSDictionary.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSDictionary * dataDictionary = data; - if (dataDictionary[MTRTypeKey] == nil || - ![dataDictionary[MTRTypeKey] isKindOfClass:NSString.class] || - ![dataDictionary[MTRTypeKey] isEqualToString:MTRStructureValueType]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - id value = dataDictionary[MTRValueKey]; - if (value == nil || ![value isKindOfClass:NSArray.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSArray * valueArray = value; - for (id item in valueArray) { - if (![item isKindOfClass:NSDictionary.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSDictionary * itemDictionary = item; - id contextTag = itemDictionary[MTRContextTagKey]; - if (contextTag == nil || ![contextTag isKindOfClass:NSNumber.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSNumber * contextTagNumber = contextTag; - if (![contextTagNumber isEqualToNumber:@(kAttestationChallengeTagValue)]) { - // Not the right field; keep going. - continue; - } - - id data = itemDictionary[MTRDataKey]; - if (data == nil || ![data isKindOfClass:NSDictionary.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSDictionary * dataDictionary = data; - id dataType = dataDictionary[MTRTypeKey]; - id dataValue = dataDictionary[MTRValueKey]; - if (dataType == nil || dataValue == nil || - ![dataType isKindOfClass:NSString.class] || - ![dataValue isKindOfClass:NSData.class]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - NSString * dataTypeString = dataType; - if (![dataTypeString isEqualToString:MTROctetStringValueType]) { - err = CHIP_ERROR_INVALID_ARGUMENT; - break; - } - - self.attestationChallenge = dataValue; - break; - } - - // Do not add code here without first checking whether err is success. - } while (0); - } - {{/if}} - if (err == CHIP_NO_ERROR) { - return self; - } - } - } - - NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; - MTR_LOG_ERROR("%s", errorStr.UTF8String); - if (error != nil) { - NSDictionary * userInfo = @ { NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; - *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; - } - return nil; -} -{{/if}} - -@end -{{/if}} -{{/inline}} -{{#*inline "oldNameImpl"}} -{{#if (isSupported cluster command=command isForCommandPayload=true)}} - -@implementation MTR{{cluster}}Cluster{{command}}Params -{{#zcl_command_arguments}} -{{#if (isSupported ../cluster command=../command commandField=(asStructPropertyName label))}} -@dynamic {{asStructPropertyName label}}; -{{/if}} -{{/zcl_command_arguments}} - -{{#if (isStrEqual source "client")}} -@dynamic timedInvokeTimeoutMs; -@dynamic serverSideProcessingTimeout; -{{else if (wasIntroducedBeforeRelease "First major API revamp" cluster command=command)}} -@dynamic timedInvokeTimeoutMs; -{{/if}} -@end -{{/if}} -{{/inline}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForCommandPayload=true)}} -{{> completeImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true) - includeRenamedProperties=false}} - -@implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params (InternalMethods) - -{{#if (isStrEqual source "server")}} -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &)decodableStruct -{ - {{#zcl_command_arguments}} - { - {{>decode_value target=(concat "self." (asStructPropertyName label)) source=(concat "decodableStruct." (asLowerCamelCase label)) cluster=parent.parent.name errorCode="return err;" depth=0}} - } - {{/zcl_command_arguments}} - return CHIP_NO_ERROR; -} -{{/if}} - -{{#if (isStrEqual source "client")}} -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type encodableStruct; - ListFreer listFreer; - {{#zcl_command_arguments}} - { - {{>encode_value target=(concat "encodableStruct." (asLowerCamelCase label)) source=(concat "self." (asStructPropertyName label)) cluster=parent.parent.name errorCode="return CHIP_ERROR_INVALID_ARGUMENT;" depth=0}} - } - {{/zcl_command_arguments}} - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -{{/if}} -@end - -{{#if (or (not (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) (compatClusterNameRemapping parent.name))) - (not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}} -{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} -{{#*inline "deprecatedImpl"}} - -@implementation MTR{{cluster}}Cluster{{command}}Params (Deprecated) -{{#zcl_command_arguments}} -{{#if (hasOldName ../cluster command=../command commandField=(asStructPropertyName label))}} - -{{> renamed_struct_field_impl cluster=parent.parent.name type=type newName=label oldName=(oldName ../cluster command=../command commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} -@end -{{/inline}} -{{> deprecatedImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{else}} -{{> completeImpl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name) - includeRenamedProperties=true}} -{{/if}} -{{/zcl_commands}} -{{/zcl_clusters}} - -// MTRBasicClusterMfgSpecificPingParams doesn't need to actually work. -@implementation MTRBasicClusterMfgSpecificPingParams (InternalMethods) -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - return nil; -} -@end - - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc.zapt deleted file mode 100644 index 686b502405a64c..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloadsObjc.zapt +++ /dev/null @@ -1,145 +0,0 @@ -{{> header excludeZapComment=true}} - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} -{{#zcl_commands}} -{{#*inline "completeDecl"}} -{{#if (isSupported cluster command=command isForCommandPayload=true)}} - -{{availability cluster command=command isForCommandPayload=true deprecationMessage=deprecationMessage}} -@interface MTR{{cluster}}Cluster{{command}}Params : {{base}} -{{#zcl_command_arguments}} - -{{#if (isSupported ../cluster command=../command commandField=(asStructPropertyName label))}} -{{> struct_field_decl cluster=parent.parent.name type=type label=label}} {{availability ../cluster command=../command commandField=(asStructPropertyName label) deprecationMessage=(concat "The " (asStructPropertyName label) " field will be removed")}}; -{{/if}} -{{#*inline "oldNameFieldDecl"}} - -{{#if (isSupported ../cluster command=../command commandField=commandField)}} -{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}} {{availability ../cluster command=../command commandField=commandField deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; -{{/if}} -{{/inline}} -{{#if (and includeRenamedProperties - (hasOldName ../cluster command=../command commandField=(asStructPropertyName label)))}} -{{> oldNameFieldDecl commandField=(oldName ../cluster command=../command commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} -{{#if (isStrEqual source "client")}} -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ - @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -{{! This is using the pre-renaming names for the isAvailableBefore test, because the pre-rename things inherit - from the post-rename ones and need to have this selector.}} -{{else if (wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name))}} -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs {{availability "" api="Timed Invoke for server to client commands" deprecationMessage="Timed invoke does not make sense for server to client commands"}}; -{{/if}} -{{#if (and (isStrEqual source "server") - includeInitWithResponseValue)}} - -/** - * Initialize an MTR{{cluster}}Cluster{{command}}Params with a response-value dictionary - * of the sort that MTRDeviceResponseHandler would receive. - * - * Will return nil and hand out an error if the response-value dictionary is not - * a command data response or is not the right command response. - * - * Will return nil and hand out an error if the data response does not match the known - * schema for this command. - */ -- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue - error:(NSError * __autoreleasing *)error {{availability cluster command=command deprecationMessage="This command has been removed" minimalRelease="Fall 2023"}}; -{{/if}} -@end -{{/if}} -{{/inline}} -{{#*inline "oldNameDecl"}} - -{{> completeDecl cluster=cluster - command=command - includeRenamedProperties=true - deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params") - base=(concat "MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params") - includeInitWithResponseValue=false}} - -{{/inline}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} -{{> completeDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true) - includeRenamedProperties=false - deprecationMessage="This command has been removed" - base="NSObject " - includeInitWithResponseValue=true}} -{{#if (or (not (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) (compatClusterNameRemapping parent.name))) - (not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}} -{{> oldNameDecl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name)}} -{{/if}} -{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} -{{#*inline "deprecatedDecl"}} - -@interface MTR{{cluster}}Cluster{{command}}Params (Deprecated) -{{#zcl_command_arguments}} -{{#*inline "oldNameFieldDecl"}} - -{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}} {{availability ../cluster command=../command commandField=commandField deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; -{{/inline}} -{{#if (hasOldName ../cluster command=../command commandField=(asStructPropertyName label))}} -{{> oldNameFieldDecl commandField=(oldName ../cluster command=../command commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} -@end -{{/inline}} -{{> deprecatedDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) - command=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{else}} -{{> completeDecl cluster=(compatClusterNameRemapping parent.name) - command=(compatCommandNameRemapping parent.name name) - includeRenamedProperties=true - deprecationMessage="This command has been removed" - base="NSObject " - includeInitWithResponseValue=true}} -{{/if}} -{{/zcl_commands}} -{{/zcl_clusters}} - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloads_Internal.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloads_Internal.zapt deleted file mode 100644 index 098769fe0a4995..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandPayloads_Internal.zapt +++ /dev/null @@ -1,39 +0,0 @@ -{{> header excludeZapComment=true}} - -#import -#import - -#include - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} -{{#zcl_commands}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForCommandPayload=true)}} - -@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params (InternalMethods) - -{{! We only need to generate conversion from decodable structs for the server-generated commands }} -{{#if (isStrEqual source "server")}} -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &)decodableStruct; -{{/if}} - -{{! We only need to generate encoding to data value for client-generated commands }} -{{#if (isStrEqual source "client")}} -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; -{{/if}} - -@end - - - -{{/if}} -{{/zcl_commands}} -{{/zcl_clusters}} - -// Make sure that MTRBasicClusterMfgSpecificPingParams has _encodeAsDataValue just so it compiles. -@interface MTRBasicClusterMfgSpecificPingParams (InternalMethods) -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; -@end - -NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandTimedCheck-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandTimedCheck-src.zapt deleted file mode 100644 index ea0c2d3a92b73d..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRCommandTimedCheck-src.zapt +++ /dev/null @@ -1,51 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRCommandTimedCheck.h" - -#include -#include - -using namespace chip; -using namespace chip::app; - -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -static BOOL CommandNeedsTimedInvokeIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(AttributeId aAttributeId) -{ - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aAttributeId) { - {{#zcl_commands}} - {{#if (and (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)) - mustUseTimedInvoke)}} - case Commands::{{asUpperCamelCase name}}::Id: { - return YES; - } - {{/if}} - {{/zcl_commands}} - default: { - return NO; - } - } -} -{{/if}} -{{/zcl_clusters}} - -BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonnull aCommandID) -{ - ClusterId clusterID = static_cast(aClusterID.unsignedLongLongValue); - CommandId commandID = static_cast(aCommandID.unsignedLongLongValue); - - switch (clusterID) - { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - return CommandNeedsTimedInvokeIn{{asUpperCamelCase name preserveAcronyms=true}}Cluster(commandID); - } - {{/if}} - {{/zcl_clusters}} - default: { - return NO; - } - } -} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRDeviceTypeMetadata-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRDeviceTypeMetadata-src.zapt deleted file mode 100644 index c3e594930d9eac..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRDeviceTypeMetadata-src.zapt +++ /dev/null @@ -1,47 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRDeviceTypeMetadata.h" - -using namespace chip; - -namespace { -enum class DeviceTypeClass { - Utility, - Simple, - Node, // Might not be a real class, but we have it for Root Node for now. - // If new classes get added, plase audit MTRIsKnownUtilityDeviceType below. -}; - -struct DeviceTypeData { - DeviceTypeId id; - DeviceTypeClass deviceClass; - const char * name; -}; - -constexpr DeviceTypeData knownDeviceTypes[] = { - {{#zcl_device_types}} - {{#if class}} - {{! For now work around the "Dynamic Utility" thing on Aggregator by just - taking the last word. }} - { {{asHex code 8}}, DeviceTypeClass::{{asLastWord class}}, "{{caption}}" }, - {{/if}} - {{/zcl_device_types}} -}; - -{{#zcl_device_types}} -{{#unless class}} -static_assert(ExtractVendorFromMEI({{asHex code 8}}) != 0, "Must have class defined for \"{{caption}}\" if it's a standard device type"); -{{/unless}} -{{/zcl_device_types}} - -} // anonymous namespace - -BOOL MTRIsKnownUtilityDeviceType(DeviceTypeId aDeviceTypeId) -{ - for (auto & deviceType : knownDeviceTypes) { - if (deviceType.id == aDeviceTypeId) { - return deviceType.deviceClass != DeviceTypeClass::Simple; - } - } - return NO; -} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTREventTLVValueDecoder-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTREventTLVValueDecoder-src.zapt deleted file mode 100644 index 470221c850066e..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTREventTLVValueDecoder-src.zapt +++ /dev/null @@ -1,81 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTREventTLVValueDecoder_Internal.h" - -#import "MTRStructsObjc.h" -#import "NSStringSpanConversion.h" -#import "NSDataSpanConversion.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace chip; -using namespace chip::app; - -{{#zcl_clusters}} -{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} -static id _Nullable DecodeEventPayloadFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) -{ - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aEventId) { - {{#zcl_events}} - {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} - case Events::{{asUpperCamelCase name}}::Id: { - Events::{{asUpperCamelCase name}}::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nil; - } - - __auto_type *value = [MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event new]; - - {{#zcl_event_fields}} - {{#if (isSupported (asUpperCamelCase ../../name preserveAcronyms=true) event=(asUpperCamelCase ../name preserveAcronyms=true) eventField=(asStructPropertyName name))}} - do { - {{asObjectiveCType type parent.parent.name}} memberValue; - {{>decode_value target="memberValue" source=(concat "cppValue." (asLowerCamelCase name)) cluster=parent.parent.name errorCode="*aError = err; return nil;" depth=0}} - value.{{asStructPropertyName name}} = memberValue; - } while(0); - {{/if}} - {{/zcl_event_fields}} - - return value; - } - {{/if}} - {{/zcl_events}} - default: { - break; - } - } - - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - return nil; -} -{{/if}} -{{/zcl_clusters}} - -id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) -{ - switch (aPath.mClusterId) { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - return DecodeEventPayloadFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(aPath.mEventId, aReader, aError); - } - {{/if}} - {{/zcl_clusters}} - default: { - break; - } - } - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - return nil; -} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc-src.zapt deleted file mode 100644 index 8c9372f87bc9ff..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc-src.zapt +++ /dev/null @@ -1,182 +0,0 @@ -{{> header excludeZapComment=true}} - -#import "MTRStructsObjc.h" - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} -{{#zcl_structs}} -{{#*inline "interfaceImpl"}} -@implementation {{interfaceName}} -- (instancetype)init -{ - if (self = [super init]) { - {{#zcl_struct_items}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))}} - {{>init_struct_member label=label type=type cluster=parent.parent.name}} - {{/if}} - {{/zcl_struct_items}} - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[{{interfaceName}} alloc] init]; - - {{#zcl_struct_items}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))}} - other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; - {{/if}} - {{/zcl_struct_items}} - - return other; -} - -- (NSString *)description -{ - NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_struct_items~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))~}} - {{~asStructPropertyName label}}:%@; {{!Just here to keep the preceding space}} - {{~/if~}} - {{~/zcl_struct_items}}>", NSStringFromClass([self class]){{#zcl_struct_items~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))~}} - ,{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}} - {{~/if~}} - {{~/zcl_struct_items}}]; - return descriptionString; -} -{{#zcl_struct_items}} -{{#if (and (hasOldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label)) - (isSupported (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(oldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label))))}} - -{{> renamed_struct_field_impl cluster=../../name type=type newName=label oldName=(oldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_struct_items}} - -@end -{{/inline}} - -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} -{{> interfaceImpl interfaceName=(concat "MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true))}} -{{/if}} - -{{! Takes the name of the struct to use as structName. }} -{{#*inline "oldNameImpl"}} -{{#if (isSupported cluster struct=structName)}} -@implementation MTR{{cluster}}Cluster{{structName}} : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} -{{#zcl_struct_items}} -{{#if (isSupported ../cluster struct=../structName structField=(asStructPropertyName label))}} -@dynamic {{asStructPropertyName label}}; -{{/if}} -{{#if (hasOldName ../cluster struct=../structName structField=(asStructPropertyName label))}} -{{#if (isSupported ../cluster struct=../structName structField=(oldName ../cluster struct=../structName structField=(asStructPropertyName label)))}} -@dynamic {{oldName ../cluster struct=../structName structField=(asStructPropertyName label)}}; -{{/if}} -{{/if}} -{{/zcl_struct_items}} -@end -{{/if}} -{{/inline}} -{{! Takes the old name of the struct, if any, as oldStructName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldStructName - (hasOldName (asUpperCamelCase parent.name preserveAcronyms=true)))}} -{{#if oldStructName}} -{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) structName=oldStructName}} -{{else}} -{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) structName=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldStructName=(oldName (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} - -{{/zcl_structs}} - -{{#zcl_events}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} -@implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event -- (instancetype)init -{ - if (self = [super init]) { - {{#zcl_event_fields}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) event=(asUpperCamelCase parent.name preserveAcronyms=true) eventField=(asStructPropertyName name))}} - {{>init_struct_member label=name type=type cluster=parent.parent.name}} - {{/if}} - {{/zcl_event_fields}} - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event alloc] init]; - - {{#zcl_event_fields}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) event=(asUpperCamelCase parent.name preserveAcronyms=true) eventField=(asStructPropertyName name))}} - other.{{asStructPropertyName name}} = self.{{asStructPropertyName name}}; - {{/if}} - {{/zcl_event_fields}} - - return other; -} - -- (NSString *)description -{ - NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_event_fields~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) event=(asUpperCamelCase parent.name preserveAcronyms=true) eventField=(asStructPropertyName name))~}} - {{asStructPropertyName name}}:%@; {{!Just here to keep the preceding space}} - {{~/if~}} - {{~/zcl_event_fields}}>", NSStringFromClass([self class]){{#zcl_event_fields~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) event=(asUpperCamelCase parent.name preserveAcronyms=true) eventField=(asStructPropertyName name))~}} - ,{{#if isArray}}_{{asStructPropertyName name}}{{else if (isOctetString type)}}[_{{asStructPropertyName name}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName name}}{{/if}} - {{~/if~}} - {{~/zcl_event_fields}}]; - return descriptionString; -} - -{{#zcl_event_fields}} -{{#if (and (hasOldName (asUpperCamelCase ../parent.name preserveAcronyms=true) event=(asUpperCamelCase ../name preserveAcronyms=true) eventField=(asStructPropertyName name)) - (isSupported (asUpperCamelCase ../parent.name preserveAcronyms=true) event=(asUpperCamelCase ../name preserveAcronyms=true) eventField=(oldName (asUpperCamelCase ../parent.name preserveAcronyms=true) event=(asUpperCamelCase ../name preserveAcronyms=true) eventField=(asStructPropertyName name))))}} - -{{> renamed_struct_field_impl cluster=../parent.name type=type newName=name oldName=(oldName (asUpperCamelCase ../parent.name preserveAcronyms=true) event=(asUpperCamelCase ../name preserveAcronyms=true) eventField=(asStructPropertyName name))}} -{{/if}} -{{/zcl_event_fields}} -@end -{{/if}} -{{! Takes the name of the event to use as eventName. }} -{{#*inline "oldNameImpl"}} -{{#if (isSupported cluster event=eventName)}} - -@implementation MTR{{cluster}}Cluster{{eventName}}Event : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event -{{#zcl_event_fields}} -{{#if (isSupported ../cluster event=../eventName eventField=(asStructPropertyName name))}} -@dynamic {{asStructPropertyName name}}; -{{/if}} -{{#if (hasOldName ../cluster event=../eventName eventField=(asStructPropertyName name))}} -{{#if (isSupported ../cluster event=../eventName eventField=(oldName ../cluster event=../eventName eventField=(asStructPropertyName name)))}} -@dynamic {{oldName ../cluster event=../event eventField=(asStructPropertyName name)}}; -{{/if}} -{{/if}} -{{/zcl_event_fields}} -@end -{{/if}} -{{/inline}} -{{! Takes the old name of the event, if any, as oldEventName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldEventName - (hasOldName (asUpperCamelCase parent.name preserveAcronyms=true)))}} -{{#if oldEventName}} -{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) eventName=oldEventName}} -{{else}} -{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) eventName=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldEventName=(oldName (asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} - -{{/zcl_events}} - -{{/zcl_clusters}} - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc.zapt deleted file mode 100644 index 5e8c2528007182..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRStructsObjc.zapt +++ /dev/null @@ -1,100 +0,0 @@ -{{> header excludeZapComment=true}} - -#import - -NS_ASSUME_NONNULL_BEGIN - -{{#zcl_clusters}} -{{#zcl_structs}} -{{#*inline "interfaceDecl"}} -{{#zcl_struct_items}} -{{#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))}} -{{> struct_field_decl cluster=../cluster type=type label=label}} {{availability (asUpperCamelCase ../cluster preserveAcronyms=true) struct=../struct structField=(asStructPropertyName label) deprecationMessage=(concat "Please use MTR" (asUpperCamelCase ../../name preserveAcronyms=true) "Cluster" (asUpperCamelCase ../name preserveAcronyms=true))}}; -{{/if}} -{{#if (hasOldName ../cluster struct=../struct structField=(asStructPropertyName label))}} -{{#if (isSupported ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)))}} -{{> struct_field_decl cluster=../cluster type=type label=(oldName ../cluster struct=../struct structField=(asStructPropertyName label))}} {{availability ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)) deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; -{{/if}} -{{/if}} -{{/zcl_struct_items}} -{{/inline}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} -{{availability (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true) deprecationMessage="This struct is unused and will be removed"}} -@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} : NSObject -{{> interfaceDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true)}} -@end - -{{/if}} -{{! Takes the name of the struct to use as structName. }} -{{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping parent.name) struct=structName)}} -{{availability (compatClusterNameRemapping parent.name) struct=structName deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true))}} -@interface MTR{{compatClusterNameRemapping parent.name}}Cluster{{structName}} : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} -{{> interfaceDecl cluster=(compatClusterNameRemapping parent.name) struct=structName}} -@end - -{{/if}} -{{/inline}} -{{! Takes the old name of the struct, if any, as oldStructName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldStructName - (hasOldName (asUpperCamelCase parent.name preserveAcronyms=true)))}} -{{#if oldStructName}} -{{> oldNameDecl structName=oldStructName}} -{{else}} -{{> oldNameDecl structName=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldStructName=(oldName (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} -{{/zcl_structs}} - -{{#zcl_events}} -{{#*inline "interfaceDecl"}} -{{#zcl_event_fields}} -{{#if (isSupported ../cluster event=../event eventField=(asStructPropertyName name))}} -{{> struct_field_decl cluster=../cluster type=type label=name}} {{availability ../cluster event=../event eventField=(asStructPropertyName name) deprecationMessage=(concat "Please use MTR" (asUpperCamelCase ../../name preserveAcronyms=true) "Cluster" (asUpperCamelCase ../name preserveAcronyms=true) "Event")}}; -{{/if}} -{{#if (hasOldName ../cluster event=../event eventField=(asStructPropertyName name))}} -{{#if (isSupported ../cluster event=../event eventField=(oldName ../cluster event=../event eventField=(asStructPropertyName name)))}} -{{> struct_field_decl cluster=../cluster type=type label=(oldName ../cluster event=../event eventField=(asStructPropertyName name))}} {{availability ../cluster event=../event eventField=(oldName ../cluster event=../event eventField=(asStructPropertyName name)) deprecationMessage=(concat "Please use " (asStructPropertyName name))}}; -{{/if}} -{{/if}} -{{/zcl_event_fields}} -{{/inline}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} -{{availability (asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true)}} -@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event : NSObject -{{> interfaceDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true)}} -@end - -{{/if}} -{{! Takes the name of the event to use as eventName. }} -{{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping parent.name) event=eventName)}} -{{availability (compatClusterNameRemapping parent.name) event=eventName deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Event")}} -@interface MTR{{compatClusterNameRemapping parent.name}}Cluster{{eventName}}Event : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event -{{> interfaceDecl cluster=(compatClusterNameRemapping parent.name) event=eventName}} -@end - -{{/if}} -{{/inline}} -{{! Takes the old name of the event, if any, as oldEventName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldEventName - (hasOldName (asUpperCamelCase parent.name preserveAcronyms=true)))}} -{{#if oldEventName}} -{{> oldNameDecl eventName=oldEventName}} -{{else}} -{{> oldNameDecl eventName=(asUpperCamelCase name preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldEventName=(oldName (asUpperCamelCase parent.name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} - -{{/zcl_events}} - - -{{/zcl_clusters}} - -NS_ASSUME_NONNULL_END diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/config-data.yaml b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/config-data.yaml index de4544befeda80..2567306d5cb5e0 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/config-data.yaml +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/config-data.yaml @@ -19,8 +19,8 @@ LegacyCommandsWithOnlyOptionalArguments: - UnitTesting::TestNullableOptionalRequest - UnitTesting::TestSimpleOptionalArgumentRequest +# The media clusters relevant to Matter Casting MatterCastingClusters: - # The clusters we care about - Application Basic - Application Launcher - Content Launcher @@ -29,4 +29,8 @@ MatterCastingClusters: - Media Playback - On/Off - Target Navigator - - Wake on LAN \ No newline at end of file + - Wake on LAN + +# The commands currently implemented for Matter Casting in MCCommandObjects.h/mm. We will ZAP generate this file in the next PR. +MatterCastingImplementedCommands: + - LaunchURL \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json index 727c8eb74ec269..26e1f460bb9599 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json @@ -59,6 +59,16 @@ "path": "MCAttributeObjects-src.zapt", "name": "Objc ZCL asynchronous API Internal Header", "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm" + }, + { + "path": "MCClusterObjects.zapt", + "name": "Objc ZCL asynchronous API Internal Header", + "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h" + }, + { + "path": "MCClusterObjects-src.zapt", + "name": "Objc ZCL asynchronous API Internal Header", + "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm" } ] } \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h index 7c138aa1ffde37..6f15e77447e914 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h @@ -17,47 +17,14 @@ // THIS FILE IS GENERATED BY ZAP +#import "MCStructsObjc.h" + #import "../MCAttribute.h" #import #ifndef MCAttributeObjects_h #define MCAttributeObjects_h -@interface MCMediaPlaybackClusterPlaybackPositionStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; -@property (nonatomic, copy) NSNumber * _Nullable position; -@end - -@interface MCMediaPlaybackClusterTrackAttributesStruct : NSObject -@property (nonatomic, copy) NSString * _Nonnull languageCode; -@property (nonatomic, copy) NSString * _Nullable displayName; -@end - -@interface MCMediaPlaybackClusterTrackStruct : NSObject -@property (nonatomic, copy) NSString * _Nonnull id; -@property (nonatomic, copy) MCMediaPlaybackClusterTrackAttributesStruct * _Nullable trackAttributes; -@end - -@interface MCApplicationBasicClusterApplicationStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; -@property (nonatomic, copy) NSString * _Nonnull applicationID; -@end - -@interface MCTargetNavigatorClusterTargetInfoStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull identifier; -@property (nonatomic, copy) NSString * _Nonnull name; -@end - -@interface MCApplicationLauncherClusterApplicationStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; -@property (nonatomic, copy) NSString * _Nonnull applicationID; -@end - -@interface MCApplicationLauncherClusterApplicationEPStruct : NSObject -@property (nonatomic, copy) MCApplicationLauncherClusterApplicationStruct * _Nonnull application; -@property (nonatomic, copy) NSNumber * _Nullable endpoint; -@end - // OnOff cluster attributes: @interface MCOnOffClusterOnOffAttribute : MCAttribute @@ -181,6 +148,85 @@ @interface MCWakeOnLanClusterClusterRevisionAttribute : MCAttribute @end +// TargetNavigator cluster attributes: + +@interface MCTargetNavigatorClusterTargetListAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterCurrentTargetAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterGeneratedCommandListAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterAcceptedCommandListAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterEventListAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterAttributeListAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterFeatureMapAttribute : MCAttribute +@end + +@interface MCTargetNavigatorClusterClusterRevisionAttribute : MCAttribute +@end + +// MediaPlayback cluster attributes: + +@interface MCMediaPlaybackClusterCurrentStateAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterStartTimeAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterDurationAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterSampledPositionAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterPlaybackSpeedAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterSeekRangeEndAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterSeekRangeStartAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterActiveAudioTrackAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterAvailableAudioTracksAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterActiveTextTrackAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterAvailableTextTracksAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterGeneratedCommandListAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterAcceptedCommandListAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterEventListAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterAttributeListAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterFeatureMapAttribute : MCAttribute +@end + +@interface MCMediaPlaybackClusterClusterRevisionAttribute : MCAttribute +@end + // KeypadInput cluster attributes: @interface MCKeypadInputClusterGeneratedCommandListAttribute : MCAttribute @@ -227,4 +273,74 @@ @interface MCContentLauncherClusterClusterRevisionAttribute : MCAttribute @end +// ApplicationLauncher cluster attributes: + +@interface MCApplicationLauncherClusterCatalogListAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterCurrentAppAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterGeneratedCommandListAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterAcceptedCommandListAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterEventListAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterAttributeListAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterFeatureMapAttribute : MCAttribute +@end + +@interface MCApplicationLauncherClusterClusterRevisionAttribute : MCAttribute +@end + +// ApplicationBasic cluster attributes: + +@interface MCApplicationBasicClusterVendorNameAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterVendorIDAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterApplicationNameAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterProductIDAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterApplicationAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterStatusAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterApplicationVersionAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterAllowedVendorListAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterGeneratedCommandListAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterAcceptedCommandListAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterEventListAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterAttributeListAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterFeatureMapAttribute : MCAttribute +@end + +@interface MCApplicationBasicClusterClusterRevisionAttribute : MCAttribute +@end + #endif /* MCAttributeObjects_h */ \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm index 790a600d12df62..e5191ee0bbaba7 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm @@ -2082,13 +2082,2802 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end +// TargetNavigator cluster attributes: + +@implementation MCTargetNavigatorClusterTargetListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MCTargetNavigatorClusterTargetInfoStruct * newElement_0; + newElement_0 = [MCTargetNavigatorClusterTargetInfoStruct new]; + newElement_0.identifier = [NSNumber numberWithUnsignedChar:entry_0.identifier]; + newElement_0.name = AsString(entry_0.name); + if (newElement_0.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterCurrentTargetAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterGeneratedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterAcceptedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterEventListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterAttributeListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterFeatureMapAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCTargetNavigatorClusterClusterRevisionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +// MediaPlayback cluster attributes: + +@implementation MCMediaPlaybackClusterCurrentStateAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(_cppValue)]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterStartTimeAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::StartTime::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:_cppValue.Value()]; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterDurationAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:_cppValue.Value()]; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterSampledPositionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + MCMediaPlaybackClusterPlaybackPositionStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterPlaybackPositionStruct * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [MCMediaPlaybackClusterPlaybackPositionStruct new]; + value.updatedAt = [NSNumber numberWithUnsignedLongLong:_cppValue.Value().updatedAt]; + if (_cppValue.Value().position.IsNull()) { + value.position = nil; + } else { + value.position = [NSNumber numberWithUnsignedLongLong:_cppValue.Value().position.Value()]; + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterPlaybackSpeedAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithFloat:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterSeekRangeEndAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:_cppValue.Value()]; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterSeekRangeStartAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:_cppValue.Value()]; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterActiveAudioTrackAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + MCMediaPlaybackClusterTrackStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::ActiveAudioTrack::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterTrackStruct * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [MCMediaPlaybackClusterTrackStruct new]; + value.id = AsString(_cppValue.Value().id); + if (value.id == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (_cppValue.Value().trackAttributes.IsNull()) { + value.trackAttributes = nil; + } else { + value.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + value.trackAttributes.languageCode = AsString(_cppValue.Value().trackAttributes.Value().languageCode); + if (value.trackAttributes.languageCode == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (_cppValue.Value().trackAttributes.Value().displayName.HasValue()) { + if (_cppValue.Value().trackAttributes.Value().displayName.Value().IsNull()) { + value.trackAttributes.displayName = nil; + } else { + value.trackAttributes.displayName = AsString(_cppValue.Value().trackAttributes.Value().displayName.Value().Value()); + if (value.trackAttributes.displayName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + } else { + value.trackAttributes.displayName = nil; + } + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterAvailableAudioTracksAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::AvailableAudioTracks::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = _cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MCMediaPlaybackClusterTrackStruct * newElement_1; + newElement_1 = [MCMediaPlaybackClusterTrackStruct new]; + newElement_1.id = AsString(entry_1.id); + if (newElement_1.id == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_1.trackAttributes.IsNull()) { + newElement_1.trackAttributes = nil; + } else { + newElement_1.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + newElement_1.trackAttributes.languageCode = AsString(entry_1.trackAttributes.Value().languageCode); + if (newElement_1.trackAttributes.languageCode == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_1.trackAttributes.Value().displayName.HasValue()) { + if (entry_1.trackAttributes.Value().displayName.Value().IsNull()) { + newElement_1.trackAttributes.displayName = nil; + } else { + newElement_1.trackAttributes.displayName = AsString(entry_1.trackAttributes.Value().displayName.Value().Value()); + if (newElement_1.trackAttributes.displayName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + } else { + newElement_1.trackAttributes.displayName = nil; + } + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterActiveTextTrackAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + MCMediaPlaybackClusterTrackStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::ActiveTextTrack::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterTrackStruct * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [MCMediaPlaybackClusterTrackStruct new]; + value.id = AsString(_cppValue.Value().id); + if (value.id == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (_cppValue.Value().trackAttributes.IsNull()) { + value.trackAttributes = nil; + } else { + value.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + value.trackAttributes.languageCode = AsString(_cppValue.Value().trackAttributes.Value().languageCode); + if (value.trackAttributes.languageCode == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (_cppValue.Value().trackAttributes.Value().displayName.HasValue()) { + if (_cppValue.Value().trackAttributes.Value().displayName.Value().IsNull()) { + value.trackAttributes.displayName = nil; + } else { + value.trackAttributes.displayName = AsString(_cppValue.Value().trackAttributes.Value().displayName.Value().Value()); + if (value.trackAttributes.displayName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + } else { + value.trackAttributes.displayName = nil; + } + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterAvailableTextTracksAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::AvailableTextTracks::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = _cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MCMediaPlaybackClusterTrackStruct * newElement_1; + newElement_1 = [MCMediaPlaybackClusterTrackStruct new]; + newElement_1.id = AsString(entry_1.id); + if (newElement_1.id == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_1.trackAttributes.IsNull()) { + newElement_1.trackAttributes = nil; + } else { + newElement_1.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + newElement_1.trackAttributes.languageCode = AsString(entry_1.trackAttributes.Value().languageCode); + if (newElement_1.trackAttributes.languageCode == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_1.trackAttributes.Value().displayName.HasValue()) { + if (entry_1.trackAttributes.Value().displayName.Value().IsNull()) { + newElement_1.trackAttributes.displayName = nil; + } else { + newElement_1.trackAttributes.displayName = AsString(entry_1.trackAttributes.Value().displayName.Value().Value()); + if (newElement_1.trackAttributes.displayName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + } else { + newElement_1.trackAttributes.displayName = nil; + } + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterGeneratedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterAcceptedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterEventListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterAttributeListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterFeatureMapAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCMediaPlaybackClusterClusterRevisionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + // KeypadInput cluster attributes: -@implementation MCKeypadInputClusterGeneratedCommandListAttribute +@implementation MCKeypadInputClusterGeneratedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCKeypadInputClusterAcceptedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCKeypadInputClusterEventListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCKeypadInputClusterAttributeListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCKeypadInputClusterFeatureMapAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCKeypadInputClusterClusterRevisionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +// ContentLauncher cluster attributes: + +@implementation MCContentLauncherClusterAcceptHeaderAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSString * newElement_0; + newElement_0 = AsString(entry_0); + if (newElement_0 == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterSupportedStreamingProtocolsAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue.Raw()]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterGeneratedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterAcceptedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterEventListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterAttributeListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterFeatureMapAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCContentLauncherClusterClusterRevisionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +// ApplicationLauncher cluster attributes: + +@implementation MCApplicationLauncherClusterCatalogListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::CatalogList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterCurrentAppAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + MCApplicationLauncherClusterApplicationEPStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCApplicationLauncherClusterApplicationEPStruct * _Nullable value; + if (_cppValue.IsNull()) { + value = nil; + } else { + value = [MCApplicationLauncherClusterApplicationEPStruct new]; + value.application = [MCApplicationLauncherClusterApplicationStruct new]; + value.application.catalogVendorID = [NSNumber numberWithUnsignedShort:_cppValue.Value().application.catalogVendorID]; + value.application.applicationID = AsString(_cppValue.Value().application.applicationID); + if (value.application.applicationID == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (_cppValue.Value().endpoint.HasValue()) { + value.endpoint = [NSNumber numberWithUnsignedShort:_cppValue.Value().endpoint.Value()]; + } else { + value.endpoint = nil; + } + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterGeneratedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterAcceptedCommandListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterEventListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterAttributeListAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterFeatureMapAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +@implementation MCApplicationLauncherClusterClusterRevisionAttribute +- (void)read:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->read(context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }); +} + +- (void)subscribe:(void * _Nullable)context + completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval +{ + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + [self](std::any cppValue, CHIP_ERROR * errPtr) { + return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; + }); + mcAttribute->subscribe( + context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { + completion(context, before, after, err); + delete mcAttribute; + }, minInterval, maxInterval); +} + +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError +{ + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + // auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; + return value; +} +@end + +// ApplicationBasic cluster attributes: + +@implementation MCApplicationBasicClusterVendorNameAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2103,7 +4892,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2116,28 +4905,18 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = _cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; + NSString * _Nonnull value; + value = AsString(_cppValue); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; } return value; } @@ -2146,11 +4925,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCKeypadInputClusterAcceptedCommandListAttribute +@implementation MCApplicationBasicClusterVendorIDAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2165,7 +4944,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2178,29 +4957,14 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = _cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(_cppValue)]; return value; } *aError = CHIP_ERROR_INTERNAL; @@ -2208,11 +4972,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCKeypadInputClusterEventListAttribute +@implementation MCApplicationBasicClusterApplicationNameAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2227,7 +4991,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2240,28 +5004,18 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = _cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; + NSString * _Nonnull value; + value = AsString(_cppValue); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; } return value; } @@ -2270,11 +5024,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCKeypadInputClusterAttributeListAttribute +@implementation MCApplicationBasicClusterProductIDAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2289,7 +5043,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2302,29 +5056,14 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = _cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:_cppValue]; return value; } *aError = CHIP_ERROR_INTERNAL; @@ -2332,11 +5071,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCKeypadInputClusterFeatureMapAttribute +@implementation MCApplicationBasicClusterApplicationAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2351,7 +5090,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2364,14 +5103,21 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSNumber * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + MCApplicationBasicClusterApplicationStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::Application::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:_cppValue]; + MCApplicationBasicClusterApplicationStruct * _Nonnull value; + value = [MCApplicationBasicClusterApplicationStruct new]; + value.catalogVendorID = [NSNumber numberWithUnsignedShort:_cppValue.catalogVendorID]; + value.applicationID = AsString(_cppValue.applicationID); + if (value.applicationID == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } return value; } *aError = CHIP_ERROR_INTERNAL; @@ -2379,11 +5125,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCKeypadInputClusterClusterRevisionAttribute +@implementation MCApplicationBasicClusterStatusAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2398,7 +5144,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2412,13 +5158,13 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSNumber * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::Status::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:_cppValue]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(_cppValue)]; return value; } *aError = CHIP_ERROR_INTERNAL; @@ -2426,13 +5172,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -// ContentLauncher cluster attributes: - -@implementation MCContentLauncherClusterAcceptHeaderAttribute +@implementation MCApplicationBasicClusterApplicationVersionAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2447,7 +5191,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2460,33 +5204,18 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = _cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSString * newElement_0; - newElement_0 = AsString(entry_0); - if (newElement_0 == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - *aError = err; - return nil; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; + NSString * _Nonnull value; + value = AsString(_cppValue); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; } return value; } @@ -2495,11 +5224,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterSupportedStreamingProtocolsAttribute +@implementation MCApplicationBasicClusterAllowedVendorListAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2514,7 +5243,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2527,14 +5256,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - NSNumber * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableType _cppValue = *sharedPtr; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:_cppValue.Raw()]; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = _cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } return value; } *aError = CHIP_ERROR_INTERNAL; @@ -2542,11 +5286,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterGeneratedCommandListAttribute +@implementation MCApplicationBasicClusterGeneratedCommandListAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2561,7 +5305,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2575,9 +5319,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSArray * _Nonnull value; @@ -2604,11 +5348,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterAcceptedCommandListAttribute +@implementation MCApplicationBasicClusterAcceptedCommandListAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2623,7 +5367,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2637,9 +5381,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSArray * _Nonnull value; @@ -2666,11 +5410,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterEventListAttribute +@implementation MCApplicationBasicClusterEventListAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2685,7 +5429,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2699,9 +5443,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::EventList::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSArray * _Nonnull value; @@ -2728,11 +5472,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterAttributeListAttribute +@implementation MCApplicationBasicClusterAttributeListAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2747,7 +5491,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2761,9 +5505,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSArray * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSArray * _Nonnull value; @@ -2790,11 +5534,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterFeatureMapAttribute +@implementation MCApplicationBasicClusterFeatureMapAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2809,7 +5553,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2823,9 +5567,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSNumber * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::FeatureMap::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSNumber * _Nonnull value; @@ -2837,11 +5581,11 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } @end -@implementation MCContentLauncherClusterClusterRevisionAttribute +@implementation MCApplicationBasicClusterClusterRevisionAttribute - (void)read:(void * _Nullable)context completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2856,7 +5600,7 @@ - (void)subscribe:(void * _Nullable)context minInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval { - MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, + MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, [self](std::any cppValue, CHIP_ERROR * errPtr) { return [self getObjCTypeFromCpp:cppValue errorCode:errPtr]; }); @@ -2870,9 +5614,9 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { NSNumber * value = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr sharedPtr = std::any_cast>(cppValue); - chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::TypeInfo::DecodableType _cppValue = *sharedPtr; // auto & valueSharedPtr = *sharedPtr; *aError = CHIP_NO_ERROR; NSNumber * _Nonnull value; diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h new file mode 100644 index 00000000000000..7593df0ebe1331 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h @@ -0,0 +1,614 @@ +/* + * + * 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 + +#import "../MCCluster.h" +#import "../MCCommandObjects.h" +#import "MCAttributeObjects.h" +#import + +#ifndef MCClusterObjects_h +#define MCClusterObjects_h + +// OnOff cluster: + +@interface MCOnOffCluster : MCCluster + +// OnOff cluster commands: + +// OnOff cluster attributes: + +/** + * @brief Returns non-nil pointer to MCOnOffClusterOnOffAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterOnOffAttribute * _Nullable)onOffAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterGlobalSceneControlAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterGlobalSceneControlAttribute * _Nullable)globalSceneControlAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterOnTimeAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterOnTimeAttribute * _Nullable)onTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterOffWaitTimeAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterOffWaitTimeAttribute * _Nullable)offWaitTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterStartUpOnOffAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterStartUpOnOffAttribute * _Nullable)startUpOnOffAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterEventListAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCOnOffClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCOnOffClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// LevelControl cluster: + +@interface MCLevelControlCluster : MCCluster + +// LevelControl cluster commands: + +// LevelControl cluster attributes: + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterCurrentLevelAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterCurrentLevelAttribute * _Nullable)currentLevelAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterRemainingTimeAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterRemainingTimeAttribute * _Nullable)remainingTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterMinLevelAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterMinLevelAttribute * _Nullable)minLevelAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterMaxLevelAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterMaxLevelAttribute * _Nullable)maxLevelAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterCurrentFrequencyAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterCurrentFrequencyAttribute * _Nullable)currentFrequencyAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterMinFrequencyAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterMinFrequencyAttribute * _Nullable)minFrequencyAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterMaxFrequencyAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterMaxFrequencyAttribute * _Nullable)maxFrequencyAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterOptionsAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterOptionsAttribute * _Nullable)optionsAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterOnOffTransitionTimeAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterOnOffTransitionTimeAttribute * _Nullable)onOffTransitionTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterOnLevelAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterOnLevelAttribute * _Nullable)onLevelAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterOnTransitionTimeAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterOnTransitionTimeAttribute * _Nullable)onTransitionTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterOffTransitionTimeAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterOffTransitionTimeAttribute * _Nullable)offTransitionTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterDefaultMoveRateAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterDefaultMoveRateAttribute * _Nullable)defaultMoveRateAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterStartUpCurrentLevelAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterStartUpCurrentLevelAttribute * _Nullable)startUpCurrentLevelAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterEventListAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCLevelControlClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCLevelControlClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// WakeOnLan cluster: + +@interface MCWakeOnLanCluster : MCCluster + +// WakeOnLan cluster commands: + +// WakeOnLan cluster attributes: + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterMACAddressAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterMACAddressAttribute * _Nullable)macAddressAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterLinkLocalAddressAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterLinkLocalAddressAttribute * _Nullable)linkLocalAddressAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterEventListAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCWakeOnLanClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCWakeOnLanClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// TargetNavigator cluster: + +@interface MCTargetNavigatorCluster : MCCluster + +// TargetNavigator cluster commands: + +// TargetNavigator cluster attributes: + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterTargetListAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterTargetListAttribute * _Nullable)targetListAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterCurrentTargetAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterCurrentTargetAttribute * _Nullable)currentTargetAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterEventListAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCTargetNavigatorClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCTargetNavigatorClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// MediaPlayback cluster: + +@interface MCMediaPlaybackCluster : MCCluster + +// MediaPlayback cluster commands: + +// MediaPlayback cluster attributes: + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterCurrentStateAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterCurrentStateAttribute * _Nullable)currentStateAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterStartTimeAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterStartTimeAttribute * _Nullable)startTimeAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterDurationAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterDurationAttribute * _Nullable)durationAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterSampledPositionAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterSampledPositionAttribute * _Nullable)sampledPositionAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterPlaybackSpeedAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterPlaybackSpeedAttribute * _Nullable)playbackSpeedAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterSeekRangeEndAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterSeekRangeEndAttribute * _Nullable)seekRangeEndAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterSeekRangeStartAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterSeekRangeStartAttribute * _Nullable)seekRangeStartAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterActiveAudioTrackAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterActiveAudioTrackAttribute * _Nullable)activeAudioTrackAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterAvailableAudioTracksAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterAvailableAudioTracksAttribute * _Nullable)availableAudioTracksAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterActiveTextTrackAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterActiveTextTrackAttribute * _Nullable)activeTextTrackAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterAvailableTextTracksAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterAvailableTextTracksAttribute * _Nullable)availableTextTracksAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterEventListAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCMediaPlaybackClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCMediaPlaybackClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// KeypadInput cluster: + +@interface MCKeypadInputCluster : MCCluster + +// KeypadInput cluster commands: + +// KeypadInput cluster attributes: + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterEventListAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCKeypadInputClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCKeypadInputClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// ContentLauncher cluster: + +@interface MCContentLauncherCluster : MCCluster + +// ContentLauncher cluster commands: + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterLaunchURLCommand if supported, nil otherwise. + */ +- (MCContentLauncherClusterLaunchURLCommand * _Nullable)launchURLCommand; + +// ContentLauncher cluster attributes: + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterAcceptHeaderAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterAcceptHeaderAttribute * _Nullable)acceptHeaderAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterSupportedStreamingProtocolsAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterSupportedStreamingProtocolsAttribute * _Nullable)supportedStreamingProtocolsAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterEventListAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCContentLauncherClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCContentLauncherClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// ApplicationLauncher cluster: + +@interface MCApplicationLauncherCluster : MCCluster + +// ApplicationLauncher cluster commands: + +// ApplicationLauncher cluster attributes: + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterCatalogListAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterCatalogListAttribute * _Nullable)catalogListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterCurrentAppAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterCurrentAppAttribute * _Nullable)currentAppAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterEventListAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationLauncherClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCApplicationLauncherClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +// ApplicationBasic cluster: + +@interface MCApplicationBasicCluster : MCCluster + +// ApplicationBasic cluster commands: + +// ApplicationBasic cluster attributes: + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterVendorNameAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterVendorNameAttribute * _Nullable)vendorNameAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterVendorIDAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterVendorIDAttribute * _Nullable)vendorIDAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterApplicationNameAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterApplicationNameAttribute * _Nullable)applicationNameAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterProductIDAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterProductIDAttribute * _Nullable)productIDAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterApplicationAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterApplicationAttribute * _Nullable)applicationAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterStatusAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterStatusAttribute * _Nullable)statusAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterApplicationVersionAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterApplicationVersionAttribute * _Nullable)applicationVersionAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterAllowedVendorListAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterAllowedVendorListAttribute * _Nullable)allowedVendorListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterGeneratedCommandListAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterGeneratedCommandListAttribute * _Nullable)generatedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterAcceptedCommandListAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterAcceptedCommandListAttribute * _Nullable)acceptedCommandListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterEventListAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterEventListAttribute * _Nullable)eventListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterAttributeListAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterAttributeListAttribute * _Nullable)attributeListAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterFeatureMapAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterFeatureMapAttribute * _Nullable)featureMapAttribute; + +/** + * @brief Returns non-nil pointer to MCApplicationBasicClusterClusterRevisionAttribute if supported, nil otherwise. + */ +- (MCApplicationBasicClusterClusterRevisionAttribute * _Nullable)clusterRevisionAttribute; +@end + +#endif /* MCClusterObjects_h */ \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm new file mode 100644 index 00000000000000..c7fb3697d67885 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm @@ -0,0 +1,717 @@ +/* + * + * 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 + +#import "MCClusterObjects.h" + +#import "../MCAttribute_Internal.h" +#import "../MCCluster_Internal.h" +#import "../MCCommand_Internal.h" + +#include "core/Attribute.h" +#include "core/Command.h" +#include + +#import + +// OnOff cluster: + +@implementation MCOnOffCluster + +// OnOff cluster commands: + +// OnOff cluster attributes: + +- (id)onOffAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::OnOff::Id); + return cppAttribute != nil ? [[MCOnOffClusterOnOffAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)globalSceneControlAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::Id); + return cppAttribute != nil ? [[MCOnOffClusterGlobalSceneControlAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)onTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::OnTime::Id); + return cppAttribute != nil ? [[MCOnOffClusterOnTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)offWaitTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::OffWaitTime::Id); + return cppAttribute != nil ? [[MCOnOffClusterOffWaitTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)startUpOnOffAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::StartUpOnOff::Id); + return cppAttribute != nil ? [[MCOnOffClusterStartUpOnOffAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCOnOffClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCOnOffClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCOnOffClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCOnOffClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCOnOffClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::OnOff::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCOnOffClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// LevelControl cluster: + +@implementation MCLevelControlCluster + +// LevelControl cluster commands: + +// LevelControl cluster attributes: + +- (id)currentLevelAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::CurrentLevel::Id); + return cppAttribute != nil ? [[MCLevelControlClusterCurrentLevelAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)remainingTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::RemainingTime::Id); + return cppAttribute != nil ? [[MCLevelControlClusterRemainingTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)minLevelAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::MinLevel::Id); + return cppAttribute != nil ? [[MCLevelControlClusterMinLevelAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)maxLevelAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::MaxLevel::Id); + return cppAttribute != nil ? [[MCLevelControlClusterMaxLevelAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)currentFrequencyAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::Id); + return cppAttribute != nil ? [[MCLevelControlClusterCurrentFrequencyAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)minFrequencyAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::MinFrequency::Id); + return cppAttribute != nil ? [[MCLevelControlClusterMinFrequencyAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)maxFrequencyAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::MaxFrequency::Id); + return cppAttribute != nil ? [[MCLevelControlClusterMaxFrequencyAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)optionsAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::Options::Id); + return cppAttribute != nil ? [[MCLevelControlClusterOptionsAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)onOffTransitionTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::Id); + return cppAttribute != nil ? [[MCLevelControlClusterOnOffTransitionTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)onLevelAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::OnLevel::Id); + return cppAttribute != nil ? [[MCLevelControlClusterOnLevelAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)onTransitionTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::Id); + return cppAttribute != nil ? [[MCLevelControlClusterOnTransitionTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)offTransitionTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::Id); + return cppAttribute != nil ? [[MCLevelControlClusterOffTransitionTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)defaultMoveRateAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::Id); + return cppAttribute != nil ? [[MCLevelControlClusterDefaultMoveRateAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)startUpCurrentLevelAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::Id); + return cppAttribute != nil ? [[MCLevelControlClusterStartUpCurrentLevelAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCLevelControlClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCLevelControlClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCLevelControlClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCLevelControlClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCLevelControlClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::LevelControl::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCLevelControlClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// WakeOnLan cluster: + +@implementation MCWakeOnLanCluster + +// WakeOnLan cluster commands: + +// WakeOnLan cluster attributes: + +- (id)macAddressAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::MACAddress::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterMACAddressAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)linkLocalAddressAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::LinkLocalAddress::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterLinkLocalAddressAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCWakeOnLanClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// TargetNavigator cluster: + +@implementation MCTargetNavigatorCluster + +// TargetNavigator cluster commands: + +// TargetNavigator cluster attributes: + +- (id)targetListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterTargetListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)currentTargetAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterCurrentTargetAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCTargetNavigatorClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// MediaPlayback cluster: + +@implementation MCMediaPlaybackCluster + +// MediaPlayback cluster commands: + +// MediaPlayback cluster attributes: + +- (id)currentStateAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::CurrentState::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterCurrentStateAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)startTimeAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::StartTime::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterStartTimeAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)durationAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::Duration::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterDurationAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)sampledPositionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterSampledPositionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)playbackSpeedAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterPlaybackSpeedAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)seekRangeEndAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterSeekRangeEndAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)seekRangeStartAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterSeekRangeStartAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)activeAudioTrackAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::ActiveAudioTrack::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterActiveAudioTrackAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)availableAudioTracksAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::AvailableAudioTracks::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterAvailableAudioTracksAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)activeTextTrackAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::ActiveTextTrack::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterActiveTextTrackAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)availableTextTracksAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::AvailableTextTracks::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterAvailableTextTracksAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCMediaPlaybackClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// KeypadInput cluster: + +@implementation MCKeypadInputCluster + +// KeypadInput cluster commands: + +// KeypadInput cluster attributes: + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCKeypadInputClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// ContentLauncher cluster: + +@implementation MCContentLauncherCluster + +// ContentLauncher cluster commands: + +- (id)launchURLCommand +{ + void * cppCommand = self.cppCluster->GetCommand(chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Id); + return cppCommand != nil ? [[MCContentLauncherClusterLaunchURLCommand alloc] initWithCppCommand:cppCommand] : nil; +} + +// ContentLauncher cluster attributes: + +- (id)acceptHeaderAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterAcceptHeaderAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)supportedStreamingProtocolsAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterSupportedStreamingProtocolsAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCContentLauncherClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// ApplicationLauncher cluster: + +@implementation MCApplicationLauncherCluster + +// ApplicationLauncher cluster commands: + +// ApplicationLauncher cluster attributes: + +- (id)catalogListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::CatalogList::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterCatalogListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)currentAppAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterCurrentAppAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCApplicationLauncherClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end + +// ApplicationBasic cluster: + +@implementation MCApplicationBasicCluster + +// ApplicationBasic cluster commands: + +// ApplicationBasic cluster attributes: + +- (id)vendorNameAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::VendorName::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterVendorNameAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)vendorIDAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::VendorID::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterVendorIDAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)applicationNameAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterApplicationNameAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)productIDAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::ProductID::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterProductIDAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)applicationAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::Application::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterApplicationAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)statusAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::Status::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterStatusAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)applicationVersionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterApplicationVersionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)allowedVendorListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterAllowedVendorListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)generatedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::GeneratedCommandList::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterGeneratedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)acceptedCommandListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::AcceptedCommandList::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterAcceptedCommandListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)eventListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::EventList::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterEventListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)attributeListAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterAttributeListAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)featureMapAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::FeatureMap::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterFeatureMapAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} + +- (id)clusterRevisionAttribute +{ + void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::Id); + return cppAttribute != nil ? [[MCApplicationBasicClusterClusterRevisionAttribute alloc] initWithCppAttribute:cppAttribute] : nil; +} +@end diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.h new file mode 100644 index 00000000000000..fa039162149609 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.h @@ -0,0 +1,58 @@ +/** + * + * Copyright (c) 2020-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. + */ + +#import + +#ifndef MCStructsObjc_h +#define MCStructsObjc_h + +@interface MCMediaPlaybackClusterPlaybackPositionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +@interface MCMediaPlaybackClusterTrackAttributesStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull languageCode; +@property (nonatomic, copy) NSString * _Nullable displayName; +@end + +@interface MCMediaPlaybackClusterTrackStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull id; +@property (nonatomic, copy) MCMediaPlaybackClusterTrackAttributesStruct * _Nullable trackAttributes; +@end + +@interface MCApplicationBasicClusterApplicationStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; +@property (nonatomic, copy) NSString * _Nonnull applicationID; +@end + +@interface MCTargetNavigatorClusterTargetInfoStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull identifier; +@property (nonatomic, copy) NSString * _Nonnull name; +@end + +@interface MCApplicationLauncherClusterApplicationStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull catalogVendorID; +@property (nonatomic, copy) NSString * _Nonnull applicationID; +@end + +@interface MCApplicationLauncherClusterApplicationEPStruct : NSObject +@property (nonatomic, copy) MCApplicationLauncherClusterApplicationStruct * _Nonnull application; +@property (nonatomic, copy) NSNumber * _Nullable endpoint; +@end + +#endif /* MCStructsObjc_h */ diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.mm new file mode 100644 index 00000000000000..64ced385e18a05 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCStructsObjc.mm @@ -0,0 +1,291 @@ +/** + * + * Copyright (c) 2020-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. + */ + +#import "MCStructsObjc.h" + +#import + +@implementation MCMediaPlaybackClusterPlaybackPositionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _updatedAt = @(0); + + _position = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCMediaPlaybackClusterPlaybackPositionStruct alloc] init]; + + other.updatedAt = self.updatedAt; + other.position = self.position; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: updatedAt:%@; position:%@; >", NSStringFromClass([self class]), _updatedAt, _position]; + return descriptionString; +} + +@end + +@implementation MCMediaPlaybackClusterPlaybackPosition : MCMediaPlaybackClusterPlaybackPositionStruct +@dynamic updatedAt; +@dynamic position; +@end + +@implementation MCMediaPlaybackClusterTrackAttributesStruct +- (instancetype)init +{ + if (self = [super init]) { + + _languageCode = @""; + + _displayName = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCMediaPlaybackClusterTrackAttributesStruct alloc] init]; + + other.languageCode = self.languageCode; + other.displayName = self.displayName; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: languageCode:%@; displayName:%@; >", NSStringFromClass([self class]), _languageCode, _displayName]; + return descriptionString; +} + +@end + +@implementation MCMediaPlaybackClusterTrackStruct +- (instancetype)init +{ + if (self = [super init]) { + + _id = @""; + + _trackAttributes = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCMediaPlaybackClusterTrackStruct alloc] init]; + + other.id = self.id; + other.trackAttributes = self.trackAttributes; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: id:%@; trackAttributes:%@; >", NSStringFromClass([self class]), _id, _trackAttributes]; + return descriptionString; +} + +@end + +@implementation MCApplicationBasicClusterApplicationStruct +- (instancetype)init +{ + if (self = [super init]) { + + _catalogVendorID = @(0); + + _applicationID = @""; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCApplicationBasicClusterApplicationStruct alloc] init]; + + other.catalogVendorID = self.catalogVendorID; + other.applicationID = self.applicationID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: catalogVendorID:%@; applicationID:%@; >", NSStringFromClass([self class]), _catalogVendorID, _applicationID]; + return descriptionString; +} + +- (void)setCatalogVendorId:(NSNumber * _Nonnull)catalogVendorId +{ + self.catalogVendorID = catalogVendorId; +} + +- (NSNumber * _Nonnull)catalogVendorId +{ + return self.catalogVendorID; +} + +- (void)setApplicationId:(NSString * _Nonnull)applicationId +{ + self.applicationID = applicationId; +} + +- (NSString * _Nonnull)applicationId +{ + return self.applicationID; +} + +@end + +@implementation MCApplicationBasicClusterApplicationBasicApplication : MCApplicationBasicClusterApplicationStruct +@end + +@implementation MCTargetNavigatorClusterTargetInfoStruct +- (instancetype)init +{ + if (self = [super init]) { + + _identifier = @(0); + + _name = @""; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCTargetNavigatorClusterTargetInfoStruct alloc] init]; + + other.identifier = self.identifier; + other.name = self.name; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: identifier:%@; name:%@; >", NSStringFromClass([self class]), _identifier, _name]; + return descriptionString; +} + +@end + +@implementation MCTargetNavigatorClusterTargetInfo : MCTargetNavigatorClusterTargetInfoStruct +@dynamic identifier; +@dynamic name; +@end + +@implementation MCApplicationLauncherClusterApplicationStruct +- (instancetype)init +{ + if (self = [super init]) { + + _catalogVendorID = @(0); + + _applicationID = @""; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCApplicationLauncherClusterApplicationStruct alloc] init]; + + other.catalogVendorID = self.catalogVendorID; + other.applicationID = self.applicationID; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: catalogVendorID:%@; applicationID:%@; >", NSStringFromClass([self class]), _catalogVendorID, _applicationID]; + return descriptionString; +} + +- (void)setCatalogVendorId:(NSNumber * _Nonnull)catalogVendorId +{ + self.catalogVendorID = catalogVendorId; +} + +- (NSNumber * _Nonnull)catalogVendorId +{ + return self.catalogVendorID; +} + +- (void)setApplicationId:(NSString * _Nonnull)applicationId +{ + self.applicationID = applicationId; +} + +- (NSString * _Nonnull)applicationId +{ + return self.applicationID; +} + +@end + +@implementation MCApplicationLauncherClusterApplication : MCApplicationLauncherClusterApplicationStruct +@end + +@implementation MCApplicationLauncherClusterApplicationEPStruct +- (instancetype)init +{ + if (self = [super init]) { + + _application = [MCApplicationLauncherClusterApplicationStruct new]; + + _endpoint = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MCApplicationLauncherClusterApplicationEPStruct alloc] init]; + + other.application = self.application; + other.endpoint = self.endpoint; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: application:%@; endpoint:%@; >", NSStringFromClass([self class]), _application, _endpoint]; + return descriptionString; +} + +@end + +@implementation MCApplicationLauncherClusterApplicationEP : MCApplicationLauncherClusterApplicationEPStruct +@dynamic application; +@dynamic endpoint; +@end diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 0e0b2b6dda93ec..53729ff4467b49 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -424,6 +424,7 @@ def getSpecificTemplatesTargets(): 'src/controller/python/templates/templates.json': None, 'src/darwin/Framework/CHIP/templates/templates.json': None, 'src/controller/java/templates/templates.json': None, + 'examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json': None, } targets = []