From 8d337bdb20a0b9e7a2cabb395416ed131d1e0e61 Mon Sep 17 00:00:00 2001 From: Philip Gregor Date: Mon, 19 Feb 2024 11:53:50 -0800 Subject: [PATCH] zap generation 2 --- .../project.pbxproj | 24 +- .../MatterTvCastingBridge/MCAttribute.mm | 2 +- .../MCAttributeObjects.h | 30 - .../MCAttributeObjects.mm | 109 - .../MCAttribute_Internal.h | 16 +- .../MatterTvCastingBridge/MCClusterObjects.h | 2 +- .../templates/MCAttributeObjects-src.zapt | 54 +- .../templates/MCAttributeObjects.zapt | 30 +- ...pt => MCAttributeTLVValueDecoder-src.zapt} | 0 .../templates/MCClusterObjects-src.zapt | 24 +- .../templates/MCClusterObjects.zapt | 20 +- .../templates/MCCommandObjects-src.zapt | 23 +- .../templates/MCCommandObjects.zapt | 21 +- .../templates/aaa_TEST.zapt | 9 - .../templates/partials/decode_value.zapt | 6 +- .../templates/templates.json | 29 +- .../zap-generated/Header.h | 12 + .../zap-generated/MCAttributeObjects.h | 52 +- .../zap-generated/MCAttributeObjects.mm | 5530 +++++++---------- ...coder.mm => MCAttributeTLVValueDecoder.mm} | 424 +- .../zap-generated/MCClusterObjects.h | 17 - .../zap-generated/MCClusterObjects.mm | 21 - .../zap-generated/MCCommandObjects.h | 17 - .../zap-generated/MCCommandObjects.m | 8 + .../zap-generated/MCCommandObjects.mm | 20 - 25 files changed, 2466 insertions(+), 4034 deletions(-) delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.h delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.mm rename examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/{MTRAttributeTLVValueDecoder-src.zapt => MCAttributeTLVValueDecoder-src.zapt} (100%) delete mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/aaa_TEST.zapt create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/Header.h rename examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/{MTRAttributeTLVValueDecoder.mm => MCAttributeTLVValueDecoder.mm} (97%) create mode 100644 examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.m 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 d6b0648048a27b..c5a0f8186a5569 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj @@ -9,6 +9,10 @@ /* Begin PBXBuildFile section */ 3907B30D2B7C3CDA00EBD369 /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3907B30C2B7C3CDA00EBD369 /* MCAttributeObjects.mm */; }; 3907B30F2B7C3D0900EBD369 /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 3907B30E2B7C3D0900EBD369 /* MCAttributeObjects.h */; }; + 39CEEF162B7D7EB2007EFC1C /* MCClusterObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39CEEF152B7D7EB2007EFC1C /* MCClusterObjects.h */; }; + 39CEEF1A2B7D800B007EFC1C /* MCClusterObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39CEEF192B7D800B007EFC1C /* MCClusterObjects.mm */; }; + 39CEEF1C2B7D80A4007EFC1C /* MCCommandObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39CEEF1B2B7D80A4007EFC1C /* MCCommandObjects.mm */; }; + 39CEEF202B7D80D0007EFC1C /* MCCommandObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 39CEEF1F2B7D80D0007EFC1C /* MCCommandObjects.h */; }; 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 */; }; @@ -44,8 +48,6 @@ 3C621CA72B605AA1005CDBA3 /* MCObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C621CA62B605AA1005CDBA3 /* MCObserver.h */; }; 3C621CA92B605C52005CDBA3 /* MCAttribute_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C621CA82B605C52005CDBA3 /* MCAttribute_Internal.h */; }; 3C621CAB2B605C6E005CDBA3 /* MCAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C621CAA2B605C6E005CDBA3 /* MCAttribute.mm */; }; - 3C621CAD2B605E94005CDBA3 /* MCAttributeObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C621CAC2B605E94005CDBA3 /* MCAttributeObjects.h */; }; - 3C621CAF2B605EA7005CDBA3 /* MCAttributeObjects.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C621CAE2B605EA7005CDBA3 /* MCAttributeObjects.mm */; }; 3C66FBFC290327BB00B63FE7 /* AppParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C66FBFB290327BB00B63FE7 /* AppParameters.mm */; }; 3C6920462AA1093300D0F613 /* MCDeviceAttestationCredentialsProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C6920452AA1093300D0F613 /* MCDeviceAttestationCredentialsProvider.h */; }; 3C6920482AA1094000D0F613 /* MCDeviceAttestationCredentialsProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C6920472AA1094000D0F613 /* MCDeviceAttestationCredentialsProvider.mm */; }; @@ -84,6 +86,10 @@ /* Begin PBXFileReference section */ 3907B30C2B7C3CDA00EBD369 /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = ""; }; 3907B30E2B7C3D0900EBD369 /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = ""; }; + 39CEEF152B7D7EB2007EFC1C /* MCClusterObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCClusterObjects.h; sourceTree = ""; }; + 39CEEF192B7D800B007EFC1C /* MCClusterObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCClusterObjects.mm; sourceTree = ""; }; + 39CEEF1B2B7D80A4007EFC1C /* MCCommandObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCCommandObjects.mm; sourceTree = ""; }; + 39CEEF1F2B7D80D0007EFC1C /* MCCommandObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCCommandObjects.h; 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 = ""; }; @@ -124,8 +130,6 @@ 3C621CA62B605AA1005CDBA3 /* MCObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCObserver.h; sourceTree = ""; }; 3C621CA82B605C52005CDBA3 /* MCAttribute_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttribute_Internal.h; sourceTree = ""; }; 3C621CAA2B605C6E005CDBA3 /* MCAttribute.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttribute.mm; sourceTree = ""; }; - 3C621CAC2B605E94005CDBA3 /* MCAttributeObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCAttributeObjects.h; sourceTree = ""; usesTabs = 0; }; - 3C621CAE2B605EA7005CDBA3 /* MCAttributeObjects.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MCAttributeObjects.mm; sourceTree = ""; }; 3C66FBFA2903279A00B63FE7 /* AppParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppParameters.h; sourceTree = ""; }; 3C66FBFB290327BB00B63FE7 /* AppParameters.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppParameters.mm; sourceTree = ""; }; 3C6920452AA1093300D0F613 /* MCDeviceAttestationCredentialsProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MCDeviceAttestationCredentialsProvider.h; sourceTree = ""; }; @@ -186,6 +190,10 @@ children = ( 3907B30C2B7C3CDA00EBD369 /* MCAttributeObjects.mm */, 3907B30E2B7C3D0900EBD369 /* MCAttributeObjects.h */, + 39CEEF152B7D7EB2007EFC1C /* MCClusterObjects.h */, + 39CEEF192B7D800B007EFC1C /* MCClusterObjects.mm */, + 39CEEF1B2B7D80A4007EFC1C /* MCCommandObjects.mm */, + 39CEEF1F2B7D80D0007EFC1C /* MCCommandObjects.h */, ); path = "zap-generated"; sourceTree = ""; @@ -261,8 +269,6 @@ 3C4F52352B5733A200BB8A10 /* MCClusterObjects.mm */, 3C621CA02B5F6CF8005CDBA3 /* MCCommandObjects.h */, 3C621CA22B5F6D08005CDBA3 /* MCCommandObjects.mm */, - 3C621CAC2B605E94005CDBA3 /* MCAttributeObjects.h */, - 3C621CAE2B605EA7005CDBA3 /* MCAttributeObjects.mm */, 3C4F521F2B507C4A00BB8A10 /* MCEndpointClusterType.h */, 3C4F52132B4F31DC00BB8A10 /* MCDeviceTypeStruct.h */, 3C4F52152B4F31FA00BB8A10 /* MCDeviceTypeStruct.m */, @@ -332,6 +338,8 @@ 3CD6D01A298CDA2100D7569A /* CommissionerDiscoveryDelegateImpl.h in Headers */, 3CF71C0E2A992DA2003A5CE5 /* MCDataSource.h in Headers */, 3C4F52142B4F31DC00BB8A10 /* MCDeviceTypeStruct.h in Headers */, + 39CEEF162B7D7EB2007EFC1C /* MCClusterObjects.h in Headers */, + 39CEEF202B7D80D0007EFC1C /* MCCommandObjects.h in Headers */, 3C26AC8C2926FE0C00BA6881 /* DeviceAttestationCredentialsProviderImpl.hpp in Headers */, 3C621CA52B605A6A005CDBA3 /* MCAttribute.h in Headers */, 3CD73F1C2A9E8396009D82D1 /* MCCommissionableDataProvider.h in Headers */, @@ -360,7 +368,6 @@ 3C621CA12B5F6CF8005CDBA3 /* MCCommandObjects.h in Headers */, 3C4F52202B507C4A00BB8A10 /* MCEndpointClusterType.h in Headers */, 3C6920462AA1093300D0F613 /* MCDeviceAttestationCredentialsProvider.h in Headers */, - 3C621CAD2B605E94005CDBA3 /* MCAttributeObjects.h in Headers */, 3C04740C2B4604CF0012AE95 /* MCCryptoUtils.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -461,6 +468,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 39CEEF1A2B7D800B007EFC1C /* MCClusterObjects.mm in Sources */, 3CCB8743286A593700771BAD /* CastingServerBridge.mm in Sources */, 3C4E53B228E5184C00F293E8 /* TargetNavigatorTypes.mm in Sources */, 3C6920482AA1094000D0F613 /* MCDeviceAttestationCredentialsProvider.mm in Sources */, @@ -474,13 +482,13 @@ 3C621CA32B5F6D08005CDBA3 /* MCCommandObjects.mm in Sources */, 3CF71C0C2A992D25003A5CE5 /* MCCastingApp.mm in Sources */, 3C621CAB2B605C6E005CDBA3 /* MCAttribute.mm in Sources */, + 39CEEF1C2B7D80A4007EFC1C /* MCCommandObjects.mm in Sources */, 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 */, - 3C621CAF2B605EA7005CDBA3 /* MCAttributeObjects.mm in Sources */, 3C2346252B362BBB00FA276E /* MCCastingPlayerDiscovery.mm in Sources */, 3C4F52242B507CA800BB8A10 /* MCCluster.mm in Sources */, 3C66FBFC290327BB00B63FE7 /* AppParameters.mm in Sources */, diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute.mm index 09397ab86f7060..967bb795837062 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute.mm @@ -42,7 +42,7 @@ - (void)write:(id _Nonnull)value withCompletionBlock:(void (^_Nonnull __strong)( { } -- (id _Nullable)getObjTypeFromCpp:(std::any)cppValue +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue { return nil; } diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.h deleted file mode 100644 index d8f371ee1eebbe..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.h +++ /dev/null @@ -1,30 +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 "MCAttribute.h" -#import - -#ifndef MCAttributeObjects_h -#define MCAttributeObjects_h - -@interface MCApplicationBasicClusterVendorIDAttribute : MCAttribute -@end - -@interface MCMediaPlaybackClusterCurrentStateAttribute : MCAttribute -@end - -#endif /* MCAttributeObjects_h */ diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.mm deleted file mode 100644 index 5ce91d5ec781bb..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttributeObjects.mm +++ /dev/null @@ -1,109 +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 "MCAttributeObjects.h" - -#import "MCAttribute_Internal.h" -#import "MCCastingApp.h" -#import "MCErrorUtils.h" - -#include "core/Attribute.h" -#include - -#import - -@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, - [self](std::any cppValue) { - return [self getObjTypeFromCpp:cppValue]; - }); - 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) { - return [self getObjTypeFromCpp:cppValue]; - }); - mcAttribute->subscribe( - context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { - completion(context, before, after, err); - delete mcAttribute; - }, minInterval, maxInterval); -} - -- (id _Nullable)getObjTypeFromCpp:(std::any)cppValue -{ - NSNumber * outValue = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - } - return outValue; -} -@end - -@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) { - return [self getObjTypeFromCpp:cppValue]; - }); - 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) { - return [self getObjTypeFromCpp:cppValue]; - }); - mcAttribute->subscribe( - context, [mcAttribute, completion](void * context, id before, id after, NSError * err) { - completion(context, before, after, err); - delete mcAttribute; - }, minInterval, maxInterval); -} - -- (id _Nullable)getObjTypeFromCpp:(std::any)cppValue -{ - NSNumber * outValue = nil; - if (cppValue.type() == typeid(std::shared_ptr)) { - std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:static_cast(*valueSharedPtr)] : nil; - } - return outValue; -} -@end diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute_Internal.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute_Internal.h index 9a0c7e0385f515..e30f06c2d0575c 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute_Internal.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCAttribute_Internal.h @@ -36,7 +36,7 @@ - (instancetype _Nonnull)initWithCppAttribute:(void * _Nonnull)cppAttribute; -- (id _Nullable)getObjTypeFromCpp:(std::any)cppValue; +- (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR * _Nonnull)aError; @end @@ -44,10 +44,10 @@ template class MCAttributeTemplate { public: MCAttributeTemplate(void * _Nonnull cppAttribute, - std::function getObjTypeFromCppFn) + std::function getObjCTypeFromCppFn) { mCppAttribute = cppAttribute; - mGetObjTypeFromCppFn = getObjTypeFromCppFn; + mgetObjCTypeFromCppFn = getObjCTypeFromCppFn; } void read(void * _Nullable context, std::function completion) @@ -63,11 +63,11 @@ class MCAttributeTemplate { if (before.HasValue()) { ChipLogProgress(AppServer, " converting 'before' value from Cpp to ObjC"); std::any anyBefore = std::any(std::make_shared(before.Value())); - objCBefore = mGetObjTypeFromCppFn(anyBefore); + objCBefore = mgetObjCTypeFromCppFn(anyBefore); } ChipLogProgress(AppServer, " converting 'after' value from Cpp to ObjC"); std::any anyAfter = std::any(std::make_shared(after)); - objCAfter = mGetObjTypeFromCppFn(anyAfter); + objCAfter = mgetObjCTypeFromCppFn(anyAfter); dispatch_async(clientQueue, ^{ completion(context, objCBefore, objCAfter, nil); }); @@ -94,11 +94,11 @@ class MCAttributeTemplate { if (before.HasValue()) { ChipLogProgress(AppServer, " converting 'before' value from Cpp to ObjC"); std::any anyBefore = std::any(std::make_shared(before.Value())); - objCBefore = mGetObjTypeFromCppFn(anyBefore); + objCBefore = mgetObjCTypeFromCppFn(anyBefore); } ChipLogProgress(AppServer, " converting 'after' value from Cpp to ObjC"); std::any anyAfter = std::any(std::make_shared(after)); - objCAfter = mGetObjTypeFromCppFn(anyAfter); + objCAfter = mgetObjCTypeFromCppFn(anyAfter); dispatch_async(clientQueue, ^{ completion(context, objCBefore, objCAfter, nil); }); @@ -115,6 +115,6 @@ class MCAttributeTemplate { private: void * _Nonnull mCppAttribute; - std::function mGetObjTypeFromCppFn; + std::function mgetObjCTypeFromCppFn; }; #endif /* MCAttribute_Internal_h */ diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h index 290b747702e272..836566e74ba2e5 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/MCClusterObjects.h @@ -15,7 +15,7 @@ * limitations under the License. */ -#import "MCAttributeObjects.h" +#import "zap-generated/MCAttributeObjects.h" #import "MCCluster.h" #import "MCCommandObjects.h" #import 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 361497a38c813c..638be569c6cfa1 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 @@ -1,10 +1,5 @@ {{> header excludeZapComment=false}} -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - #import "MCAttributeObjects.h" #import "MCAttribute_Internal.h" @@ -22,21 +17,18 @@ {{#zcl_clusters}} {{#if (isInConfigList name "MatterCastingClusters")}} -{{#zcl_attributes_server}} + +// {{asUpperCamelCase name preserveAcronyms=true}} cluster attributes: + +{{#zcl_attributes_server removeKeys='isOptional'}} {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} @implementation MC{{asUpperCamelCase ../name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Attribute - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -46,18 +38,12 @@ - (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:({{asObjectiveCClass type ../name}} * _Nonnull)minInterval - maxInterval:({{asObjectiveCClass type ../name}} * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -68,16 +54,16 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - //{{asObjectiveCClass type ../name}} * outValue = nil; - //if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [{{asObjectiveCClass type ../name}} numberWithUnsignedInteger:*valueSharedPtr] : nil; - //} - //return outValue; - - *aError = CHIP_NO_ERROR; - {{asObjectiveCType type parent.name}} value; - {{>decode_value target="value" source="cppValue" cluster=parent.name errorCode="*aError = err; return nil;" depth=0}} + {{asObjectiveCClass type ../name structTypePrefix="MC"}} * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto& valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + {{asObjectiveCType type parent.name structTypePrefix="MC"}} value; + {{>decode_value target="value" source="valueSharedPtr" cluster=parent.name errorCode="*aError = err; return nil;" depth=0}} + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end 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 d8d68a34d21a9e..f15ec28521d804 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeObjects.zapt @@ -1,21 +1,39 @@ {{> header excludeZapComment=false}} -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - #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 MCMediaPlaybackClusterTrackStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +@interface MCApplicationLauncherClusterApplicationEPStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +@interface MCApplicationBasicClusterApplicationStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + {{#zcl_clusters}} {{#if (isInConfigList name "MatterCastingClusters")}} + +// {{asUpperCamelCase name preserveAcronyms=true}} cluster attributes: + {{#zcl_attributes_server}} {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} -@interface MC{{asUpperCamelCase ../name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Attribute : MCAttribute <{{asObjectiveCClass type ../name}} *> +@interface MC{{asUpperCamelCase ../name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Attribute : MCAttribute <{{asObjectiveCClass type ../name structTypePrefix="MC"}} *> @end {{/if}} diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeTLVValueDecoder-src.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt similarity index 100% rename from examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MTRAttributeTLVValueDecoder-src.zapt rename to examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCAttributeTLVValueDecoder-src.zapt 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 3532e86f6d9f98..d47ec86aec602f 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,23 +1 @@ -{{> header excludeZapComment=false}} - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - -#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 - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ No newline at end of file +{{> header excludeZapComment=false}} \ 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 8565a3ae619821..d47ec86aec602f 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCClusterObjects.zapt @@ -1,19 +1 @@ -{{> header excludeZapComment=false}} - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - -#import "MCAttributeObjects.h" -#import "MCCluster.h" -#import "MCCommandObjects.h" -#import - -#ifndef MCClusterObjects_h -#define MCClusterObjects_h - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ No newline at end of file +{{> header excludeZapComment=false}} \ 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 c3c7d34e65d1f4..d47ec86aec602f 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,22 +1 @@ -{{> header excludeZapComment=false}} - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - -#import "MCCommandObjects.h" - -#import "MCCastingApp.h" -#import "MCCommand_Internal.h" -#import "MCErrorUtils.h" - -#include "core/Command.h" -#include - -#import - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ No newline at end of file +{{> header excludeZapComment=false}} \ 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 169ee8bebdc865..d47ec86aec602f 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/MCCommandObjects.zapt @@ -1,20 +1 @@ -{{> header excludeZapComment=false}} - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - - -#import "MCCommand.h" -#import - -#ifndef MCCommandObjects_h -#define MCCommandObjects_h - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR - - -#endif /* MCClusterObjects_h */ \ No newline at end of file +{{> header excludeZapComment=false}} \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/aaa_TEST.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/aaa_TEST.zapt deleted file mode 100644 index c5790da1795a81..00000000000000 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/aaa_TEST.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/partials/decode_value.zapt b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/partials/decode_value.zapt index 16a9acbc6d4048..2900ce04a0561d 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/partials/decode_value.zapt +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/partials/decode_value.zapt @@ -16,7 +16,7 @@ auto iter_{{depth}} = {{source}}.begin(); while (iter_{{depth}}.Next()) { auto & entry_{{depth}} = iter_{{depth}}.GetValue(); - {{asObjectiveCClass type cluster forceNotList=true}} * newElement_{{depth}}; + {{asObjectiveCClass type cluster forceNotList=true structTypePrefix="MC"}} * newElement_{{depth}}; {{>decode_value target=(concat "newElement_" depth) source=(concat "entry_" depth) cluster=cluster errorCode=errorCode depth=(incrementDepth depth) isArray=false}} [array_{{depth}} addObject:newElement_{{depth}}]; } @@ -28,7 +28,7 @@ } {{else}} {{#if_is_struct type}} - {{target}} = [{{asObjectiveCClass type cluster forceNotList=true}} new]; + {{target}} = [{{asObjectiveCClass type cluster forceNotList=true structTypePrefix="MC"}} new]; {{#zcl_struct_items_by_struct_and_cluster_name type cluster}} {{#if (isSupported (asUpperCamelCase ../cluster preserveAcronyms=true) struct=(asUpperCamelCase ../type preserveAcronyms=true) structField=(asStructPropertyName label))}} {{>decode_value target=(concat ../target "." (asStructPropertyName label)) source=(concat ../source "." (asLowerCamelCase label)) cluster=../cluster errorCode=../errorCode depth=(incrementDepth ../depth) }} @@ -39,7 +39,7 @@ {{target}} = [NSNumber numberWith{{asObjectiveCNumberType "" type false}}:chip::to_underlying({{source}})]; {{else}} {{#if_is_strongly_typed_bitmap type}} - {{target}} = [NSNumber numberWith{{asObjectiveCNumberType "" type false}}:{{source}}.Raw()]; + {{target}} = [NSNumber numberWith{{asObjectiveCNumberType "" type false}}:{{source}}.Raw()]; {{else if (isOctetString type)}} {{target}} = AsData({{source}}); {{else if (isCharString type)}} 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 ef9e1b4fe73d49..715bbe005a4af2 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/templates/templates.json @@ -51,9 +51,19 @@ ], "templates": [ { - "path": "aaa_TEST.zapt", + "path": "MCAttributeObjects.zapt", + "name": "Objc ZCL asynchronous API Internal Header", + "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h" + }, + { + "path": "MCAttributeObjects-src.zapt", "name": "Objc ZCL asynchronous API Internal Header", - "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/aaa_TEST.h" + "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm" + }, + { + "path": "MCAttributeTLVValueDecoder-src.zapt", + "name": "Decode TLV attribute values into Objc objects", + "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeTLVValueDecoder.mm" }, { "path": "MCClusterObjects.zapt", @@ -74,21 +84,6 @@ "path": "MCCommandObjects-src.zapt", "name": "Objc ZCL asynchronous API Internal Header", "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.mm" - }, - { - "path": "MCAttributeObjects.zapt", - "name": "Objc ZCL asynchronous API Internal Header", - "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.h" - }, - { - "path": "MCAttributeObjects-src.zapt", - "name": "Objc ZCL asynchronous API Internal Header", - "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeObjects.mm" - }, - { - "path": "MTRAttributeTLVValueDecoder-src.zapt", - "name": "Decode TLV attribute values into Objc objects", - "output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MTRAttributeTLVValueDecoder.mm" } ] } \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/Header.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/Header.h new file mode 100644 index 00000000000000..b02f4aac241017 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/Header.h @@ -0,0 +1,12 @@ +// +// Header.h +// MatterTvCastingBridge +// +// Created by Gregor, Philip on 2/14/24. +// + +#ifndef Header_h +#define Header_h + + +#endif /* Header_h */ 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 115ef15bd4464f..9a818f1306e51e 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,16 +17,34 @@ // THIS FILE IS GENERATED BY ZAP -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - #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 MCMediaPlaybackClusterTrackStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +@interface MCApplicationLauncherClusterApplicationEPStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +@interface MCApplicationBasicClusterApplicationStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull updatedAt; +@property (nonatomic, copy) NSNumber * _Nullable position; +@end + +// OnOff cluster attributes: + @interface MCOnOffClusterOnOffAttribute : MCAttribute @end @@ -60,6 +78,8 @@ @interface MCOnOffClusterClusterRevisionAttribute : MCAttribute @end +// LevelControl cluster attributes: + @interface MCLevelControlClusterCurrentLevelAttribute : MCAttribute @end @@ -120,6 +140,8 @@ @interface MCLevelControlClusterClusterRevisionAttribute : MCAttribute @end +// WakeOnLAN cluster attributes: + @interface MCWakeOnLANClusterMACAddressAttribute : MCAttribute @end @@ -144,6 +166,8 @@ @interface MCWakeOnLANClusterClusterRevisionAttribute : MCAttribute @end +// TargetNavigator cluster attributes: + @interface MCTargetNavigatorClusterTargetListAttribute : MCAttribute @end @@ -168,6 +192,8 @@ @interface MCTargetNavigatorClusterClusterRevisionAttribute : MCAttribute @end +// MediaPlayback cluster attributes: + @interface MCMediaPlaybackClusterCurrentStateAttribute : MCAttribute @end @@ -177,7 +203,7 @@ @interface MCMediaPlaybackClusterDurationAttribute : MCAttribute @end -@interface MCMediaPlaybackClusterSampledPositionAttribute : MCAttribute +@interface MCMediaPlaybackClusterSampledPositionAttribute : MCAttribute @end @interface MCMediaPlaybackClusterPlaybackSpeedAttribute : MCAttribute @@ -189,13 +215,13 @@ @interface MCMediaPlaybackClusterSeekRangeStartAttribute : MCAttribute @end -@interface MCMediaPlaybackClusterActiveAudioTrackAttribute : MCAttribute +@interface MCMediaPlaybackClusterActiveAudioTrackAttribute : MCAttribute @end @interface MCMediaPlaybackClusterAvailableAudioTracksAttribute : MCAttribute @end -@interface MCMediaPlaybackClusterActiveTextTrackAttribute : MCAttribute +@interface MCMediaPlaybackClusterActiveTextTrackAttribute : MCAttribute @end @interface MCMediaPlaybackClusterAvailableTextTracksAttribute : MCAttribute @@ -219,6 +245,8 @@ @interface MCMediaPlaybackClusterClusterRevisionAttribute : MCAttribute @end +// KeypadInput cluster attributes: + @interface MCKeypadInputClusterGeneratedCommandListAttribute : MCAttribute @end @@ -237,6 +265,8 @@ @interface MCKeypadInputClusterClusterRevisionAttribute : MCAttribute @end +// ContentLauncher cluster attributes: + @interface MCContentLauncherClusterAcceptHeaderAttribute : MCAttribute @end @@ -261,10 +291,12 @@ @interface MCContentLauncherClusterClusterRevisionAttribute : MCAttribute @end +// ApplicationLauncher cluster attributes: + @interface MCApplicationLauncherClusterCatalogListAttribute : MCAttribute @end -@interface MCApplicationLauncherClusterCurrentAppAttribute : MCAttribute +@interface MCApplicationLauncherClusterCurrentAppAttribute : MCAttribute @end @interface MCApplicationLauncherClusterGeneratedCommandListAttribute : MCAttribute @@ -285,6 +317,8 @@ @interface MCApplicationLauncherClusterClusterRevisionAttribute : MCAttribute @end +// ApplicationBasic cluster attributes: + @interface MCApplicationBasicClusterVendorNameAttribute : MCAttribute @end @@ -297,7 +331,7 @@ @interface MCApplicationBasicClusterProductIDAttribute : MCAttribute @end -@interface MCApplicationBasicClusterApplicationAttribute : MCAttribute +@interface MCApplicationBasicClusterApplicationAttribute : MCAttribute @end @interface MCApplicationBasicClusterStatusAttribute : MCAttribute 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 bb3d3d99bcbbff..d36e06c9de0630 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 @@ -17,10 +17,6 @@ // THIS FILE IS GENERATED BY ZAP -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - #import "MCAttributeObjects.h" #import "MCAttribute_Internal.h" @@ -32,19 +28,15 @@ #import +// OnOff cluster attributes: + @implementation MCOnOffClusterOnOffAttribute - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -58,14 +50,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -76,16 +62,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -95,14 +81,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -116,14 +96,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -134,20 +108,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithBool:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -157,14 +127,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -178,14 +142,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -196,20 +154,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -219,14 +173,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -240,14 +188,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -258,20 +200,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -281,14 +219,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -302,14 +234,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -320,24 +246,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().Value())]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(valueSharedPtr.Value())]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -347,14 +269,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -364,18 +280,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -386,31 +296,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -420,14 +330,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -437,18 +341,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -459,31 +357,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -493,14 +391,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -510,18 +402,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -532,31 +418,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -566,14 +452,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -583,18 +463,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -605,31 +479,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -639,14 +513,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -660,14 +528,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -678,16 +540,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -697,14 +559,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -718,14 +574,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -736,33 +586,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end +// LevelControl cluster attributes: + @implementation MCLevelControlClusterCurrentLevelAttribute - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -776,14 +622,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -794,20 +634,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:valueSharedPtr.Value()]; + } + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -817,14 +657,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -838,14 +672,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -856,20 +684,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -879,14 +703,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -900,14 +718,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -918,20 +730,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -941,14 +749,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -962,14 +764,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -980,20 +776,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1003,14 +795,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1024,14 +810,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1042,20 +822,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1065,14 +841,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1086,14 +856,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1104,20 +868,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1127,14 +887,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1148,14 +902,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1166,20 +914,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1189,14 +933,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1210,14 +948,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1228,16 +960,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr.Raw()]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1247,14 +979,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1268,14 +994,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1286,20 +1006,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1309,14 +1025,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1330,14 +1040,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1348,20 +1052,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:valueSharedPtr.Value()]; + } + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1371,14 +1075,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1392,14 +1090,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1410,24 +1102,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1437,14 +1125,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1458,14 +1140,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1476,24 +1152,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1503,14 +1175,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1524,14 +1190,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1542,24 +1202,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1569,14 +1225,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1590,14 +1240,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1608,24 +1252,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1635,14 +1275,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1652,18 +1286,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1674,31 +1302,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1708,14 +1336,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1725,18 +1347,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1747,31 +1363,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1781,14 +1397,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1798,18 +1408,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1820,31 +1424,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1854,14 +1458,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1871,18 +1469,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1893,31 +1485,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1927,14 +1519,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -1948,14 +1534,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -1966,16 +1546,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -1985,14 +1565,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2006,14 +1580,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2024,33 +1592,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end +// WakeOnLAN cluster attributes: + @implementation MCWakeOnLANClusterMACAddressAttribute - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2060,18 +1624,12 @@ - (void)read:(void * _Nullable)context - (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:(NSString * _Nonnull)minInterval - maxInterval:(NSString * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2082,25 +1640,21 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSString * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSString numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSString * _Nullable value; - if (cppValue.HasValue()) { - value = AsString(cppValue.Value()); + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSString * _Nonnull value; + value = AsString(valueSharedPtr); if (value == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2110,14 +1664,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2127,18 +1675,12 @@ - (void)read:(void * _Nullable)context - (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:(NSData * _Nonnull)minInterval - maxInterval:(NSData * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2149,20 +1691,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSData * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSData numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSData * _Nullable value; - if (cppValue.HasValue()) { - value = AsData(cppValue.Value()); - } else { - value = nil; + NSData * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSData * _Nonnull value; + value = AsData(valueSharedPtr); + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2172,14 +1710,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2189,18 +1721,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2211,31 +1737,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2245,14 +1771,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2262,18 +1782,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2284,31 +1798,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2318,14 +1832,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2335,18 +1843,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2357,31 +1859,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2391,14 +1893,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2408,18 +1904,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2430,31 +1920,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2464,14 +1954,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2485,14 +1969,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2503,16 +1981,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2522,14 +2000,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2543,14 +2015,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2561,33 +2027,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2597,18 +2059,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2619,38 +2075,38 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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(); - MTRTargetNavigatorClusterTargetInfoStruct * newElement_0; - newElement_0 = [MTRTargetNavigatorClusterTargetInfoStruct 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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + value = array_0; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2660,14 +2116,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2681,14 +2131,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2699,20 +2143,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2722,14 +2162,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2739,18 +2173,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2761,31 +2189,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2795,14 +2223,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2812,18 +2234,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2834,31 +2250,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2868,14 +2284,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2885,18 +2295,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2907,31 +2311,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -2941,14 +2345,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -2958,18 +2356,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -2980,31 +2372,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3014,14 +2406,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3035,14 +2421,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3053,16 +2433,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3072,14 +2452,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3093,14 +2467,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3111,33 +2479,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + 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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3151,14 +2515,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3169,16 +2527,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(valueSharedPtr)]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3188,14 +2546,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3209,14 +2561,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3227,24 +2573,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3254,14 +2596,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3275,14 +2611,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3293,24 +2623,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3320,14 +2646,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3337,18 +2657,12 @@ - (void)read:(void * _Nullable)context - (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:(MTRMediaPlaybackClusterPlaybackPositionStruct * _Nonnull)minInterval - maxInterval:(MTRMediaPlaybackClusterPlaybackPositionStruct * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3359,30 +2673,26 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // MTRMediaPlaybackClusterPlaybackPositionStruct * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [MTRMediaPlaybackClusterPlaybackPositionStruct numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - MTRMediaPlaybackClusterPlaybackPositionStruct * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + MCMediaPlaybackClusterPlaybackPositionStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterPlaybackPositionStruct * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterPlaybackPositionStruct new]; - value.updatedAt = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value().updatedAt]; - if (cppValue.Value().Value().position.IsNull()) { + value = [MCMediaPlaybackClusterPlaybackPositionStruct new]; + value.updatedAt = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value().updatedAt]; + if (valueSharedPtr.Value().position.IsNull()) { value.position = nil; } else { - value.position = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value().position.Value()]; + value.position = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value().position.Value()]; } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3392,14 +2702,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3413,14 +2717,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3431,20 +2729,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithFloat:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithFloat:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3454,14 +2748,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3475,14 +2763,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3493,24 +2775,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3520,14 +2798,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3541,14 +2813,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3559,24 +2825,20 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Value()]; + value = [NSNumber numberWithUnsignedLongLong:valueSharedPtr.Value()]; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3586,14 +2848,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3603,18 +2859,12 @@ - (void)read:(void * _Nullable)context - (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:(MTRMediaPlaybackClusterTrackStruct * _Nonnull)minInterval - maxInterval:(MTRMediaPlaybackClusterTrackStruct * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3625,41 +2875,37 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // MTRMediaPlaybackClusterTrackStruct * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [MTRMediaPlaybackClusterTrackStruct numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - MTRMediaPlaybackClusterTrackStruct * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + MCMediaPlaybackClusterTrackStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterTrackStruct * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterTrackStruct new]; - value.id = AsString(cppValue.Value().Value().id); + value = [MCMediaPlaybackClusterTrackStruct new]; + value.id = AsString(valueSharedPtr.Value().id); if (value.id == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (cppValue.Value().Value().trackAttributes.IsNull()) { + if (valueSharedPtr.Value().trackAttributes.IsNull()) { value.trackAttributes = nil; } else { - value.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; - value.trackAttributes.languageCode = AsString(cppValue.Value().Value().trackAttributes.Value().languageCode); + value.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + value.trackAttributes.languageCode = AsString(valueSharedPtr.Value().trackAttributes.Value().languageCode); if (value.trackAttributes.languageCode == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (cppValue.Value().Value().trackAttributes.Value().displayName.HasValue()) { - if (cppValue.Value().Value().trackAttributes.Value().displayName.Value().IsNull()) { + if (valueSharedPtr.Value().trackAttributes.Value().displayName.HasValue()) { + if (valueSharedPtr.Value().trackAttributes.Value().displayName.Value().IsNull()) { value.trackAttributes.displayName = nil; } else { - value.trackAttributes.displayName = AsString(cppValue.Value().Value().trackAttributes.Value().displayName.Value().Value()); + value.trackAttributes.displayName = AsString(valueSharedPtr.Value().trackAttributes.Value().displayName.Value().Value()); if (value.trackAttributes.displayName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; @@ -3671,9 +2917,9 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3683,14 +2929,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3700,18 +2940,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3722,70 +2956,66 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSArray * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = cppValue.Value().Value().begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTRMediaPlaybackClusterTrackStruct * newElement_2; - newElement_2 = [MTRMediaPlaybackClusterTrackStruct new]; - newElement_2.id = AsString(entry_2.id); - if (newElement_2.id == nil) { + auto * array_1 = [NSMutableArray new]; + auto iter_1 = valueSharedPtr.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_2.trackAttributes.IsNull()) { - newElement_2.trackAttributes = nil; + if (entry_1.trackAttributes.IsNull()) { + newElement_1.trackAttributes = nil; } else { - newElement_2.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; - newElement_2.trackAttributes.languageCode = AsString(entry_2.trackAttributes.Value().languageCode); - if (newElement_2.trackAttributes.languageCode == nil) { + 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_2.trackAttributes.Value().displayName.HasValue()) { - if (entry_2.trackAttributes.Value().displayName.Value().IsNull()) { - newElement_2.trackAttributes.displayName = nil; + if (entry_1.trackAttributes.Value().displayName.HasValue()) { + if (entry_1.trackAttributes.Value().displayName.Value().IsNull()) { + newElement_1.trackAttributes.displayName = nil; } else { - newElement_2.trackAttributes.displayName = AsString(entry_2.trackAttributes.Value().displayName.Value().Value()); - if (newElement_2.trackAttributes.displayName == nil) { + 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_2.trackAttributes.displayName = nil; + newElement_1.trackAttributes.displayName = nil; } } - [array_2 addObject:newElement_2]; + [array_1 addObject:newElement_1]; } - CHIP_ERROR err = iter_2.GetStatus(); + CHIP_ERROR err = iter_1.GetStatus(); if (err != CHIP_NO_ERROR) { *aError = err; return nil; } - value = array_2; + value = array_1; } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3795,14 +3025,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3812,18 +3036,12 @@ - (void)read:(void * _Nullable)context - (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:(MTRMediaPlaybackClusterTrackStruct * _Nonnull)minInterval - maxInterval:(MTRMediaPlaybackClusterTrackStruct * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3834,41 +3052,37 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // MTRMediaPlaybackClusterTrackStruct * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [MTRMediaPlaybackClusterTrackStruct numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - MTRMediaPlaybackClusterTrackStruct * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + MCMediaPlaybackClusterTrackStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCMediaPlaybackClusterTrackStruct * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterTrackStruct new]; - value.id = AsString(cppValue.Value().Value().id); + value = [MCMediaPlaybackClusterTrackStruct new]; + value.id = AsString(valueSharedPtr.Value().id); if (value.id == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (cppValue.Value().Value().trackAttributes.IsNull()) { + if (valueSharedPtr.Value().trackAttributes.IsNull()) { value.trackAttributes = nil; } else { - value.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; - value.trackAttributes.languageCode = AsString(cppValue.Value().Value().trackAttributes.Value().languageCode); + value.trackAttributes = [MCMediaPlaybackClusterTrackAttributesStruct new]; + value.trackAttributes.languageCode = AsString(valueSharedPtr.Value().trackAttributes.Value().languageCode); if (value.trackAttributes.languageCode == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (cppValue.Value().Value().trackAttributes.Value().displayName.HasValue()) { - if (cppValue.Value().Value().trackAttributes.Value().displayName.Value().IsNull()) { + if (valueSharedPtr.Value().trackAttributes.Value().displayName.HasValue()) { + if (valueSharedPtr.Value().trackAttributes.Value().displayName.Value().IsNull()) { value.trackAttributes.displayName = nil; } else { - value.trackAttributes.displayName = AsString(cppValue.Value().Value().trackAttributes.Value().displayName.Value().Value()); + value.trackAttributes.displayName = AsString(valueSharedPtr.Value().trackAttributes.Value().displayName.Value().Value()); if (value.trackAttributes.displayName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; @@ -3880,9 +3094,9 @@ - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aE } } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -3892,14 +3106,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -3909,18 +3117,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -3931,70 +3133,66 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSArray * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = cppValue.Value().Value().begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTRMediaPlaybackClusterTrackStruct * newElement_2; - newElement_2 = [MTRMediaPlaybackClusterTrackStruct new]; - newElement_2.id = AsString(entry_2.id); - if (newElement_2.id == nil) { + auto * array_1 = [NSMutableArray new]; + auto iter_1 = valueSharedPtr.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_2.trackAttributes.IsNull()) { - newElement_2.trackAttributes = nil; + if (entry_1.trackAttributes.IsNull()) { + newElement_1.trackAttributes = nil; } else { - newElement_2.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; - newElement_2.trackAttributes.languageCode = AsString(entry_2.trackAttributes.Value().languageCode); - if (newElement_2.trackAttributes.languageCode == nil) { + 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_2.trackAttributes.Value().displayName.HasValue()) { - if (entry_2.trackAttributes.Value().displayName.Value().IsNull()) { - newElement_2.trackAttributes.displayName = nil; + if (entry_1.trackAttributes.Value().displayName.HasValue()) { + if (entry_1.trackAttributes.Value().displayName.Value().IsNull()) { + newElement_1.trackAttributes.displayName = nil; } else { - newElement_2.trackAttributes.displayName = AsString(entry_2.trackAttributes.Value().displayName.Value().Value()); - if (newElement_2.trackAttributes.displayName == nil) { + 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_2.trackAttributes.displayName = nil; + newElement_1.trackAttributes.displayName = nil; } } - [array_2 addObject:newElement_2]; + [array_1 addObject:newElement_1]; } - CHIP_ERROR err = iter_2.GetStatus(); + CHIP_ERROR err = iter_1.GetStatus(); if (err != CHIP_NO_ERROR) { *aError = err; return nil; } - value = array_2; + value = array_1; } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4004,14 +3202,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4021,18 +3213,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4043,31 +3229,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4077,14 +3263,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4094,18 +3274,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4116,31 +3290,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4150,14 +3324,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4167,18 +3335,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4189,31 +3351,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4223,14 +3385,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4240,18 +3396,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4262,31 +3412,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4296,14 +3446,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4317,14 +3461,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4335,16 +3473,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4354,14 +3492,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4375,14 +3507,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4393,33 +3519,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end +// KeypadInput cluster attributes: + @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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4429,18 +3551,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4451,31 +3567,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4485,14 +3601,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4502,18 +3612,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4524,31 +3628,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4558,14 +3662,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4575,18 +3673,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4597,31 +3689,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4631,14 +3723,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4648,18 +3734,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4670,31 +3750,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4704,14 +3784,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4725,14 +3799,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4743,16 +3811,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4762,14 +3830,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4783,14 +3845,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4801,33 +3857,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + 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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4837,18 +3889,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4859,40 +3905,36 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSArray * _Nullable value; - if (cppValue.HasValue()) { + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; { // 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(); - NSString * newElement_1; - newElement_1 = AsString(entry_1); - if (newElement_1 == nil) { + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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_1 addObject:newElement_1]; + [array_0 addObject:newElement_0]; } - CHIP_ERROR err = iter_1.GetStatus(); + CHIP_ERROR err = iter_0.GetStatus(); if (err != CHIP_NO_ERROR) { *aError = err; return nil; } - value = array_1; + value = array_0; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4902,14 +3944,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4923,14 +3959,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -4941,20 +3971,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedInt:cppValue.Value().Raw()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr.Raw()]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -4964,14 +3990,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -4981,18 +4001,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5003,31 +4017,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5037,14 +4051,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5054,18 +4062,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5076,31 +4078,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5110,14 +4112,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5127,18 +4123,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5149,31 +4139,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5183,14 +4173,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5200,18 +4184,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5222,31 +4200,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5256,14 +4234,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5277,14 +4249,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5295,16 +4261,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5314,14 +4280,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5335,14 +4295,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5353,33 +4307,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + 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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5389,18 +4339,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5411,35 +4355,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSArray * _Nullable value; - if (cppValue.HasValue()) { + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; { // 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(); - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedShort:entry_1]; - [array_1 addObject:newElement_1]; - } - CHIP_ERROR err = iter_1.GetStatus(); + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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_1; + value = array_0; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5449,14 +4389,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5466,18 +4400,12 @@ - (void)read:(void * _Nullable)context - (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:(MTRApplicationLauncherClusterApplicationEPStruct * _Nonnull)minInterval - maxInterval:(MTRApplicationLauncherClusterApplicationEPStruct * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5488,37 +4416,33 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // MTRApplicationLauncherClusterApplicationEPStruct * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [MTRApplicationLauncherClusterApplicationEPStruct numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value; - if (cppValue.HasValue()) { - if (cppValue.Value().IsNull()) { + MCApplicationLauncherClusterApplicationEPStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCApplicationLauncherClusterApplicationEPStruct * _Nullable value; + if (valueSharedPtr.IsNull()) { value = nil; } else { - value = [MTRApplicationLauncherClusterApplicationEPStruct new]; - value.application = [MTRApplicationLauncherClusterApplicationStruct new]; - value.application.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.Value().Value().application.catalogVendorID]; - value.application.applicationID = AsString(cppValue.Value().Value().application.applicationID); + value = [MCApplicationLauncherClusterApplicationEPStruct new]; + value.application = [MCApplicationLauncherClusterApplicationStruct new]; + value.application.catalogVendorID = [NSNumber numberWithUnsignedShort:valueSharedPtr.Value().application.catalogVendorID]; + value.application.applicationID = AsString(valueSharedPtr.Value().application.applicationID); if (value.application.applicationID == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - if (cppValue.Value().Value().endpoint.HasValue()) { - value.endpoint = [NSNumber numberWithUnsignedShort:cppValue.Value().Value().endpoint.Value()]; + if (valueSharedPtr.Value().endpoint.HasValue()) { + value.endpoint = [NSNumber numberWithUnsignedShort:valueSharedPtr.Value().endpoint.Value()]; } else { value.endpoint = nil; } } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5528,14 +4452,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5545,18 +4463,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5567,31 +4479,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5601,14 +4513,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5618,18 +4524,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5640,31 +4540,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5674,14 +4574,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5691,18 +4585,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5713,31 +4601,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5747,14 +4635,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5764,18 +4646,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5786,31 +4662,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5820,14 +4696,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5841,14 +4711,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5859,16 +4723,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -5878,14 +4742,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5899,14 +4757,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5917,33 +4769,29 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + 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, - [self](std::any cppValue) { - CHIP_ERROR errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -5953,18 +4801,12 @@ - (void)read:(void * _Nullable)context - (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:(NSString * _Nonnull)minInterval - maxInterval:(NSString * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -5975,25 +4817,21 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSString * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSString numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSString * _Nullable value; - if (cppValue.HasValue()) { - value = AsString(cppValue.Value()); + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSString * _Nonnull value; + value = AsString(valueSharedPtr); if (value == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - } else { - value = nil; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6003,14 +4841,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6024,14 +4856,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6042,20 +4868,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue.Value())]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(valueSharedPtr)]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6065,14 +4887,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6082,18 +4898,12 @@ - (void)read:(void * _Nullable)context - (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:(NSString * _Nonnull)minInterval - maxInterval:(NSString * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6104,21 +4914,21 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSString * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSString numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSString * _Nonnull value; - value = AsString(cppValue); - if (value == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - *aError = err; - return nil; + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSString * _Nonnull value; + value = AsString(valueSharedPtr); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6128,14 +4938,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6149,14 +4953,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6167,20 +4965,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nullable value; - if (cppValue.HasValue()) { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } else { - value = nil; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6190,14 +4984,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6207,18 +4995,12 @@ - (void)read:(void * _Nullable)context - (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:(MTRApplicationBasicClusterApplicationStruct * _Nonnull)minInterval - maxInterval:(MTRApplicationBasicClusterApplicationStruct * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6229,23 +5011,23 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // MTRApplicationBasicClusterApplicationStruct * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [MTRApplicationBasicClusterApplicationStruct numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - MTRApplicationBasicClusterApplicationStruct * _Nonnull value; - value = [MTRApplicationBasicClusterApplicationStruct 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; + MCApplicationBasicClusterApplicationStruct * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + MCApplicationBasicClusterApplicationStruct * _Nonnull value; + value = [MCApplicationBasicClusterApplicationStruct new]; + value.catalogVendorID = [NSNumber numberWithUnsignedShort:valueSharedPtr.catalogVendorID]; + value.applicationID = AsString(valueSharedPtr.applicationID); + if (value.applicationID == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6255,14 +5037,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6276,14 +5052,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6294,16 +5064,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(valueSharedPtr)]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6313,14 +5083,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6330,18 +5094,12 @@ - (void)read:(void * _Nullable)context - (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:(NSString * _Nonnull)minInterval - maxInterval:(NSString * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6352,21 +5110,21 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSString * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSString numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSString * _Nonnull value; - value = AsString(cppValue); - if (value == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - *aError = err; - return nil; + NSString * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSString * _Nonnull value; + value = AsString(valueSharedPtr); + if (value == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6376,14 +5134,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6393,18 +5145,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6415,31 +5161,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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: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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6449,14 +5195,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6466,18 +5206,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6488,31 +5222,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6522,14 +5256,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6539,18 +5267,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6561,31 +5283,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6595,14 +5317,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6612,18 +5328,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6634,31 +5344,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6668,14 +5378,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6685,18 +5389,12 @@ - (void)read:(void * _Nullable)context - (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:(NSArray * _Nonnull)minInterval - maxInterval:(NSArray * _Nonnull)maxInterval + minInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6707,31 +5405,31 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSArray * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSArray numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *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; + NSArray * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = valueSharedPtr.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; } - value = array_0; + return value; } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6741,14 +5439,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6762,14 +5454,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6780,16 +5466,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end @@ -6799,14 +5485,8 @@ - (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 errorCode; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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); @@ -6820,14 +5500,8 @@ - (void)subscribe:(void * _Nullable)context maxInterval:(NSNumber * _Nonnull)maxInterval { MCAttributeTemplate * mcAttribute = new MCAttributeTemplate(self.cppAttribute, - [self](std::any cppValue) { - CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; - id decodedValue = [self getObjCTypeFromCpp:cppValue errorCode:&errorCode]; - if (errorCode == CHIP_NO_ERROR) { - return decodedValue; - } - LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, errorCode); - return nil; + [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) { @@ -6838,16 +5512,16 @@ - (void)subscribe:(void * _Nullable)context - (id _Nullable)getObjCTypeFromCpp:(std::any)cppValue errorCode:(CHIP_ERROR *)aError { - // NSNumber * outValue = nil; - // if (cppValue.type() == typeid(std::shared_ptr)) { - // std::shared_ptr valueSharedPtr = std::any_cast>(cppValue); - // outValue = valueSharedPtr != nil ? [NSNumber numberWithUnsignedInteger:*valueSharedPtr] : nil; - // } - // return outValue; - - *aError = CHIP_NO_ERROR; - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; + NSNumber * value = nil; + if (cppValue.type() == typeid(std::shared_ptr)) { + std::shared_ptr sharedPtr = std::any_cast>(cppValue); + auto & valueSharedPtr = *sharedPtr; + *aError = CHIP_NO_ERROR; + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:valueSharedPtr]; + return value; + } + *aError = CHIP_ERROR_INTERNAL; return value; } @end diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MTRAttributeTLVValueDecoder.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeTLVValueDecoder.mm similarity index 97% rename from examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MTRAttributeTLVValueDecoder.mm rename to examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeTLVValueDecoder.mm index 298c127feeb02d..4f0aa3abf1c184 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCAttributeTLVValueDecoder.mm @@ -678,8 +678,8 @@ static id _Nullable DecodeAttributeValueForDescriptorCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDescriptorClusterDeviceTypeStruct * newElement_0; - newElement_0 = [MTRDescriptorClusterDeviceTypeStruct new]; + MCDescriptorClusterDeviceTypeStruct * newElement_0; + newElement_0 = [MCDescriptorClusterDeviceTypeStruct new]; newElement_0.deviceType = [NSNumber numberWithUnsignedInt:entry_0.deviceType]; newElement_0.revision = [NSNumber numberWithUnsignedShort:entry_0.revision]; [array_0 addObject:newElement_0]; @@ -784,8 +784,8 @@ static id _Nullable DecodeAttributeValueForDescriptorCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDescriptorClusterSemanticTagStruct * newElement_0; - newElement_0 = [MTRDescriptorClusterSemanticTagStruct new]; + MCDescriptorClusterSemanticTagStruct * newElement_0; + newElement_0 = [MCDescriptorClusterSemanticTagStruct new]; if (entry_0.mfgCode.IsNull()) { newElement_0.mfgCode = nil; } else { @@ -843,8 +843,8 @@ static id _Nullable DecodeAttributeValueForBindingCluster(AttributeId aAttribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRBindingClusterTargetStruct * newElement_0; - newElement_0 = [MTRBindingClusterTargetStruct new]; + MCBindingClusterTargetStruct * newElement_0; + newElement_0 = [MCBindingClusterTargetStruct new]; if (entry_0.node.HasValue()) { newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; } else { @@ -902,8 +902,8 @@ static id _Nullable DecodeAttributeValueForAccessControlCluster(AttributeId aAtt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRAccessControlClusterAccessControlEntryStruct * newElement_0; - newElement_0 = [MTRAccessControlClusterAccessControlEntryStruct new]; + MCAccessControlClusterAccessControlEntryStruct * newElement_0; + newElement_0 = [MCAccessControlClusterAccessControlEntryStruct new]; newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; if (entry_0.subjects.IsNull()) { @@ -934,8 +934,8 @@ static id _Nullable DecodeAttributeValueForAccessControlCluster(AttributeId aAtt auto iter_3 = entry_0.targets.Value().begin(); while (iter_3.Next()) { auto & entry_3 = iter_3.GetValue(); - MTRAccessControlClusterAccessControlTargetStruct * newElement_3; - newElement_3 = [MTRAccessControlClusterAccessControlTargetStruct new]; + MCAccessControlClusterAccessControlTargetStruct * newElement_3; + newElement_3 = [MCAccessControlClusterAccessControlTargetStruct new]; if (entry_3.cluster.IsNull()) { newElement_3.cluster = nil; } else { @@ -986,8 +986,8 @@ static id _Nullable DecodeAttributeValueForAccessControlCluster(AttributeId aAtt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRAccessControlClusterAccessControlExtensionStruct * newElement_0; - newElement_0 = [MTRAccessControlClusterAccessControlExtensionStruct new]; + MCAccessControlClusterAccessControlExtensionStruct * newElement_0; + newElement_0 = [MCAccessControlClusterAccessControlExtensionStruct new]; newElement_0.data = AsData(entry_0.data); newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; @@ -1059,8 +1059,8 @@ static id _Nullable DecodeAttributeValueForActionsCluster(AttributeId aAttribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRActionsClusterActionStruct * newElement_0; - newElement_0 = [MTRActionsClusterActionStruct new]; + MCActionsClusterActionStruct * newElement_0; + newElement_0 = [MCActionsClusterActionStruct new]; newElement_0.actionID = [NSNumber numberWithUnsignedShort:entry_0.actionID]; newElement_0.name = AsString(entry_0.name); if (newElement_0.name == nil) { @@ -1096,8 +1096,8 @@ static id _Nullable DecodeAttributeValueForActionsCluster(AttributeId aAttribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRActionsClusterEndpointListStruct * newElement_0; - newElement_0 = [MTRActionsClusterEndpointListStruct new]; + MCActionsClusterEndpointListStruct * newElement_0; + newElement_0 = [MCActionsClusterEndpointListStruct new]; newElement_0.endpointListID = [NSNumber numberWithUnsignedShort:entry_0.endpointListID]; newElement_0.name = AsString(entry_0.name); if (newElement_0.name == nil) { @@ -1438,7 +1438,7 @@ static id _Nullable DecodeAttributeValueForBasicInformationCluster(AttributeId a return nil; } MTRBasicInformationClusterCapabilityMinimaStruct * _Nonnull value; - value = [MTRBasicInformationClusterCapabilityMinimaStruct new]; + value = [MCBasicInformationClusterCapabilityMinimaStruct new]; value.caseSessionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.caseSessionsPerFabric]; value.subscriptionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.subscriptionsPerFabric]; return value; @@ -1451,7 +1451,7 @@ static id _Nullable DecodeAttributeValueForBasicInformationCluster(AttributeId a return nil; } MTRBasicInformationClusterProductAppearanceStruct * _Nonnull value; - value = [MTRBasicInformationClusterProductAppearanceStruct new]; + value = [MCBasicInformationClusterProductAppearanceStruct new]; value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; if (cppValue.primaryColor.IsNull()) { value.primaryColor = nil; @@ -1519,8 +1519,8 @@ static id _Nullable DecodeAttributeValueForOTASoftwareUpdateRequestorCluster(Att auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; - newElement_0 = [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; + MCOTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; + newElement_0 = [MCOTASoftwareUpdateRequestorClusterProviderLocation new]; newElement_0.providerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; @@ -2259,7 +2259,7 @@ static id _Nullable DecodeAttributeValueForGeneralCommissioningCluster(Attribute return nil; } MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nonnull value; - value = [MTRGeneralCommissioningClusterBasicCommissioningInfo new]; + value = [MCGeneralCommissioningClusterBasicCommissioningInfo new]; value.failSafeExpiryLengthSeconds = [NSNumber numberWithUnsignedShort:cppValue.failSafeExpiryLengthSeconds]; value.maxCumulativeFailsafeSeconds = [NSNumber numberWithUnsignedShort:cppValue.maxCumulativeFailsafeSeconds]; return value; @@ -2333,8 +2333,8 @@ static id _Nullable DecodeAttributeValueForNetworkCommissioningCluster(Attribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRNetworkCommissioningClusterNetworkInfoStruct * newElement_0; - newElement_0 = [MTRNetworkCommissioningClusterNetworkInfoStruct new]; + MCNetworkCommissioningClusterNetworkInfoStruct * newElement_0; + newElement_0 = [MCNetworkCommissioningClusterNetworkInfoStruct new]; newElement_0.networkID = AsData(entry_0.networkID); newElement_0.connected = [NSNumber numberWithBool:entry_0.connected]; if (entry_0.networkIdentifier.HasValue()) { @@ -2529,8 +2529,8 @@ static id _Nullable DecodeAttributeValueForGeneralDiagnosticsCluster(AttributeId auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRGeneralDiagnosticsClusterNetworkInterface * newElement_0; - newElement_0 = [MTRGeneralDiagnosticsClusterNetworkInterface new]; + MCGeneralDiagnosticsClusterNetworkInterface * newElement_0; + newElement_0 = [MCGeneralDiagnosticsClusterNetworkInterface new]; newElement_0.name = AsString(entry_0.name); if (newElement_0.name == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -2751,8 +2751,8 @@ static id _Nullable DecodeAttributeValueForSoftwareDiagnosticsCluster(AttributeI auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRSoftwareDiagnosticsClusterThreadMetricsStruct * newElement_0; - newElement_0 = [MTRSoftwareDiagnosticsClusterThreadMetricsStruct new]; + MCSoftwareDiagnosticsClusterThreadMetricsStruct * newElement_0; + newElement_0 = [MCSoftwareDiagnosticsClusterThreadMetricsStruct new]; newElement_0.id = [NSNumber numberWithUnsignedLongLong:entry_0.id]; if (entry_0.name.HasValue()) { newElement_0.name = AsString(entry_0.name.Value()); @@ -2954,8 +2954,8 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDiagnosticsCluster(Attri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThreadNetworkDiagnosticsClusterNeighborTableStruct * newElement_0; - newElement_0 = [MTRThreadNetworkDiagnosticsClusterNeighborTableStruct new]; + MCThreadNetworkDiagnosticsClusterNeighborTableStruct * newElement_0; + newElement_0 = [MCThreadNetworkDiagnosticsClusterNeighborTableStruct new]; newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; newElement_0.age = [NSNumber numberWithUnsignedInt:entry_0.age]; newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; @@ -3002,8 +3002,8 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDiagnosticsCluster(Attri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThreadNetworkDiagnosticsClusterRouteTableStruct * newElement_0; - newElement_0 = [MTRThreadNetworkDiagnosticsClusterRouteTableStruct new]; + MCThreadNetworkDiagnosticsClusterRouteTableStruct * newElement_0; + newElement_0 = [MCThreadNetworkDiagnosticsClusterRouteTableStruct new]; newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; newElement_0.routerId = [NSNumber numberWithUnsignedChar:entry_0.routerId]; @@ -3618,7 +3618,7 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDiagnosticsCluster(Attri if (cppValue.IsNull()) { value = nil; } else { - value = [MTRThreadNetworkDiagnosticsClusterSecurityPolicy new]; + value = [MCThreadNetworkDiagnosticsClusterSecurityPolicy new]; value.rotationTime = [NSNumber numberWithUnsignedShort:cppValue.Value().rotationTime]; value.flags = [NSNumber numberWithUnsignedShort:cppValue.Value().flags]; } @@ -3650,7 +3650,7 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDiagnosticsCluster(Attri if (cppValue.IsNull()) { value = nil; } else { - value = [MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents new]; + value = [MCThreadNetworkDiagnosticsClusterOperationalDatasetComponents new]; value.activeTimestampPresent = [NSNumber numberWithBool:cppValue.Value().activeTimestampPresent]; value.pendingTimestampPresent = [NSNumber numberWithBool:cppValue.Value().pendingTimestampPresent]; value.masterKeyPresent = [NSNumber numberWithBool:cppValue.Value().masterKeyPresent]; @@ -4082,7 +4082,7 @@ static id _Nullable DecodeAttributeValueForTimeSynchronizationCluster(AttributeI if (cppValue.IsNull()) { value = nil; } else { - value = [MTRTimeSynchronizationClusterTrustedTimeSourceStruct new]; + value = [MCTimeSynchronizationClusterTrustedTimeSourceStruct new]; value.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.Value().fabricIndex]; value.nodeID = [NSNumber numberWithUnsignedLongLong:cppValue.Value().nodeID]; value.endpoint = [NSNumber numberWithUnsignedShort:cppValue.Value().endpoint]; @@ -4122,8 +4122,8 @@ static id _Nullable DecodeAttributeValueForTimeSynchronizationCluster(AttributeI auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRTimeSynchronizationClusterTimeZoneStruct * newElement_0; - newElement_0 = [MTRTimeSynchronizationClusterTimeZoneStruct new]; + MCTimeSynchronizationClusterTimeZoneStruct * newElement_0; + newElement_0 = [MCTimeSynchronizationClusterTimeZoneStruct new]; newElement_0.offset = [NSNumber numberWithInt:entry_0.offset]; newElement_0.validAt = [NSNumber numberWithUnsignedLongLong:entry_0.validAt]; if (entry_0.name.HasValue()) { @@ -4160,8 +4160,8 @@ static id _Nullable DecodeAttributeValueForTimeSynchronizationCluster(AttributeI auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRTimeSynchronizationClusterDSTOffsetStruct * newElement_0; - newElement_0 = [MTRTimeSynchronizationClusterDSTOffsetStruct new]; + MCTimeSynchronizationClusterDSTOffsetStruct * newElement_0; + newElement_0 = [MCTimeSynchronizationClusterDSTOffsetStruct new]; newElement_0.offset = [NSNumber numberWithInt:entry_0.offset]; newElement_0.validStarting = [NSNumber numberWithUnsignedLongLong:entry_0.validStarting]; if (entry_0.validUntil.IsNull()) { @@ -4490,7 +4490,7 @@ static id _Nullable DecodeAttributeValueForBridgedDeviceBasicInformationCluster( return nil; } MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct * _Nonnull value; - value = [MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct new]; + value = [MCBridgedDeviceBasicInformationClusterProductAppearanceStruct new]; value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; if (cppValue.primaryColor.IsNull()) { value.primaryColor = nil; @@ -4622,8 +4622,8 @@ static id _Nullable DecodeAttributeValueForOperationalCredentialsCluster(Attribu auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROperationalCredentialsClusterNOCStruct * newElement_0; - newElement_0 = [MTROperationalCredentialsClusterNOCStruct new]; + MCOperationalCredentialsClusterNOCStruct * newElement_0; + newElement_0 = [MCOperationalCredentialsClusterNOCStruct new]; newElement_0.noc = AsData(entry_0.noc); if (entry_0.icac.IsNull()) { newElement_0.icac = nil; @@ -4655,8 +4655,8 @@ static id _Nullable DecodeAttributeValueForOperationalCredentialsCluster(Attribu auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROperationalCredentialsClusterFabricDescriptorStruct * newElement_0; - newElement_0 = [MTROperationalCredentialsClusterFabricDescriptorStruct new]; + MCOperationalCredentialsClusterFabricDescriptorStruct * newElement_0; + newElement_0 = [MCOperationalCredentialsClusterFabricDescriptorStruct new]; newElement_0.rootPublicKey = AsData(entry_0.rootPublicKey); newElement_0.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.vendorID)]; newElement_0.fabricID = [NSNumber numberWithUnsignedLongLong:entry_0.fabricID]; @@ -4763,8 +4763,8 @@ static id _Nullable DecodeAttributeValueForGroupKeyManagementCluster(AttributeId auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; - newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; + MCGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; + newElement_0 = [MCGroupKeyManagementClusterGroupKeyMapStruct new]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; @@ -4792,8 +4792,8 @@ static id _Nullable DecodeAttributeValueForGroupKeyManagementCluster(AttributeId auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; - newElement_0 = [MTRGroupKeyManagementClusterGroupInfoMapStruct new]; + MCGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; + newElement_0 = [MCGroupKeyManagementClusterGroupInfoMapStruct new]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; @@ -4880,8 +4880,8 @@ static id _Nullable DecodeAttributeValueForFixedLabelCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRFixedLabelClusterLabelStruct * newElement_0; - newElement_0 = [MTRFixedLabelClusterLabelStruct new]; + MCFixedLabelClusterLabelStruct * newElement_0; + newElement_0 = [MCFixedLabelClusterLabelStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -4930,8 +4930,8 @@ static id _Nullable DecodeAttributeValueForUserLabelCluster(AttributeId aAttribu auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRUserLabelClusterLabelStruct * newElement_0; - newElement_0 = [MTRUserLabelClusterLabelStruct new]; + MCUserLabelClusterLabelStruct * newElement_0; + newElement_0 = [MCUserLabelClusterLabelStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5036,8 +5036,8 @@ static id _Nullable DecodeAttributeValueForICDManagementCluster(AttributeId aAtt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRICDManagementClusterMonitoringRegistrationStruct * newElement_0; - newElement_0 = [MTRICDManagementClusterMonitoringRegistrationStruct new]; + MCICDManagementClusterMonitoringRegistrationStruct * newElement_0; + newElement_0 = [MCICDManagementClusterMonitoringRegistrationStruct new]; newElement_0.checkInNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.checkInNodeID]; newElement_0.monitoredSubject = [NSNumber numberWithUnsignedLongLong:entry_0.monitoredSubject]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; @@ -5247,8 +5247,8 @@ static id _Nullable DecodeAttributeValueForOvenCavityOperationalStateCluster(Att auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROvenCavityOperationalStateClusterOperationalStateStruct * newElement_0; - newElement_0 = [MTROvenCavityOperationalStateClusterOperationalStateStruct new]; + MCOvenCavityOperationalStateClusterOperationalStateStruct * newElement_0; + newElement_0 = [MCOvenCavityOperationalStateClusterOperationalStateStruct new]; newElement_0.operationalStateID = [NSNumber numberWithUnsignedChar:entry_0.operationalStateID]; if (entry_0.operationalStateLabel.HasValue()) { newElement_0.operationalStateLabel = AsString(entry_0.operationalStateLabel.Value()); @@ -5290,7 +5290,7 @@ static id _Nullable DecodeAttributeValueForOvenCavityOperationalStateCluster(Att return nil; } MTROvenCavityOperationalStateClusterErrorStateStruct * _Nonnull value; - value = [MTROvenCavityOperationalStateClusterErrorStateStruct new]; + value = [MCOvenCavityOperationalStateClusterErrorStateStruct new]; value.errorStateID = [NSNumber numberWithUnsignedChar:cppValue.errorStateID]; if (cppValue.errorStateLabel.HasValue()) { value.errorStateLabel = AsString(cppValue.errorStateLabel.Value()); @@ -5339,8 +5339,8 @@ static id _Nullable DecodeAttributeValueForOvenModeCluster(AttributeId aAttribut auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROvenModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTROvenModeClusterModeOptionStruct new]; + MCOvenModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCOvenModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5353,8 +5353,8 @@ static id _Nullable DecodeAttributeValueForOvenModeCluster(AttributeId aAttribut auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTROvenModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTROvenModeClusterModeTagStruct new]; + MCOvenModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCOvenModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -5531,8 +5531,8 @@ static id _Nullable DecodeAttributeValueForModeSelectCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRModeSelectClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRModeSelectClusterModeOptionStruct new]; + MCModeSelectClusterModeOptionStruct * newElement_0; + newElement_0 = [MCModeSelectClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5545,8 +5545,8 @@ static id _Nullable DecodeAttributeValueForModeSelectCluster(AttributeId aAttrib auto iter_2 = entry_0.semanticTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRModeSelectClusterSemanticTagStruct * newElement_2; - newElement_2 = [MTRModeSelectClusterSemanticTagStruct new]; + MCModeSelectClusterSemanticTagStruct * newElement_2; + newElement_2 = [MCModeSelectClusterSemanticTagStruct new]; newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode)]; newElement_2.value = [NSNumber numberWithUnsignedShort:entry_2.value]; [array_2 addObject:newElement_2]; @@ -5635,8 +5635,8 @@ static id _Nullable DecodeAttributeValueForLaundryWasherModeCluster(AttributeId auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRLaundryWasherModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRLaundryWasherModeClusterModeOptionStruct new]; + MCLaundryWasherModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCLaundryWasherModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5649,8 +5649,8 @@ static id _Nullable DecodeAttributeValueForLaundryWasherModeCluster(AttributeId auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRLaundryWasherModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRLaundryWasherModeClusterModeTagStruct new]; + MCLaundryWasherModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCLaundryWasherModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -5743,8 +5743,8 @@ static id _Nullable DecodeAttributeValueForRefrigeratorAndTemperatureControlledC auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRRefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRRefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct new]; + MCRefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCRefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5757,8 +5757,8 @@ static id _Nullable DecodeAttributeValueForRefrigeratorAndTemperatureControlledC auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRRefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRRefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct new]; + MCRefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCRefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -5946,8 +5946,8 @@ static id _Nullable DecodeAttributeValueForRVCRunModeCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRRVCRunModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRRVCRunModeClusterModeOptionStruct new]; + MCRVCRunModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCRVCRunModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -5960,8 +5960,8 @@ static id _Nullable DecodeAttributeValueForRVCRunModeCluster(AttributeId aAttrib auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRRVCRunModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRRVCRunModeClusterModeTagStruct new]; + MCRVCRunModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCRVCRunModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -6024,8 +6024,8 @@ static id _Nullable DecodeAttributeValueForRVCCleanModeCluster(AttributeId aAttr auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRRVCCleanModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRRVCCleanModeClusterModeOptionStruct new]; + MCRVCCleanModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCRVCCleanModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -6038,8 +6038,8 @@ static id _Nullable DecodeAttributeValueForRVCCleanModeCluster(AttributeId aAttr auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRRVCCleanModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRRVCCleanModeClusterModeTagStruct new]; + MCRVCCleanModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCRVCCleanModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -6245,8 +6245,8 @@ static id _Nullable DecodeAttributeValueForDishwasherModeCluster(AttributeId aAt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDishwasherModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRDishwasherModeClusterModeOptionStruct new]; + MCDishwasherModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCDishwasherModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -6259,8 +6259,8 @@ static id _Nullable DecodeAttributeValueForDishwasherModeCluster(AttributeId aAt auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRDishwasherModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRDishwasherModeClusterModeTagStruct new]; + MCDishwasherModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCDishwasherModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -6587,8 +6587,8 @@ static id _Nullable DecodeAttributeValueForMicrowaveOvenModeCluster(AttributeId auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRMicrowaveOvenModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRMicrowaveOvenModeClusterModeOptionStruct new]; + MCMicrowaveOvenModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCMicrowaveOvenModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -6601,8 +6601,8 @@ static id _Nullable DecodeAttributeValueForMicrowaveOvenModeCluster(AttributeId auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRMicrowaveOvenModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRMicrowaveOvenModeClusterModeTagStruct new]; + MCMicrowaveOvenModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCMicrowaveOvenModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -6856,8 +6856,8 @@ static id _Nullable DecodeAttributeValueForOperationalStateCluster(AttributeId a auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTROperationalStateClusterOperationalStateStruct * newElement_0; - newElement_0 = [MTROperationalStateClusterOperationalStateStruct new]; + MCOperationalStateClusterOperationalStateStruct * newElement_0; + newElement_0 = [MCOperationalStateClusterOperationalStateStruct new]; newElement_0.operationalStateID = [NSNumber numberWithUnsignedChar:entry_0.operationalStateID]; if (entry_0.operationalStateLabel.HasValue()) { newElement_0.operationalStateLabel = AsString(entry_0.operationalStateLabel.Value()); @@ -6899,7 +6899,7 @@ static id _Nullable DecodeAttributeValueForOperationalStateCluster(AttributeId a return nil; } MTROperationalStateClusterErrorStateStruct * _Nonnull value; - value = [MTROperationalStateClusterErrorStateStruct new]; + value = [MCOperationalStateClusterErrorStateStruct new]; value.errorStateID = [NSNumber numberWithUnsignedChar:cppValue.errorStateID]; if (cppValue.errorStateLabel.HasValue()) { value.errorStateLabel = AsString(cppValue.errorStateLabel.Value()); @@ -7013,8 +7013,8 @@ static id _Nullable DecodeAttributeValueForRVCOperationalStateCluster(AttributeI auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRRVCOperationalStateClusterOperationalStateStruct * newElement_0; - newElement_0 = [MTRRVCOperationalStateClusterOperationalStateStruct new]; + MCRVCOperationalStateClusterOperationalStateStruct * newElement_0; + newElement_0 = [MCRVCOperationalStateClusterOperationalStateStruct new]; newElement_0.operationalStateID = [NSNumber numberWithUnsignedChar:entry_0.operationalStateID]; if (entry_0.operationalStateLabel.HasValue()) { newElement_0.operationalStateLabel = AsString(entry_0.operationalStateLabel.Value()); @@ -7056,7 +7056,7 @@ static id _Nullable DecodeAttributeValueForRVCOperationalStateCluster(AttributeI return nil; } MTRRVCOperationalStateClusterErrorStateStruct * _Nonnull value; - value = [MTRRVCOperationalStateClusterErrorStateStruct new]; + value = [MCRVCOperationalStateClusterErrorStateStruct new]; value.errorStateID = [NSNumber numberWithUnsignedChar:cppValue.errorStateID]; if (cppValue.errorStateLabel.HasValue()) { value.errorStateLabel = AsString(cppValue.errorStateLabel.Value()); @@ -7131,8 +7131,8 @@ static id _Nullable DecodeAttributeValueForScenesManagementCluster(AttributeId a auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRScenesManagementClusterSceneInfoStruct * newElement_0; - newElement_0 = [MTRScenesManagementClusterSceneInfoStruct new]; + MCScenesManagementClusterSceneInfoStruct * newElement_0; + newElement_0 = [MCScenesManagementClusterSceneInfoStruct new]; newElement_0.sceneCount = [NSNumber numberWithUnsignedChar:entry_0.sceneCount]; newElement_0.currentScene = [NSNumber numberWithUnsignedChar:entry_0.currentScene]; newElement_0.currentGroup = [NSNumber numberWithUnsignedShort:entry_0.currentGroup]; @@ -7234,8 +7234,8 @@ static id _Nullable DecodeAttributeValueForHEPAFilterMonitoringCluster(Attribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRHEPAFilterMonitoringClusterReplacementProductStruct * newElement_0; - newElement_0 = [MTRHEPAFilterMonitoringClusterReplacementProductStruct new]; + MCHEPAFilterMonitoringClusterReplacementProductStruct * newElement_0; + newElement_0 = [MCHEPAFilterMonitoringClusterReplacementProductStruct new]; newElement_0.productIdentifierType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.productIdentifierType)]; newElement_0.productIdentifierValue = AsString(entry_0.productIdentifierValue); if (newElement_0.productIdentifierValue == nil) { @@ -7338,8 +7338,8 @@ static id _Nullable DecodeAttributeValueForActivatedCarbonFilterMonitoringCluste auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct * newElement_0; - newElement_0 = [MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct new]; + MCActivatedCarbonFilterMonitoringClusterReplacementProductStruct * newElement_0; + newElement_0 = [MCActivatedCarbonFilterMonitoringClusterReplacementProductStruct new]; newElement_0.productIdentifierType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.productIdentifierType)]; newElement_0.productIdentifierValue = AsString(entry_0.productIdentifierValue); if (newElement_0.productIdentifierValue == nil) { @@ -7670,8 +7670,8 @@ static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(Att auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct * newElement_0; - newElement_0 = [MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct new]; + MCElectricalPowerMeasurementClusterMeasurementAccuracyStruct * newElement_0; + newElement_0 = [MCElectricalPowerMeasurementClusterMeasurementAccuracyStruct new]; newElement_0.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.measurementType)]; newElement_0.measured = [NSNumber numberWithBool:entry_0.measured]; newElement_0.minMeasuredValue = [NSNumber numberWithLongLong:entry_0.minMeasuredValue]; @@ -7681,8 +7681,8 @@ static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(Att auto iter_2 = entry_0.accuracyRanges.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct * newElement_2; - newElement_2 = [MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct new]; + MCElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct * newElement_2; + newElement_2 = [MCElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct new]; newElement_2.rangeMin = [NSNumber numberWithLongLong:entry_2.rangeMin]; newElement_2.rangeMax = [NSNumber numberWithLongLong:entry_2.rangeMax]; if (entry_2.percentMax.HasValue()) { @@ -7748,8 +7748,8 @@ static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(Att auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRElectricalPowerMeasurementClusterMeasurementRangeStruct * newElement_0; - newElement_0 = [MTRElectricalPowerMeasurementClusterMeasurementRangeStruct new]; + MCElectricalPowerMeasurementClusterMeasurementRangeStruct * newElement_0; + newElement_0 = [MCElectricalPowerMeasurementClusterMeasurementRangeStruct new]; newElement_0.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.measurementType)]; newElement_0.min = [NSNumber numberWithLongLong:entry_0.min]; newElement_0.max = [NSNumber numberWithLongLong:entry_0.max]; @@ -7985,8 +7985,8 @@ static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(Att auto iter_1 = cppValue.Value().begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; - newElement_1 = [MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; + MCElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; + newElement_1 = [MCElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; newElement_1.order = [NSNumber numberWithUnsignedChar:entry_1.order]; if (entry_1.measurement.IsNull()) { newElement_1.measurement = nil; @@ -8021,8 +8021,8 @@ static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(Att auto iter_1 = cppValue.Value().begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; - newElement_1 = [MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; + MCElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; + newElement_1 = [MCElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; newElement_1.order = [NSNumber numberWithUnsignedChar:entry_1.order]; if (entry_1.measurement.IsNull()) { newElement_1.measurement = nil; @@ -8091,7 +8091,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At return nil; } MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nonnull value; - value = [MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct new]; + value = [MCElectricalEnergyMeasurementClusterMeasurementAccuracyStruct new]; value.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue.measurementType)]; value.measured = [NSNumber numberWithBool:cppValue.measured]; value.minMeasuredValue = [NSNumber numberWithLongLong:cppValue.minMeasuredValue]; @@ -8101,8 +8101,8 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At auto iter_1 = cppValue.accuracyRanges.begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct * newElement_1; - newElement_1 = [MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct new]; + MCElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct * newElement_1; + newElement_1 = [MCElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct new]; newElement_1.rangeMin = [NSNumber numberWithLongLong:entry_1.rangeMin]; newElement_1.rangeMax = [NSNumber numberWithLongLong:entry_1.rangeMax]; if (entry_1.percentMax.HasValue()) { @@ -8157,7 +8157,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At if (cppValue.IsNull()) { value = nil; } else { - value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value = [MCElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; if (cppValue.Value().startTimestamp.HasValue()) { value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; @@ -8193,7 +8193,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At if (cppValue.IsNull()) { value = nil; } else { - value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value = [MCElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; if (cppValue.Value().startTimestamp.HasValue()) { value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; @@ -8229,7 +8229,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At if (cppValue.IsNull()) { value = nil; } else { - value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value = [MCElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; if (cppValue.Value().startTimestamp.HasValue()) { value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; @@ -8265,7 +8265,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At if (cppValue.IsNull()) { value = nil; } else { - value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value = [MCElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; if (cppValue.Value().startTimestamp.HasValue()) { value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; @@ -8301,7 +8301,7 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At if (cppValue.IsNull()) { value = nil; } else { - value = [MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct new]; + value = [MCElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct new]; if (cppValue.Value().importedResetTimestamp.HasValue()) { if (cppValue.Value().importedResetTimestamp.Value().IsNull()) { value.importedResetTimestamp = nil; @@ -8366,8 +8366,8 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDemandResponseLoadControlClusterLoadControlProgramStruct * newElement_0; - newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlProgramStruct new]; + MCDemandResponseLoadControlClusterLoadControlProgramStruct * newElement_0; + newElement_0 = [MCDemandResponseLoadControlClusterLoadControlProgramStruct new]; newElement_0.programID = AsData(entry_0.programID); newElement_0.name = AsString(entry_0.name); if (newElement_0.name == nil) { @@ -8425,8 +8425,8 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; - newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + MCDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; + newElement_0 = [MCDemandResponseLoadControlClusterLoadControlEventStruct new]; newElement_0.eventID = AsData(entry_0.eventID); if (entry_0.programID.IsNull()) { newElement_0.programID = nil; @@ -8451,12 +8451,12 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr auto iter_2 = entry_0.transitions.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; - newElement_2 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; + MCDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; + newElement_2 = [MCDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; newElement_2.duration = [NSNumber numberWithUnsignedShort:entry_2.duration]; newElement_2.control = [NSNumber numberWithUnsignedShort:entry_2.control.Raw()]; if (entry_2.temperatureControl.HasValue()) { - newElement_2.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + newElement_2.temperatureControl = [MCDemandResponseLoadControlClusterTemperatureControlStruct new]; if (entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) { if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { newElement_2.temperatureControl.coolingTempOffset = nil; @@ -8497,25 +8497,25 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr newElement_2.temperatureControl = nil; } if (entry_2.averageLoadControl.HasValue()) { - newElement_2.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + newElement_2.averageLoadControl = [MCDemandResponseLoadControlClusterAverageLoadControlStruct new]; newElement_2.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_2.averageLoadControl.Value().loadAdjustment]; } else { newElement_2.averageLoadControl = nil; } if (entry_2.dutyCycleControl.HasValue()) { - newElement_2.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + newElement_2.dutyCycleControl = [MCDemandResponseLoadControlClusterDutyCycleControlStruct new]; newElement_2.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_2.dutyCycleControl.Value().dutyCycle]; } else { newElement_2.dutyCycleControl = nil; } if (entry_2.powerSavingsControl.HasValue()) { - newElement_2.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + newElement_2.powerSavingsControl = [MCDemandResponseLoadControlClusterPowerSavingsControlStruct new]; newElement_2.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:entry_2.powerSavingsControl.Value().powerSavings]; } else { newElement_2.powerSavingsControl = nil; } if (entry_2.heatingSourceControl.HasValue()) { - newElement_2.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + newElement_2.heatingSourceControl = [MCDemandResponseLoadControlClusterHeatingSourceControlStruct new]; newElement_2.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.heatingSourceControl.Value().heatingSource)]; } else { newElement_2.heatingSourceControl = nil; @@ -8553,8 +8553,8 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; - newElement_0 = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; + MCDemandResponseLoadControlClusterLoadControlEventStruct * newElement_0; + newElement_0 = [MCDemandResponseLoadControlClusterLoadControlEventStruct new]; newElement_0.eventID = AsData(entry_0.eventID); if (entry_0.programID.IsNull()) { newElement_0.programID = nil; @@ -8579,12 +8579,12 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr auto iter_2 = entry_0.transitions.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; - newElement_2 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; + MCDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_2; + newElement_2 = [MCDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; newElement_2.duration = [NSNumber numberWithUnsignedShort:entry_2.duration]; newElement_2.control = [NSNumber numberWithUnsignedShort:entry_2.control.Raw()]; if (entry_2.temperatureControl.HasValue()) { - newElement_2.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; + newElement_2.temperatureControl = [MCDemandResponseLoadControlClusterTemperatureControlStruct new]; if (entry_2.temperatureControl.Value().coolingTempOffset.HasValue()) { if (entry_2.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { newElement_2.temperatureControl.coolingTempOffset = nil; @@ -8625,25 +8625,25 @@ static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(Attr newElement_2.temperatureControl = nil; } if (entry_2.averageLoadControl.HasValue()) { - newElement_2.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; + newElement_2.averageLoadControl = [MCDemandResponseLoadControlClusterAverageLoadControlStruct new]; newElement_2.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_2.averageLoadControl.Value().loadAdjustment]; } else { newElement_2.averageLoadControl = nil; } if (entry_2.dutyCycleControl.HasValue()) { - newElement_2.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; + newElement_2.dutyCycleControl = [MCDemandResponseLoadControlClusterDutyCycleControlStruct new]; newElement_2.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_2.dutyCycleControl.Value().dutyCycle]; } else { newElement_2.dutyCycleControl = nil; } if (entry_2.powerSavingsControl.HasValue()) { - newElement_2.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; + newElement_2.powerSavingsControl = [MCDemandResponseLoadControlClusterPowerSavingsControlStruct new]; newElement_2.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:entry_2.powerSavingsControl.Value().powerSavings]; } else { newElement_2.powerSavingsControl = nil; } if (entry_2.heatingSourceControl.HasValue()) { - newElement_2.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; + newElement_2.heatingSourceControl = [MCDemandResponseLoadControlClusterHeatingSourceControlStruct new]; newElement_2.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.heatingSourceControl.Value().heatingSource)]; } else { newElement_2.heatingSourceControl = nil; @@ -8737,8 +8737,8 @@ static id _Nullable DecodeAttributeValueForMessagesCluster(AttributeId aAttribut auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRMessagesClusterMessageStruct * newElement_0; - newElement_0 = [MTRMessagesClusterMessageStruct new]; + MCMessagesClusterMessageStruct * newElement_0; + newElement_0 = [MCMessagesClusterMessageStruct new]; newElement_0.messageID = AsData(entry_0.messageID); newElement_0.priority = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.priority)]; newElement_0.messageControl = [NSNumber numberWithUnsignedChar:entry_0.messageControl.Raw()]; @@ -8764,8 +8764,8 @@ static id _Nullable DecodeAttributeValueForMessagesCluster(AttributeId aAttribut auto iter_3 = entry_0.responses.Value().begin(); while (iter_3.Next()) { auto & entry_3 = iter_3.GetValue(); - MTRMessagesClusterMessageResponseOptionStruct * newElement_3; - newElement_3 = [MTRMessagesClusterMessageResponseOptionStruct new]; + MCMessagesClusterMessageResponseOptionStruct * newElement_3; + newElement_3 = [MCMessagesClusterMessageResponseOptionStruct new]; if (entry_3.messageResponseID.HasValue()) { newElement_3.messageResponseID = [NSNumber numberWithUnsignedInt:entry_3.messageResponseID.Value()]; } else { @@ -8913,8 +8913,8 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementCluster(Attribu auto iter_1 = cppValue.Value().begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRDeviceEnergyManagementClusterPowerAdjustStruct * newElement_1; - newElement_1 = [MTRDeviceEnergyManagementClusterPowerAdjustStruct new]; + MCDeviceEnergyManagementClusterPowerAdjustStruct * newElement_1; + newElement_1 = [MCDeviceEnergyManagementClusterPowerAdjustStruct new]; newElement_1.minPower = [NSNumber numberWithLongLong:entry_1.minPower]; newElement_1.maxPower = [NSNumber numberWithLongLong:entry_1.maxPower]; newElement_1.minDuration = [NSNumber numberWithUnsignedInt:entry_1.minDuration]; @@ -8942,7 +8942,7 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementCluster(Attribu if (cppValue.IsNull()) { value = nil; } else { - value = [MTRDeviceEnergyManagementClusterForecastStruct new]; + value = [MCDeviceEnergyManagementClusterForecastStruct new]; value.forecastId = [NSNumber numberWithUnsignedShort:cppValue.Value().forecastId]; if (cppValue.Value().activeSlotNumber.IsNull()) { value.activeSlotNumber = nil; @@ -8971,8 +8971,8 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementCluster(Attribu auto iter_2 = cppValue.Value().slots.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRDeviceEnergyManagementClusterSlotStruct * newElement_2; - newElement_2 = [MTRDeviceEnergyManagementClusterSlotStruct new]; + MCDeviceEnergyManagementClusterSlotStruct * newElement_2; + newElement_2 = [MCDeviceEnergyManagementClusterSlotStruct new]; newElement_2.minDuration = [NSNumber numberWithUnsignedInt:entry_2.minDuration]; newElement_2.maxDuration = [NSNumber numberWithUnsignedInt:entry_2.maxDuration]; newElement_2.defaultDuration = [NSNumber numberWithUnsignedInt:entry_2.defaultDuration]; @@ -9024,8 +9024,8 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementCluster(Attribu auto iter_5 = entry_2.costs.Value().begin(); while (iter_5.Next()) { auto & entry_5 = iter_5.GetValue(); - MTRDeviceEnergyManagementClusterCostStruct * newElement_5; - newElement_5 = [MTRDeviceEnergyManagementClusterCostStruct new]; + MCDeviceEnergyManagementClusterCostStruct * newElement_5; + newElement_5 = [MCDeviceEnergyManagementClusterCostStruct new]; newElement_5.costType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_5.costType)]; newElement_5.value = [NSNumber numberWithInt:entry_5.value]; newElement_5.decimalPoints = [NSNumber numberWithUnsignedChar:entry_5.decimalPoints]; @@ -9445,8 +9445,8 @@ static id _Nullable DecodeAttributeValueForEnergyPreferenceCluster(AttributeId a auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTREnergyPreferenceClusterBalanceStruct * newElement_0; - newElement_0 = [MTREnergyPreferenceClusterBalanceStruct new]; + MCEnergyPreferenceClusterBalanceStruct * newElement_0; + newElement_0 = [MCEnergyPreferenceClusterBalanceStruct new]; newElement_0.step = [NSNumber numberWithUnsignedChar:entry_0.step]; if (entry_0.label.HasValue()) { newElement_0.label = AsString(entry_0.label.Value()); @@ -9519,8 +9519,8 @@ static id _Nullable DecodeAttributeValueForEnergyPreferenceCluster(AttributeId a auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTREnergyPreferenceClusterBalanceStruct * newElement_0; - newElement_0 = [MTREnergyPreferenceClusterBalanceStruct new]; + MCEnergyPreferenceClusterBalanceStruct * newElement_0; + newElement_0 = [MCEnergyPreferenceClusterBalanceStruct new]; newElement_0.step = [NSNumber numberWithUnsignedChar:entry_0.step]; if (entry_0.label.HasValue()) { newElement_0.label = AsString(entry_0.label.Value()); @@ -9643,8 +9643,8 @@ static id _Nullable DecodeAttributeValueForEnergyEVSEModeCluster(AttributeId aAt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTREnergyEVSEModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTREnergyEVSEModeClusterModeOptionStruct new]; + MCEnergyEVSEModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCEnergyEVSEModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -9657,8 +9657,8 @@ static id _Nullable DecodeAttributeValueForEnergyEVSEModeCluster(AttributeId aAt auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTREnergyEVSEModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTREnergyEVSEModeClusterModeTagStruct new]; + MCEnergyEVSEModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCEnergyEVSEModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -9751,8 +9751,8 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementModeCluster(Att auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRDeviceEnergyManagementModeClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRDeviceEnergyManagementModeClusterModeOptionStruct new]; + MCDeviceEnergyManagementModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MCDeviceEnergyManagementModeClusterModeOptionStruct new]; newElement_0.label = AsString(entry_0.label); if (newElement_0.label == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -9765,8 +9765,8 @@ static id _Nullable DecodeAttributeValueForDeviceEnergyManagementModeCluster(Att auto iter_2 = entry_0.modeTags.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRDeviceEnergyManagementModeClusterModeTagStruct * newElement_2; - newElement_2 = [MTRDeviceEnergyManagementModeClusterModeTagStruct new]; + MCDeviceEnergyManagementModeClusterModeTagStruct * newElement_2; + newElement_2 = [MCDeviceEnergyManagementModeClusterModeTagStruct new]; if (entry_2.mfgCode.HasValue()) { newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; } else { @@ -11749,8 +11749,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThermostatClusterPresetTypeStruct * newElement_0; - newElement_0 = [MTRThermostatClusterPresetTypeStruct new]; + MCThermostatClusterPresetTypeStruct * newElement_0; + newElement_0 = [MCThermostatClusterPresetTypeStruct new]; newElement_0.presetScenario = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.presetScenario)]; newElement_0.numberOfPresets = [NSNumber numberWithUnsignedChar:entry_0.numberOfPresets]; newElement_0.presetTypeFeatures = [NSNumber numberWithUnsignedShort:entry_0.presetTypeFeatures.Raw()]; @@ -11778,8 +11778,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThermostatClusterScheduleTypeStruct * newElement_0; - newElement_0 = [MTRThermostatClusterScheduleTypeStruct new]; + MCThermostatClusterScheduleTypeStruct * newElement_0; + newElement_0 = [MCThermostatClusterScheduleTypeStruct new]; newElement_0.systemMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.systemMode)]; newElement_0.numberOfSchedules = [NSNumber numberWithUnsignedChar:entry_0.numberOfSchedules]; newElement_0.scheduleTypeFeatures = [NSNumber numberWithUnsignedShort:entry_0.scheduleTypeFeatures.Raw()]; @@ -11885,8 +11885,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThermostatClusterPresetStruct * newElement_0; - newElement_0 = [MTRThermostatClusterPresetStruct new]; + MCThermostatClusterPresetStruct * newElement_0; + newElement_0 = [MCThermostatClusterPresetStruct new]; if (entry_0.presetHandle.IsNull()) { newElement_0.presetHandle = nil; } else { @@ -11946,8 +11946,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThermostatClusterScheduleStruct * newElement_0; - newElement_0 = [MTRThermostatClusterScheduleStruct new]; + MCThermostatClusterScheduleStruct * newElement_0; + newElement_0 = [MCThermostatClusterScheduleStruct new]; if (entry_0.scheduleHandle.IsNull()) { newElement_0.scheduleHandle = nil; } else { @@ -11974,8 +11974,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib auto iter_2 = entry_0.transitions.begin(); while (iter_2.Next()) { auto & entry_2 = iter_2.GetValue(); - MTRThermostatClusterScheduleTransitionStruct * newElement_2; - newElement_2 = [MTRThermostatClusterScheduleTransitionStruct new]; + MCThermostatClusterScheduleTransitionStruct * newElement_2; + newElement_2 = [MCThermostatClusterScheduleTransitionStruct new]; newElement_2.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.dayOfWeek.Raw()]; newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; if (entry_2.presetHandle.HasValue()) { @@ -12075,7 +12075,7 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib if (cppValue.IsNull()) { value = nil; } else { - value = [MTRThermostatClusterQueuedPresetStruct new]; + value = [MCThermostatClusterQueuedPresetStruct new]; if (cppValue.Value().presetHandle.IsNull()) { value.presetHandle = nil; } else { @@ -15275,8 +15275,8 @@ static id _Nullable DecodeAttributeValueForChannelCluster(AttributeId aAttribute auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRChannelClusterChannelInfoStruct * newElement_0; - newElement_0 = [MTRChannelClusterChannelInfoStruct new]; + MCChannelClusterChannelInfoStruct * newElement_0; + newElement_0 = [MCChannelClusterChannelInfoStruct new]; newElement_0.majorNumber = [NSNumber numberWithUnsignedShort:entry_0.majorNumber]; newElement_0.minorNumber = [NSNumber numberWithUnsignedShort:entry_0.minorNumber]; if (entry_0.name.HasValue()) { @@ -15346,7 +15346,7 @@ static id _Nullable DecodeAttributeValueForChannelCluster(AttributeId aAttribute if (cppValue.IsNull()) { value = nil; } else { - value = [MTRChannelClusterLineupInfoStruct new]; + value = [MCChannelClusterLineupInfoStruct new]; value.operatorName = AsString(cppValue.Value().operatorName); if (value.operatorName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -15388,7 +15388,7 @@ static id _Nullable DecodeAttributeValueForChannelCluster(AttributeId aAttribute if (cppValue.IsNull()) { value = nil; } else { - value = [MTRChannelClusterChannelInfoStruct new]; + value = [MCChannelClusterChannelInfoStruct new]; value.majorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().majorNumber]; value.minorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().minorNumber]; if (cppValue.Value().name.HasValue()) { @@ -15464,8 +15464,8 @@ static id _Nullable DecodeAttributeValueForTargetNavigatorCluster(AttributeId aA auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRTargetNavigatorClusterTargetInfoStruct * newElement_0; - newElement_0 = [MTRTargetNavigatorClusterTargetInfoStruct new]; + 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) { @@ -15559,7 +15559,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (cppValue.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterPlaybackPositionStruct new]; + value = [MCMediaPlaybackClusterPlaybackPositionStruct new]; value.updatedAt = [NSNumber numberWithUnsignedLongLong:cppValue.Value().updatedAt]; if (cppValue.Value().position.IsNull()) { value.position = nil; @@ -15621,7 +15621,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (cppValue.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterTrackStruct new]; + value = [MCMediaPlaybackClusterTrackStruct new]; value.id = AsString(cppValue.Value().id); if (value.id == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -15631,7 +15631,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (cppValue.Value().trackAttributes.IsNull()) { value.trackAttributes = nil; } else { - value.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; + 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; @@ -15672,8 +15672,8 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt auto iter_1 = cppValue.Value().begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRMediaPlaybackClusterTrackStruct * newElement_1; - newElement_1 = [MTRMediaPlaybackClusterTrackStruct new]; + 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; @@ -15683,7 +15683,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (entry_1.trackAttributes.IsNull()) { newElement_1.trackAttributes = nil; } else { - newElement_1.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; + 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; @@ -15728,7 +15728,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (cppValue.IsNull()) { value = nil; } else { - value = [MTRMediaPlaybackClusterTrackStruct new]; + value = [MCMediaPlaybackClusterTrackStruct new]; value.id = AsString(cppValue.Value().id); if (value.id == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -15738,7 +15738,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (cppValue.Value().trackAttributes.IsNull()) { value.trackAttributes = nil; } else { - value.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; + 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; @@ -15779,8 +15779,8 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt auto iter_1 = cppValue.Value().begin(); while (iter_1.Next()) { auto & entry_1 = iter_1.GetValue(); - MTRMediaPlaybackClusterTrackStruct * newElement_1; - newElement_1 = [MTRMediaPlaybackClusterTrackStruct new]; + 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; @@ -15790,7 +15790,7 @@ static id _Nullable DecodeAttributeValueForMediaPlaybackCluster(AttributeId aAtt if (entry_1.trackAttributes.IsNull()) { newElement_1.trackAttributes = nil; } else { - newElement_1.trackAttributes = [MTRMediaPlaybackClusterTrackAttributesStruct new]; + 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; @@ -15849,8 +15849,8 @@ static id _Nullable DecodeAttributeValueForMediaInputCluster(AttributeId aAttrib auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRMediaInputClusterInputInfoStruct * newElement_0; - newElement_0 = [MTRMediaInputClusterInputInfoStruct new]; + MCMediaInputClusterInputInfoStruct * newElement_0; + newElement_0 = [MCMediaInputClusterInputInfoStruct new]; newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; newElement_0.inputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.inputType)]; newElement_0.name = AsString(entry_0.name); @@ -15990,8 +15990,8 @@ static id _Nullable DecodeAttributeValueForAudioOutputCluster(AttributeId aAttri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRAudioOutputClusterOutputInfoStruct * newElement_0; - newElement_0 = [MTRAudioOutputClusterOutputInfoStruct new]; + MCAudioOutputClusterOutputInfoStruct * newElement_0; + newElement_0 = [MCAudioOutputClusterOutputInfoStruct new]; newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; newElement_0.outputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.outputType)]; newElement_0.name = AsString(entry_0.name); @@ -16071,8 +16071,8 @@ static id _Nullable DecodeAttributeValueForApplicationLauncherCluster(AttributeI if (cppValue.IsNull()) { value = nil; } else { - value = [MTRApplicationLauncherClusterApplicationEPStruct new]; - value.application = [MTRApplicationLauncherClusterApplicationStruct new]; + 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) { @@ -16162,7 +16162,7 @@ static id _Nullable DecodeAttributeValueForApplicationBasicCluster(AttributeId a return nil; } MTRApplicationBasicClusterApplicationStruct * _Nonnull value; - value = [MTRApplicationBasicClusterApplicationStruct new]; + value = [MCApplicationBasicClusterApplicationStruct new]; value.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.catalogVendorID]; value.applicationID = AsString(cppValue.applicationID); if (value.applicationID == nil) { @@ -16273,8 +16273,8 @@ static id _Nullable DecodeAttributeValueForContentControlCluster(AttributeId aAt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRContentControlClusterRatingNameStruct * newElement_0; - newElement_0 = [MTRContentControlClusterRatingNameStruct new]; + MCContentControlClusterRatingNameStruct * newElement_0; + newElement_0 = [MCContentControlClusterRatingNameStruct new]; newElement_0.ratingName = AsString(entry_0.ratingName); if (newElement_0.ratingName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -16331,8 +16331,8 @@ static id _Nullable DecodeAttributeValueForContentControlCluster(AttributeId aAt auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRContentControlClusterRatingNameStruct * newElement_0; - newElement_0 = [MTRContentControlClusterRatingNameStruct new]; + MCContentControlClusterRatingNameStruct * newElement_0; + newElement_0 = [MCContentControlClusterRatingNameStruct new]; newElement_0.ratingName = AsString(entry_0.ratingName); if (newElement_0.ratingName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -18204,8 +18204,8 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterTestListStructOctet * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; + MCUnitTestingClusterTestListStructOctet * newElement_0; + newElement_0 = [MCUnitTestingClusterTestListStructOctet new]; newElement_0.member1 = [NSNumber numberWithUnsignedLongLong:entry_0.member1]; newElement_0.member2 = AsData(entry_0.member2); [array_0 addObject:newElement_0]; @@ -18308,8 +18308,8 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; + MCUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; + newElement_0 = [MCUnitTestingClusterNullablesAndOptionalsStruct new]; if (entry_0.nullableInt.IsNull()) { newElement_0.nullableInt = nil; } else { @@ -18366,7 +18366,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri if (entry_0.nullableStruct.IsNull()) { newElement_0.nullableStruct = nil; } else { - newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableStruct = [MCUnitTestingClusterSimpleStruct new]; newElement_0.nullableStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; newElement_0.nullableStruct.b = [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; newElement_0.nullableStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().c)]; @@ -18382,7 +18382,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; } if (entry_0.optionalStruct.HasValue()) { - newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.optionalStruct = [MCUnitTestingClusterSimpleStruct new]; newElement_0.optionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; newElement_0.optionalStruct.b = [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; newElement_0.optionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().c)]; @@ -18403,7 +18403,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri if (entry_0.nullableOptionalStruct.Value().IsNull()) { newElement_0.nullableOptionalStruct = nil; } else { - newElement_0.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableOptionalStruct = [MCUnitTestingClusterSimpleStruct new]; newElement_0.nullableOptionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().a]; newElement_0.nullableOptionalStruct.b = [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value().Value().b]; newElement_0.nullableOptionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().c)]; @@ -18515,7 +18515,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri return nil; } MTRUnitTestingClusterSimpleStruct * _Nonnull value; - value = [MTRUnitTestingClusterSimpleStruct new]; + value = [MCUnitTestingClusterSimpleStruct new]; value.a = [NSNumber numberWithUnsignedChar:cppValue.a]; value.b = [NSNumber numberWithBool:cppValue.b]; value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.c)]; @@ -18614,8 +18614,8 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri auto iter_0 = cppValue.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterTestFabricScoped * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; + MCUnitTestingClusterTestFabricScoped * newElement_0; + newElement_0 = [MCUnitTestingClusterTestFabricScoped new]; newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { newElement_0.optionalFabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u.Value()]; @@ -18642,7 +18642,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri *aError = err; return nil; } - newElement_0.fabricSensitiveStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.fabricSensitiveStruct = [MCUnitTestingClusterSimpleStruct new]; newElement_0.fabricSensitiveStruct.a = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; newElement_0.fabricSensitiveStruct.b = [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; newElement_0.fabricSensitiveStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.c)]; @@ -19164,7 +19164,7 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri if (cppValue.IsNull()) { value = nil; } else { - value = [MTRUnitTestingClusterSimpleStruct new]; + value = [MCUnitTestingClusterSimpleStruct new]; value.a = [NSNumber numberWithUnsignedChar:cppValue.Value().a]; value.b = [NSNumber numberWithBool:cppValue.Value().b]; value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().c)]; 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 index 7ff2a2b6f56bf5..fbed9690c1f3da 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.h @@ -16,20 +16,3 @@ */ // THIS FILE IS GENERATED BY ZAP - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - -#import "MCAttributeObjects.h" -#import "MCCluster.h" -#import "MCCommandObjects.h" -#import - -#ifndef MCClusterObjects_h -#define MCClusterObjects_h - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ 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 index c2db5b0bb962b4..fbed9690c1f3da 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm @@ -16,24 +16,3 @@ */ // THIS FILE IS GENERATED BY ZAP - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - -#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 - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.h index cdf8aff8458813..fbed9690c1f3da 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.h @@ -16,20 +16,3 @@ */ // THIS FILE IS GENERATED BY ZAP - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - -#import "MCCommand.h" -#import - -#ifndef MCCommandObjects_h -#define MCCommandObjects_h - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR - -#endif /* MCClusterObjects_h */ \ No newline at end of file diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.m b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.m new file mode 100644 index 00000000000000..1df84b754e8b41 --- /dev/null +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.m @@ -0,0 +1,8 @@ +// +// MCCommandObjects.m +// MatterTvCastingBridge +// +// Created by Gregor, Philip on 2/14/24. +// + +#import diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.mm index 7027ac1b909124..fbed9690c1f3da 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandObjects.mm @@ -16,23 +16,3 @@ */ // THIS FILE IS GENERATED BY ZAP - -#import "MTRBaseClusters.h" -#import "MTRBaseDevice.h" -// TODO: Delete above imports? - -#import "MCCommandObjects.h" - -#import "MCCastingApp.h" -#import "MCCommand_Internal.h" -#import "MCErrorUtils.h" - -#include "core/Command.h" -#include - -#import - -// Nothing here for now, but leaving this file in place in case we need to add -// something. - -// PHILIPGREGOR \ No newline at end of file