diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index bdb0dd574dff34..3b397fba31441e 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -67,6 +67,8 @@ 5ACDDD7D27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */; }; 5ACDDD7E27CD3F3A00EFD68A /* CHIPAttributeCacheContainer_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */; }; 5AE6D4E427A99041001F2493 /* CHIPDeviceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AE6D4E327A99041001F2493 /* CHIPDeviceTests.m */; }; + 754F3DF427FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */; }; + 7560FD1C27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */; }; 88EBF8CE27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CB27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88EBF8CF27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */; }; 88EBF8D027FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */; }; @@ -170,6 +172,8 @@ 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPAttributeCacheContainer_Internal.h; sourceTree = ""; }; 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPAttributeCacheContainer.mm; sourceTree = ""; }; 5AE6D4E327A99041001F2493 /* CHIPDeviceTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CHIPDeviceTests.m; sourceTree = ""; }; + 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPEventTLVValueDecoder_Internal.h; sourceTree = ""; }; + 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPEventTLVValueDecoder.mm; path = "zap-generated/CHIPEventTLVValueDecoder.mm"; sourceTree = ""; }; 88EBF8CB27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceAttestationDelegate.h; sourceTree = ""; }; 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPDeviceAttestationDelegateBridge.mm; sourceTree = ""; }; 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceAttestationDelegateBridge.h; sourceTree = ""; }; @@ -240,6 +244,7 @@ isa = PBXGroup; children = ( 513DDB892761F6F900DAA01A /* CHIPAttributeTLVValueDecoder.mm */, + 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */, 51B22C292740CB47008D5055 /* CHIPCommandPayloadsObjc.mm */, 51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */, 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */, @@ -285,6 +290,7 @@ 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */, 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */, 513DDB852761F69300DAA01A /* CHIPAttributeTLVValueDecoder_Internal.h */, + 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */, 1ED276E326C5832500547A89 /* CHIPCluster.h */, 1ED276E126C5812A00547A89 /* CHIPCluster.mm */, 2C5EEEF4268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.h */, @@ -399,6 +405,7 @@ 88EBF8CE27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h in Headers */, 2C222AD0255C620600E446B9 /* CHIPDevice.h in Headers */, 991DC0842475F45400C13860 /* CHIPDeviceController.h in Headers */, + 754F3DF427FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h in Headers */, B2E0D7B2245B0B5C003C5B48 /* CHIPManualSetupPayloadParser.h in Headers */, B2E0D7B1245B0B5C003C5B48 /* CHIP.h in Headers */, B2E0D7B8245B0B5C003C5B48 /* CHIPSetupPayload.h in Headers */, @@ -577,6 +584,7 @@ 5A6FEC9027B563D900F25F42 /* CHIPDeviceControllerOverXPC.m in Sources */, B289D4222639C0D300D4E314 /* CHIPOnboardingPayloadParser.m in Sources */, 2C1B027A2641DB4E00780EF1 /* CHIPOperationalCredentialsDelegate.mm in Sources */, + 7560FD1C27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm in Sources */, B2E0D7B9245B0B5C003C5B48 /* CHIPSetupPayload.mm in Sources */, B2E0D7B6245B0B5C003C5B48 /* CHIPManualSetupPayloadParser.mm in Sources */, 88EBF8CF27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm in Sources */, diff --git a/src/darwin/Framework/CHIP/BUILD.gn b/src/darwin/Framework/CHIP/BUILD.gn index 6bef8a79a0bb66..78074c7cefe257 100644 --- a/src/darwin/Framework/CHIP/BUILD.gn +++ b/src/darwin/Framework/CHIP/BUILD.gn @@ -72,6 +72,7 @@ static_library("framework") { "zap-generated/CHIPClustersObjc.mm", "zap-generated/CHIPCommandPayloadsObjc.h", "zap-generated/CHIPCommandPayloadsObjc.mm", + "zap-generated/CHIPEventTLVValueDecoder.mm", "zap-generated/CHIPStructsObjc.h", "zap-generated/CHIPStructsObjc.mm", ] diff --git a/src/darwin/Framework/CHIP/CHIPDevice.h b/src/darwin/Framework/CHIP/CHIPDevice.h index f321beb9287246..83bd6b2d4d2c2f 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.h +++ b/src/darwin/Framework/CHIP/CHIPDevice.h @@ -121,7 +121,7 @@ extern NSString * const kCHIPArrayValueType; * to reportHandler. Note that if the CHIPSubscribeParams are set to * automatically resubscribe this can end up being called more than once. * - * TODO: The "all events" part does not work yet. + * TODO: Remove this once the replacement below is adopted */ - (void)subscribeWithQueue:(dispatch_queue_t)queue minInterval:(uint16_t)minInterval @@ -131,6 +131,47 @@ extern NSString * const kCHIPArrayValueType; reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; +/** + * Subscribe to receive attribute reports for everything (all endpoints, all + * clusters, all attributes, all events) on the device. + * + * A non-nil attribute cache container will cache attribute values, retrievable + * through the designated attribute cache container. + * + * attributeReportHandler will be called any time a data update is available (with a + * non-nil "value") + * + * The array passed to attributeReportHandler will contain CHIPAttributeReport + * instances. Errors for specific paths, not the whole subscription, will be + * reported via those objects. + * + * eventReportHandler will be called any time an event is reported (with a + * non-nil "value") + * + * The array passed to eventReportHandler will contain CHIPEventReport + * instances. Errors for specific paths, not the whole subscription, will be + * reported via those objects. + * + * errorHandler will be called any time there is an error for the + * entire subscription (with a non-nil "error"), and terminate the subscription. + * + * Both report handlers are not supported over XPC at the moment. + * + * subscriptionEstablished block, if not nil, will be called once the + * subscription is established. This will be _after_ the first (priming) call + * to both report handlers. Note that if the CHIPSubscribeParams are set to + * automatically resubscribe this can end up being called more than once. + */ +- (void)subscribeWithQueue:(dispatch_queue_t)queue + minInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer + attributeReportHandler:(void (^)(NSArray * value))attributeReportHandler + eventReportHandler:(void (^)(NSArray * value))eventReportHandler + errorHandler:(void (^)(NSError * error))errorHandler + subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; + /** * Read attribute in a designated attribute path */ @@ -219,6 +260,17 @@ extern NSString * const kCHIPArrayValueType; + (instancetype)new NS_UNAVAILABLE; @end +@interface CHIPEventPath : NSObject +@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint; +@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; +@property (nonatomic, readonly, strong, nonnull) NSNumber * event; + ++ (instancetype)eventPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId eventId:(NSNumber *)eventId; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + @interface CHIPCommandPath : NSObject @property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint; @property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; @@ -240,6 +292,18 @@ extern NSString * const kCHIPArrayValueType; @property (nonatomic, readonly, strong, nullable) NSError * error; @end +@interface CHIPEventReport : NSObject +@property (nonatomic, readonly, strong, nonnull) CHIPEventPath * path; +@property (nonatomic, readonly, strong, nonnull) NSNumber * eventNumber; // chip::EventNumber type (uint64_t) +@property (nonatomic, readonly, strong, nonnull) NSNumber * priority; // chip::app::PriorityLevel type (uint8_t) +@property (nonatomic, readonly, strong, nonnull) NSNumber * timestamp; // chip::app::Timestamp.mValue type (uint64_t) +@property (nonatomic, readonly, strong, nullable) id value; +// If this specific path resulted in an error, the error (in the +// MatterInteractionErrorDomain or CHIPErrorDomain) that corresponds to this +// path. +@property (nonatomic, readonly, strong, nullable) NSError * error; +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_DEVICE_H */ diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm index b8800aca7d2f6d..ad578503b914c8 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.mm +++ b/src/darwin/Framework/CHIP/CHIPDevice.mm @@ -21,6 +21,7 @@ #import "CHIPCluster.h" #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" +#import "CHIPEventTLVValueDecoder_Internal.h" #import "CHIPLogging.h" #include "app/ConcreteAttributePath.h" #include "app/ConcreteCommandPath.h" @@ -76,6 +77,15 @@ @interface CHIPAttributeReport () - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(nullable id)value error:(nullable NSError *)error; @end +@interface CHIPEventReport () +- (instancetype)initWithPath:(const ConcreteEventPath &)path + eventNumber:(NSNumber *)eventNumber + priority:(NSNumber *)priority + timestamp:(NSNumber *)timestamp + value:(nullable id)value + error:(nullable NSError *)error; +@end + @interface CHIPReadClientContainer : NSObject @property (nonatomic, readwrite) app::ReadClient * readClientPtr; @property (nonatomic, readwrite) app::AttributePathParams * pathParams; @@ -235,24 +245,31 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device } typedef void (^ReportCallback)(NSArray * _Nullable value, NSError * _Nullable error); +typedef void (^DataReportCallback)(NSArray * value); +typedef void (^ErrorCallback)(NSError * error); namespace { class SubscriptionCallback final : public ClusterStateCache::Callback { public: - SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, - SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler) + SubscriptionCallback(dispatch_queue_t queue, DataReportCallback attributeReportCallback, DataReportCallback eventReportCallback, + ErrorCallback errorCallback, SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler) : mQueue(queue) - , mReportCallback(reportCallback) + , mAttributeReportCallback(attributeReportCallback) + , mEventReportCallback(eventReportCallback) + , mErrorCallback(errorCallback) , mSubscriptionEstablishedHandler(subscriptionEstablishedHandler) , mBufferedReadAdapter(*this) { } - SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, - SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler, void (^onDoneHandler)(void)) + SubscriptionCallback(dispatch_queue_t queue, DataReportCallback attributeReportCallback, DataReportCallback eventReportCallback, + ErrorCallback errorCallback, SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler, + void (^onDoneHandler)(void)) : mQueue(queue) - , mReportCallback(reportCallback) + , mAttributeReportCallback(attributeReportCallback) + , mEventReportCallback(eventReportCallback) + , mErrorCallback(errorCallback) , mSubscriptionEstablishedHandler(subscriptionEstablishedHandler) , mBufferedReadAdapter(*this) , mOnDoneHandler(onDoneHandler) @@ -270,6 +287,8 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device void OnReportEnd() override; + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override; + void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override; void OnError(CHIP_ERROR aError) override; @@ -286,12 +305,15 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device private: dispatch_queue_t mQueue; - // We set mReportCallback to nil when queueing error reports, so we + DataReportCallback _Nullable mAttributeReportCallback = nil; + DataReportCallback _Nullable mEventReportCallback = nil; + // We set mErrorCallback to nil when queueing error reports, so we // make sure to only report one error. - ReportCallback _Nullable mReportCallback = nil; + ErrorCallback _Nullable mErrorCallback = nil; SubscriptionEstablishedHandler _Nullable mSubscriptionEstablishedHandler; BufferedReadCallback mBufferedReadAdapter; - NSMutableArray * _Nullable mReports = nil; + NSMutableArray * _Nullable mAttributeReports = nil; + NSMutableArray * _Nullable mEventReports = nil; // Our lifetime management is a little complicated. On error we // attempt to delete the ReadClient, but asynchronously. While @@ -301,7 +323,7 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device // // To handle this, enforce the following rules: // - // 1) We guarantee that mReportCallback is only invoked with an error once. + // 1) We guarantee that mErrorCallback is only invoked with an error once. // 2) We ensure that we delete ourselves and the passed in ReadClient only from OnDone or a queued-up // error callback, but not both, by tracking whether we have a queued-up // deletion. @@ -320,22 +342,52 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler +{ + [self subscribeWithQueue:queue + minInterval:minInterval + maxInterval:maxInterval + params:params + cacheContainer:attributeCacheContainer + attributeReportHandler:^(NSArray * _Nullable value) { + reportHandler(value, nil); + } + eventReportHandler:^(NSArray * _Nullable value) { + ; // do nothing + } + errorHandler:^(NSError * _Nullable error) { + reportHandler(nil, error); + } + subscriptionEstablished:subscriptionEstablishedHandler]; +} + +- (void)subscribeWithQueue:(dispatch_queue_t)queue + minInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer + attributeReportHandler:(void (^)(NSArray * value))attributeReportHandler + eventReportHandler:(void (^)(NSArray * value))eventReportHandler + errorHandler:(void (^)(NSError * error))errorHandler + subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler { DeviceProxy * device = [self internalDevice]; if (!device) { dispatch_async(queue, ^{ - reportHandler(nil, [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); + errorHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); }); return; } - // Wildcard endpoint, cluster, attribute. + // Wildcard endpoint, cluster, attribute, event. auto attributePath = std::make_unique(); + auto eventPath = std::make_unique(); ReadPrepareParams readParams(device->GetSecureSession().Value()); readParams.mMinIntervalFloorSeconds = minInterval; readParams.mMaxIntervalCeilingSeconds = maxInterval; readParams.mpAttributePathParamsList = attributePath.get(); readParams.mAttributePathParamsListSize = 1; + readParams.mpEventPathParamsList = eventPath.get(); + readParams.mEventPathParamsListSize = 1; readParams.mKeepSubscriptions = (params != nil) && (params.keepPreviousSubscriptions != nil) && [params.keepPreviousSubscriptions boolValue]; @@ -344,17 +396,19 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue std::unique_ptr attributeCache; if (attributeCacheContainer) { __weak CHIPAttributeCacheContainer * weakPtr = attributeCacheContainer; - callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler, ^{ - CHIPAttributeCacheContainer * container = weakPtr; - if (container) { - container.cppAttributeCache = nullptr; - } - }); + callback = std::make_unique( + queue, attributeReportHandler, eventReportHandler, errorHandler, subscriptionEstablishedHandler, ^{ + CHIPAttributeCacheContainer * container = weakPtr; + if (container) { + container.cppAttributeCache = nullptr; + } + }); attributeCache = std::make_unique(*callback.get()); readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), attributeCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); } else { - callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler); + callback = std::make_unique( + queue, attributeReportHandler, eventReportHandler, errorHandler, subscriptionEstablishedHandler); readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), callback->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); } @@ -365,12 +419,13 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue } else { // SendAutoResubscribeRequest cleans up the params, even on failure. attributePath.release(); + eventPath.release(); err = readClient->SendAutoResubscribeRequest(std::move(readParams)); } if (err != CHIP_NO_ERROR) { dispatch_async(queue, ^{ - reportHandler(nil, [CHIPError errorForCHIPErrorCode:err]); + errorHandler([CHIPError errorForCHIPErrorCode:err]); }); return; @@ -1259,6 +1314,26 @@ ConcreteDataAttributePath path(static_cast([endpoint unsignedS } @end +@implementation CHIPEventPath +- (instancetype)initWithPath:(const ConcreteEventPath &)path +{ + if (self = [super init]) { + _endpoint = @(path.mEndpointId); + _cluster = @(path.mClusterId); + _event = @(path.mEventId); + } + return self; +} + ++ (instancetype)eventPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId eventId:(NSNumber *)eventId +{ + ConcreteEventPath path(static_cast([endpoint unsignedShortValue]), + static_cast([clusterId unsignedLongValue]), static_cast([eventId unsignedLongValue])); + + return [[CHIPEventPath alloc] initWithPath:path]; +} +@end + @implementation CHIPCommandPath - (instancetype)initWithPath:(const ConcreteCommandPath &)path { @@ -1291,21 +1366,88 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null } @end +@implementation CHIPEventReport +- (instancetype)initWithPath:(const ConcreteEventPath &)path + eventNumber:(NSNumber *)eventNumber + priority:(NSNumber *)priority + timestamp:(NSNumber *)timestamp + value:(nullable id)value + error:(nullable NSError *)error +{ + if (self = [super init]) { + _path = [[CHIPEventPath alloc] initWithPath:path]; + _eventNumber = eventNumber; + _priority = priority; + _timestamp = timestamp; + _value = value; + _error = error; + } + return self; +} +@end + namespace { -void SubscriptionCallback::OnReportBegin() { mReports = [NSMutableArray new]; } +void SubscriptionCallback::OnReportBegin() +{ + mAttributeReports = [NSMutableArray new]; + mEventReports = [NSMutableArray new]; +} void SubscriptionCallback::OnReportEnd() { - __block NSArray * reports = mReports; - mReports = nil; - if (mReportCallback) { + __block NSArray * attributeReports = mAttributeReports; + mAttributeReports = nil; + __block NSArray * eventReports = mEventReports; + mEventReports = nil; + if (mAttributeReportCallback && attributeReports.count) { dispatch_async(mQueue, ^{ - mReportCallback(reports, nil); + mAttributeReportCallback(attributeReports); + }); + } + if (mEventReportCallback && eventReports.count) { + dispatch_async(mQueue, ^{ + mEventReportCallback(eventReports); }); } // Else we have a pending error already. } +void SubscriptionCallback::OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) +{ + id _Nullable value = nil; + NSError * _Nullable error = nil; + if (apStatus != nullptr) { + error = [CHIPError errorForIMStatus:*apStatus]; + } else if (apData == nullptr) { + error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; + } else { + CHIP_ERROR err; + value = CHIPDecodeEventPayload(aEventHeader.mPath, *apData, &err); + if (err == CHIP_ERROR_IM_MALFORMED_EVENT_PATH) { + // We don't know this event; just skip it. + return; + } + + if (err != CHIP_NO_ERROR) { + value = nil; + error = [CHIPError errorForCHIPErrorCode:err]; + } + } + + if (mEventReports == nil) { + // Never got a OnReportBegin? Not much to do other than tear things down. + ReportError(CHIP_ERROR_INCORRECT_STATE); + return; + } + + [mEventReports addObject:[[CHIPEventReport alloc] initWithPath:aEventHeader.mPath + eventNumber:@(aEventHeader.mEventNumber) + priority:@((uint8_t) aEventHeader.mPriorityLevel) + timestamp:@(aEventHeader.mTimestamp.mValue) + value:value + error:error]]; +} + void SubscriptionCallback::OnAttributeData( const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) { @@ -1334,13 +1476,13 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null } } - if (mReports == nil) { + if (mAttributeReports == nil) { // Never got a OnReportBegin? Not much to do other than tear things down. ReportError(CHIP_ERROR_INCORRECT_STATE); return; } - [mReports addObject:[[CHIPAttributeReport alloc] initWithPath:aPath value:value error:error]]; + [mAttributeReports addObject:[[CHIPAttributeReport alloc] initWithPath:aPath value:value error:error]]; } void SubscriptionCallback::OnError(CHIP_ERROR aError) { ReportError([CHIPError errorForCHIPErrorCode:aError]); } @@ -1401,13 +1543,15 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null return; } - __block ReportCallback callback = mReportCallback; + __block ErrorCallback callback = mErrorCallback; __block auto * myself = this; - mReportCallback = nil; + mErrorCallback = nil; + mAttributeReportCallback = nil; + mEventReportCallback = nil; __auto_type onDoneHandler = mOnDoneHandler; mOnDoneHandler = nil; dispatch_async(mQueue, ^{ - callback(nil, err); + callback(err); if (onDoneHandler) { onDoneHandler(); } diff --git a/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h b/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h new file mode 100644 index 00000000000000..91f0c7a798e924 --- /dev/null +++ b/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#import + +#include +#include +#include +#include + +NS_ASSUME_NONNULL_BEGIN + +id CHIPDecodeEventPayload(const chip::app::ConcreteEventPath & aPath, chip::TLV::TLVReader & aReader, CHIP_ERROR * aError); + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt new file mode 100644 index 00000000000000..b3676bf41e9167 --- /dev/null +++ b/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt @@ -0,0 +1,69 @@ +{{> header}} + +#import "CHIPEventTLVValueDecoder_Internal.h" + +#import "CHIPStructsObjc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; + +id CHIPDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) + { + {{#chip_client_clusters}} + case Clusters::{{asUpperCamelCase name}}::Id: { + using namespace Clusters::{{asUpperCamelCase name}}; + switch (aPath.mEventId) + { + {{#zcl_events}} + {{#zcl_event_fields}} + {{/zcl_event_fields}} + + case Events::{{asUpperCamelCase name}}::Id: { + Events::{{asUpperCamelCase name}}::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nil; + } + + CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event *value = [CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event new]; + + {{#zcl_event_fields}} + do { + {{asObjectiveCType type parent.parent.name}} memberValue; + {{>decode_value target="memberValue" source=(concat "cppValue." (asLowerCamelCase name)) cluster=parent.parent.name errorCode="*aError = err; return nil;" depth=0}} + value.{{asStructPropertyName name}} = memberValue; + } while(0); + {{/zcl_event_fields}} + + return value; + } + + {{/zcl_events}} + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + {{/chip_client_clusters}} + default: { + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + } + return nil; +} diff --git a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt index d5d4c5ceed3ff3..8467b429ad650e 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt @@ -19,6 +19,22 @@ NS_ASSUME_NONNULL_BEGIN @end {{/zcl_structs}} + +{{#zcl_events}} +@implementation CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event +- (instancetype)init +{ + if (self = [super init]) { + {{#zcl_event_fields}} + {{>init_struct_member label=name type=type cluster=parent.parent.name}} + {{/zcl_event_fields}} + } + return self; +} +@end + +{{/zcl_events}} + {{/zcl_clusters}} NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt index 92c7b7fef07a01..edf1bd35e402c6 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt @@ -19,6 +19,17 @@ NS_ASSUME_NONNULL_BEGIN @end {{/zcl_structs}} + +{{#zcl_events}} +@interface CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event : NSObject +{{#zcl_event_fields}} +@property (strong, nonatomic{{#unless (isStrEqual (asGetterName name) (asStructPropertyName name))}}, getter={{asGetterName name}}{{/unless}}) {{asObjectiveCType type parent.parent.name}} {{asStructPropertyName name}}; +{{/zcl_event_fields}} +@end + +{{/zcl_events}} + + {{/zcl_clusters}} NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 3c5ff6bc85f91f..88c738ce8d2a19 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -101,6 +101,11 @@ "path": "CHIPAttributeTLVValueDecoder-src.zapt", "name": "Decode TLV attribute values into Objc objects", "output": "src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm" + }, + { + "path": "CHIPEventTLVValueDecoder-src.zapt", + "name": "Decode TLV event values into Objc objects", + "output": "src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm" } ] } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm new file mode 100644 index 00000000000000..5d3c55fe6103d5 --- /dev/null +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm @@ -0,0 +1,2171 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#import "CHIPEventTLVValueDecoder_Internal.h" + +#import "CHIPStructsObjc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; + +id CHIPDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + case Clusters::AccessControl::Id: { + using namespace Clusters::AccessControl; + switch (aPath.mEventId) { + + case Events::AccessControlEntryChanged::Id: { + Events::AccessControlEntryChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPAccessControlClusterAccessControlEntryChangedEvent * value = + [CHIPAccessControlClusterAccessControlEntryChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + CHIPAccessControlClusterAccessControlEntry * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [CHIPAccessControlClusterAccessControlEntry new]; + memberValue.privilege = + [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().privilege)]; + memberValue.authMode = + [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().authMode)]; + if (cppValue.latestValue.Value().subjects.IsNull()) { + memberValue.subjects = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().subjects.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue.subjects = array_3; + } + } + if (cppValue.latestValue.Value().targets.IsNull()) { + memberValue.targets = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().targets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + CHIPAccessControlClusterTarget * newElement_3; + newElement_3 = [CHIPAccessControlClusterTarget new]; + if (entry_3.cluster.IsNull()) { + newElement_3.cluster = nil; + } else { + newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; + } + if (entry_3.endpoint.IsNull()) { + newElement_3.endpoint = nil; + } else { + newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; + } + if (entry_3.deviceType.IsNull()) { + newElement_3.deviceType = nil; + } else { + newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue.targets = array_3; + } + } + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; + } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.adminFabricIndex]; + value.adminFabricIndex = memberValue; + } while (0); + + return value; + } + + case Events::AccessControlExtensionChanged::Id: { + Events::AccessControlExtensionChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPAccessControlClusterAccessControlExtensionChangedEvent * value = + [CHIPAccessControlClusterAccessControlExtensionChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + CHIPAccessControlClusterExtensionEntry * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [CHIPAccessControlClusterExtensionEntry new]; + memberValue.data = [NSData dataWithBytes:cppValue.latestValue.Value().data.data() + length:cppValue.latestValue.Value().data.size()]; + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; + } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.adminFabricIndex]; + value.adminFabricIndex = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AccountLogin::Id: { + using namespace Clusters::AccountLogin; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AdministratorCommissioning::Id: { + using namespace Clusters::AdministratorCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ApplicationBasic::Id: { + using namespace Clusters::ApplicationBasic; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ApplicationLauncher::Id: { + using namespace Clusters::ApplicationLauncher; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AudioOutput::Id: { + using namespace Clusters::AudioOutput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BarrierControl::Id: { + using namespace Clusters::BarrierControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Basic::Id: { + using namespace Clusters::Basic; + switch (aPath.mEventId) { + + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterStartUpEvent * value = [CHIPBasicClusterStartUpEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterShutDownEvent * value = [CHIPBasicClusterShutDownEvent new]; + + return value; + } + + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterLeaveEvent * value = [CHIPBasicClusterLeaveEvent new]; + + return value; + } + + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterReachableChangedEvent * value = [CHIPBasicClusterReachableChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BinaryInputBasic::Id: { + using namespace Clusters::BinaryInputBasic; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Binding::Id: { + using namespace Clusters::Binding; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BooleanState::Id: { + using namespace Clusters::BooleanState; + switch (aPath.mEventId) { + + case Events::StateChange::Id: { + Events::StateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBooleanStateClusterStateChangeEvent * value = [CHIPBooleanStateClusterStateChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.stateValue]; + value.stateValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BridgedActions::Id: { + using namespace Clusters::BridgedActions; + switch (aPath.mEventId) { + + case Events::StateChanged::Id: { + Events::StateChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedActionsClusterStateChangedEvent * value = [CHIPBridgedActionsClusterStateChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + + return value; + } + + case Events::ActionFailed::Id: { + Events::ActionFailed::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedActionsClusterActionFailedEvent * value = [CHIPBridgedActionsClusterActionFailedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.error)]; + value.error = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BridgedDeviceBasic::Id: { + using namespace Clusters::BridgedDeviceBasic; + switch (aPath.mEventId) { + + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterStartUpEvent * value = [CHIPBridgedDeviceBasicClusterStartUpEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterShutDownEvent * value = [CHIPBridgedDeviceBasicClusterShutDownEvent new]; + + return value; + } + + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterLeaveEvent * value = [CHIPBridgedDeviceBasicClusterLeaveEvent new]; + + return value; + } + + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterReachableChangedEvent * value = [CHIPBridgedDeviceBasicClusterReachableChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Channel::Id: { + using namespace Clusters::Channel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ColorControl::Id: { + using namespace Clusters::ColorControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ContentLauncher::Id: { + using namespace Clusters::ContentLauncher; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Descriptor::Id: { + using namespace Clusters::Descriptor; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::DiagnosticLogs::Id: { + using namespace Clusters::DiagnosticLogs; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::DoorLock::Id: { + using namespace Clusters::DoorLock; + switch (aPath.mEventId) { + + case Events::DoorLockAlarm::Id: { + Events::DoorLockAlarm::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterDoorLockAlarmEvent * value = [CHIPDoorLockClusterDoorLockAlarmEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmCode)]; + value.alarmCode = memberValue; + } while (0); + + return value; + } + + case Events::DoorStateChange::Id: { + Events::DoorStateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterDoorStateChangeEvent * value = [CHIPDoorLockClusterDoorStateChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.doorState)]; + value.doorState = memberValue; + } while (0); + + return value; + } + + case Events::LockOperation::Id: { + Events::LockOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockOperationEvent * value = [CHIPDoorLockClusterLockOperationEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { + memberValue = nil; + } else { + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + CHIPDoorLockClusterDlCredential * newElement_2; + newElement_2 = [CHIPDoorLockClusterDlCredential new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_2; + } + } + } else { + memberValue = nil; + } + value.credentials = memberValue; + } while (0); + + return value; + } + + case Events::LockOperationError::Id: { + Events::LockOperationError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockOperationErrorEvent * value = [CHIPDoorLockClusterLockOperationErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationError)]; + value.operationError = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { + memberValue = nil; + } else { + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + CHIPDoorLockClusterDlCredential * newElement_2; + newElement_2 = [CHIPDoorLockClusterDlCredential new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_2; + } + } + } else { + memberValue = nil; + } + value.credentials = memberValue; + } while (0); + + return value; + } + + case Events::LockUserChange::Id: { + Events::LockUserChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockUserChangeEvent * value = [CHIPDoorLockClusterLockUserChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockDataType)]; + value.lockDataType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.dataOperationType)]; + value.dataOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.dataIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.dataIndex.Value()]; + } + value.dataIndex = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ElectricalMeasurement::Id: { + using namespace Clusters::ElectricalMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::EthernetNetworkDiagnostics::Id: { + using namespace Clusters::EthernetNetworkDiagnostics; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FanControl::Id: { + using namespace Clusters::FanControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FixedLabel::Id: { + using namespace Clusters::FixedLabel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FlowMeasurement::Id: { + using namespace Clusters::FlowMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GeneralCommissioning::Id: { + using namespace Clusters::GeneralCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GeneralDiagnostics::Id: { + using namespace Clusters::GeneralDiagnostics; + switch (aPath.mEventId) { + + case Events::HardwareFaultChange::Id: { + Events::HardwareFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent * value = + [CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::RadioFaultChange::Id: { + Events::RadioFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent * value = [CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::NetworkFaultChange::Id: { + Events::NetworkFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent * value = + [CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::BootReason::Id: { + Events::BootReason::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterBootReasonEvent * value = [CHIPGeneralDiagnosticsClusterBootReasonEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.bootReason)]; + value.bootReason = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GroupKeyManagement::Id: { + using namespace Clusters::GroupKeyManagement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Groups::Id: { + using namespace Clusters::Groups; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Identify::Id: { + using namespace Clusters::Identify; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::IlluminanceMeasurement::Id: { + using namespace Clusters::IlluminanceMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::KeypadInput::Id: { + using namespace Clusters::KeypadInput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LevelControl::Id: { + using namespace Clusters::LevelControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LocalizationConfiguration::Id: { + using namespace Clusters::LocalizationConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LowPower::Id: { + using namespace Clusters::LowPower; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::MediaInput::Id: { + using namespace Clusters::MediaInput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::MediaPlayback::Id: { + using namespace Clusters::MediaPlayback; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ModeSelect::Id: { + using namespace Clusters::ModeSelect; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::NetworkCommissioning::Id: { + using namespace Clusters::NetworkCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OtaSoftwareUpdateProvider::Id: { + using namespace Clusters::OtaSoftwareUpdateProvider; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OtaSoftwareUpdateRequestor::Id: { + using namespace Clusters::OtaSoftwareUpdateRequestor; + switch (aPath.mEventId) { + + case Events::StateTransition::Id: { + Events::StateTransition::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.previousState)]; + value.previousState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.reason)]; + value.reason = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.targetSoftwareVersion.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedInt:cppValue.targetSoftwareVersion.Value()]; + } + value.targetSoftwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::VersionApplied::Id: { + Events::VersionApplied::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.productID]; + value.productID = memberValue; + } while (0); + + return value; + } + + case Events::DownloadError::Id: { + Events::DownloadError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.bytesDownloaded]; + value.bytesDownloaded = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.progressPercent.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.progressPercent.Value()]; + } + value.progressPercent = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.platformCode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithLongLong:cppValue.platformCode.Value()]; + } + value.platformCode = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OccupancySensing::Id: { + using namespace Clusters::OccupancySensing; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OnOff::Id: { + using namespace Clusters::OnOff; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OnOffSwitchConfiguration::Id: { + using namespace Clusters::OnOffSwitchConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OperationalCredentials::Id: { + using namespace Clusters::OperationalCredentials; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PowerSource::Id: { + using namespace Clusters::PowerSource; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PowerSourceConfiguration::Id: { + using namespace Clusters::PowerSourceConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PressureMeasurement::Id: { + using namespace Clusters::PressureMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PumpConfigurationAndControl::Id: { + using namespace Clusters::PumpConfigurationAndControl; + switch (aPath.mEventId) { + + case Events::SupplyVoltageLow::Id: { + Events::SupplyVoltageLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent * value = + [CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent new]; + + return value; + } + + case Events::SupplyVoltageHigh::Id: { + Events::SupplyVoltageHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent * value = + [CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent new]; + + return value; + } + + case Events::PowerMissingPhase::Id: { + Events::PowerMissingPhase::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent * value = + [CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent new]; + + return value; + } + + case Events::SystemPressureLow::Id: { + Events::SystemPressureLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent * value = + [CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent new]; + + return value; + } + + case Events::SystemPressureHigh::Id: { + Events::SystemPressureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent new]; + + return value; + } + + case Events::DryRunning::Id: { + Events::DryRunning::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterDryRunningEvent * value = + [CHIPPumpConfigurationAndControlClusterDryRunningEvent new]; + + return value; + } + + case Events::MotorTemperatureHigh::Id: { + Events::MotorTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent new]; + + return value; + } + + case Events::PumpMotorFatalFailure::Id: { + Events::PumpMotorFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent new]; + + return value; + } + + case Events::ElectronicTemperatureHigh::Id: { + Events::ElectronicTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent new]; + + return value; + } + + case Events::PumpBlocked::Id: { + Events::PumpBlocked::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPumpBlockedEvent * value = + [CHIPPumpConfigurationAndControlClusterPumpBlockedEvent new]; + + return value; + } + + case Events::SensorFailure::Id: { + Events::SensorFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSensorFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterSensorFailureEvent new]; + + return value; + } + + case Events::ElectronicNonFatalFailure::Id: { + Events::ElectronicNonFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent new]; + + return value; + } + + case Events::ElectronicFatalFailure::Id: { + Events::ElectronicFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent new]; + + return value; + } + + case Events::GeneralFault::Id: { + Events::GeneralFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterGeneralFaultEvent * value = + [CHIPPumpConfigurationAndControlClusterGeneralFaultEvent new]; + + return value; + } + + case Events::Leakage::Id: { + Events::Leakage::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterLeakageEvent * value = [CHIPPumpConfigurationAndControlClusterLeakageEvent new]; + + return value; + } + + case Events::AirDetection::Id: { + Events::AirDetection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterAirDetectionEvent * value = + [CHIPPumpConfigurationAndControlClusterAirDetectionEvent new]; + + return value; + } + + case Events::TurbineOperation::Id: { + Events::TurbineOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterTurbineOperationEvent * value = + [CHIPPumpConfigurationAndControlClusterTurbineOperationEvent new]; + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::RelativeHumidityMeasurement::Id: { + using namespace Clusters::RelativeHumidityMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Scenes::Id: { + using namespace Clusters::Scenes; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::SoftwareDiagnostics::Id: { + using namespace Clusters::SoftwareDiagnostics; + switch (aPath.mEventId) { + + case Events::SoftwareFault::Id: { + Events::SoftwareFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent * value = [CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent new]; + + do { + CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct * _Nonnull memberValue; + memberValue = [CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct new]; + memberValue.id = [NSNumber numberWithUnsignedLongLong:cppValue.softwareFault.id]; + memberValue.name = [[NSString alloc] initWithBytes:cppValue.softwareFault.name.data() + length:cppValue.softwareFault.name.size() + encoding:NSUTF8StringEncoding]; + memberValue.faultRecording = [NSData dataWithBytes:cppValue.softwareFault.faultRecording.data() + length:cppValue.softwareFault.faultRecording.size()]; + value.softwareFault = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Switch::Id: { + using namespace Clusters::Switch; + switch (aPath.mEventId) { + + case Events::SwitchLatched::Id: { + Events::SwitchLatched::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterSwitchLatchedEvent * value = [CHIPSwitchClusterSwitchLatchedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::InitialPress::Id: { + Events::InitialPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterInitialPressEvent * value = [CHIPSwitchClusterInitialPressEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::LongPress::Id: { + Events::LongPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterLongPressEvent * value = [CHIPSwitchClusterLongPressEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::ShortRelease::Id: { + Events::ShortRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterShortReleaseEvent * value = [CHIPSwitchClusterShortReleaseEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); + + return value; + } + + case Events::LongRelease::Id: { + Events::LongRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterLongReleaseEvent * value = [CHIPSwitchClusterLongReleaseEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); + + return value; + } + + case Events::MultiPressOngoing::Id: { + Events::MultiPressOngoing::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterMultiPressOngoingEvent * value = [CHIPSwitchClusterMultiPressOngoingEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.currentNumberOfPressesCounted]; + value.currentNumberOfPressesCounted = memberValue; + } while (0); + + return value; + } + + case Events::MultiPressComplete::Id: { + Events::MultiPressComplete::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterMultiPressCompleteEvent * value = [CHIPSwitchClusterMultiPressCompleteEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.totalNumberOfPressesCounted]; + value.totalNumberOfPressesCounted = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TargetNavigator::Id: { + using namespace Clusters::TargetNavigator; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TemperatureMeasurement::Id: { + using namespace Clusters::TemperatureMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TestCluster::Id: { + using namespace Clusters::TestCluster; + switch (aPath.mEventId) { + + case Events::TestEvent::Id: { + Events::TestEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPTestClusterClusterTestEventEvent * value = [CHIPTestClusterClusterTestEventEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; + value.arg1 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg2)]; + value.arg2 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.arg3]; + value.arg3 = memberValue; + } while (0); + do { + CHIPTestClusterClusterSimpleStruct * _Nonnull memberValue; + memberValue = [CHIPTestClusterClusterSimpleStruct new]; + memberValue.a = [NSNumber numberWithUnsignedChar:cppValue.arg4.a]; + memberValue.b = [NSNumber numberWithBool:cppValue.arg4.b]; + memberValue.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg4.c)]; + memberValue.d = [NSData dataWithBytes:cppValue.arg4.d.data() length:cppValue.arg4.d.size()]; + memberValue.e = [[NSString alloc] initWithBytes:cppValue.arg4.e.data() + length:cppValue.arg4.e.size() + encoding:NSUTF8StringEncoding]; + memberValue.f = [NSNumber numberWithUnsignedChar:cppValue.arg4.f.Raw()]; + memberValue.g = [NSNumber numberWithFloat:cppValue.arg4.g]; + memberValue.h = [NSNumber numberWithDouble:cppValue.arg4.h]; + value.arg4 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg5.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + CHIPTestClusterClusterSimpleStruct * newElement_0; + newElement_0 = [CHIPTestClusterClusterSimpleStruct new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; + newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; + newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() + length:entry_0.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; + newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; + newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.arg5 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg6.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar: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; + } + memberValue = array_0; + } + value.arg6 = memberValue; + } while (0); + + return value; + } + + case Events::TestFabricScopedEvent::Id: { + Events::TestFabricScopedEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPTestClusterClusterTestFabricScopedEventEvent * value = [CHIPTestClusterClusterTestFabricScopedEventEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; + value.arg1 = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Thermostat::Id: { + using namespace Clusters::Thermostat; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ThermostatUserInterfaceConfiguration::Id: { + using namespace Clusters::ThermostatUserInterfaceConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ThreadNetworkDiagnostics::Id: { + using namespace Clusters::ThreadNetworkDiagnostics; + switch (aPath.mEventId) { + + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent * value = + [CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TimeFormatLocalization::Id: { + using namespace Clusters::TimeFormatLocalization; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::UnitLocalization::Id: { + using namespace Clusters::UnitLocalization; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::UserLabel::Id: { + using namespace Clusters::UserLabel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WakeOnLan::Id: { + using namespace Clusters::WakeOnLan; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WiFiNetworkDiagnostics::Id: { + using namespace Clusters::WiFiNetworkDiagnostics; + switch (aPath.mEventId) { + + case Events::Disconnection::Id: { + Events::Disconnection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent * value = [CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.reasonCode]; + value.reasonCode = memberValue; + } while (0); + + return value; + } + + case Events::AssociationFailure::Id: { + Events::AssociationFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent * value = + [CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.associationFailure)]; + value.associationFailure = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.status]; + value.status = memberValue; + } while (0); + + return value; + } + + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent * value = + [CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WindowCovering::Id: { + using namespace Clusters::WindowCovering; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + default: { + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + } + return nil; +} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index 810f4d056d77e6..cabe67a4a335a8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -92,6 +92,22 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPAccessControlClusterAccessControlEntryChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nullable adminNodeID; +@property (strong, nonatomic) NSNumber * _Nullable adminPasscodeID; +@property (strong, nonatomic) NSNumber * _Nonnull changeType; +@property (strong, nonatomic) CHIPAccessControlClusterAccessControlEntry * _Nullable latestValue; +@property (strong, nonatomic) NSNumber * _Nonnull adminFabricIndex; +@end + +@interface CHIPAccessControlClusterAccessControlExtensionChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nullable adminNodeID; +@property (strong, nonatomic) NSNumber * _Nullable adminPasscodeID; +@property (strong, nonatomic) NSNumber * _Nonnull changeType; +@property (strong, nonatomic) CHIPAccessControlClusterExtensionEntry * _Nullable latestValue; +@property (strong, nonatomic) NSNumber * _Nonnull adminFabricIndex; +@end + @interface CHIPBridgedActionsClusterActionStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull actionID; @property (strong, nonatomic) NSString * _Nonnull name; @@ -110,12 +126,39 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPBridgedActionsClusterStateChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull actionID; +@property (strong, nonatomic) NSNumber * _Nonnull invokeID; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@end + +@interface CHIPBridgedActionsClusterActionFailedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull actionID; +@property (strong, nonatomic) NSNumber * _Nonnull invokeID; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@property (strong, nonatomic) NSNumber * _Nonnull error; +@end + @interface CHIPBasicClusterCapabilityMinimaStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull caseSessionsPerFabric; @property (strong, nonatomic) NSNumber * _Nonnull subscriptionsPerFabric; - (instancetype)init; @end +@interface CHIPBasicClusterStartUpEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@end + +@interface CHIPBasicClusterShutDownEvent : NSObject +@end + +@interface CHIPBasicClusterLeaveEvent : NSObject +@end + +@interface CHIPBasicClusterReachableChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reachableNewValue; +@end + @interface CHIPOtaSoftwareUpdateRequestorClusterProviderLocation : NSObject @property (strong, nonatomic) NSNumber * _Nonnull providerNodeID; @property (strong, nonatomic) NSNumber * _Nonnull endpoint; @@ -123,6 +166,25 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousState; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@property (strong, nonatomic) NSNumber * _Nonnull reason; +@property (strong, nonatomic) NSNumber * _Nullable targetSoftwareVersion; +@end + +@interface CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@property (strong, nonatomic) NSNumber * _Nonnull productID; +@end + +@interface CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@property (strong, nonatomic) NSNumber * _Nonnull bytesDownloaded; +@property (strong, nonatomic) NSNumber * _Nullable progressPercent; +@property (strong, nonatomic) NSNumber * _Nullable platformCode; +@end + @interface CHIPPowerSourceClusterBatChargeFaultChangeType : NSObject @property (strong, nonatomic) NSArray * _Nonnull current; @property (strong, nonatomic) NSArray * _Nonnull previous; @@ -186,6 +248,25 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterBootReasonEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull bootReason; +@end + @interface CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull id; @property (strong, nonatomic) NSString * _Nonnull name; @@ -202,6 +283,10 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent : NSObject +@property (strong, nonatomic) CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct * _Nonnull softwareFault; +@end + @interface CHIPThreadNetworkDiagnosticsClusterNeighborTable : NSObject @property (strong, nonatomic) NSNumber * _Nonnull extAddress; @property (strong, nonatomic) NSNumber * _Nonnull age; @@ -256,6 +341,67 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull connectionStatus; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reasonCode; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull associationFailure; +@property (strong, nonatomic) NSNumber * _Nonnull status; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull connectionStatus; +@end + +@interface CHIPBridgedDeviceBasicClusterStartUpEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@end + +@interface CHIPBridgedDeviceBasicClusterShutDownEvent : NSObject +@end + +@interface CHIPBridgedDeviceBasicClusterLeaveEvent : NSObject +@end + +@interface CHIPBridgedDeviceBasicClusterReachableChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reachableNewValue; +@end + +@interface CHIPSwitchClusterSwitchLatchedEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterInitialPressEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterLongPressEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterShortReleaseEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousPosition; +@end + +@interface CHIPSwitchClusterLongReleaseEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousPosition; +@end + +@interface CHIPSwitchClusterMultiPressOngoingEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@property (strong, nonatomic) NSNumber * _Nonnull currentNumberOfPressesCounted; +@end + +@interface CHIPSwitchClusterMultiPressCompleteEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@property (strong, nonatomic) NSNumber * _Nonnull totalNumberOfPressesCounted; +@end + @interface CHIPOperationalCredentialsClusterFabricDescriptor : NSObject @property (strong, nonatomic) NSData * _Nonnull rootPublicKey; @property (strong, nonatomic) NSNumber * _Nonnull vendorId; @@ -312,6 +458,10 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPBooleanStateClusterStateChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull stateValue; +@end + @interface CHIPModeSelectClusterModeOptionStruct : NSObject @property (strong, nonatomic) NSString * _Nonnull label; @property (strong, nonatomic) NSNumber * _Nonnull mode; @@ -331,6 +481,94 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPDoorLockClusterDoorLockAlarmEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull alarmCode; +@end + +@interface CHIPDoorLockClusterDoorStateChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull doorState; +@end + +@interface CHIPDoorLockClusterLockOperationEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSArray * _Nullable credentials; +@end + +@interface CHIPDoorLockClusterLockOperationErrorEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nonnull operationError; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSArray * _Nullable credentials; +@end + +@interface CHIPDoorLockClusterLockUserChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockDataType; +@property (strong, nonatomic) NSNumber * _Nonnull dataOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSNumber * _Nullable dataIndex; +@end + +@interface CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterDryRunningEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPumpBlockedEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSensorFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterGeneralFaultEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterLeakageEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterAirDetectionEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterTurbineOperationEvent : NSObject +@end + @interface CHIPIasAceClusterIasAceZoneStatusResult : NSObject @property (strong, nonatomic) NSNumber * _Nonnull zoneId; @property (strong, nonatomic) NSNumber * _Nonnull zoneStatus; @@ -510,6 +748,19 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPTestClusterClusterTestEventEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull arg1; +@property (strong, nonatomic) NSNumber * _Nonnull arg2; +@property (strong, nonatomic) NSNumber * _Nonnull arg3; +@property (strong, nonatomic) CHIPTestClusterClusterSimpleStruct * _Nonnull arg4; +@property (strong, nonatomic) NSArray * _Nonnull arg5; +@property (strong, nonatomic) NSArray * _Nonnull arg6; +@end + +@interface CHIPTestClusterClusterTestFabricScopedEventEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull arg1; +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_STRUCTS_H */ diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index e41d800b36d887..6ef49cf6be1102 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -166,6 +166,44 @@ - (instancetype)init } @end +@implementation CHIPAccessControlClusterAccessControlEntryChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _adminNodeID = nil; + + _adminPasscodeID = nil; + + _changeType = @(0); + + _latestValue = nil; + + _adminFabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPAccessControlClusterAccessControlExtensionChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _adminNodeID = nil; + + _adminPasscodeID = nil; + + _changeType = @(0); + + _latestValue = nil; + + _adminFabricIndex = @(0); + } + return self; +} +@end + @implementation CHIPBridgedActionsClusterActionStruct - (instancetype)init { @@ -204,6 +242,38 @@ - (instancetype)init } @end +@implementation CHIPBridgedActionsClusterStateChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _actionID = @(0); + + _invokeID = @(0); + + _newState = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedActionsClusterActionFailedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _actionID = @(0); + + _invokeID = @(0); + + _newState = @(0); + + _error = @(0); + } + return self; +} +@end + @implementation CHIPBasicClusterCapabilityMinimaStruct - (instancetype)init { @@ -217,6 +287,46 @@ - (instancetype)init } @end +@implementation CHIPBasicClusterStartUpEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + } + return self; +} +@end + +@implementation CHIPBasicClusterShutDownEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBasicClusterLeaveEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBasicClusterReachableChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reachableNewValue = @(0); + } + return self; +} +@end + @implementation CHIPOtaSoftwareUpdateRequestorClusterProviderLocation - (instancetype)init { @@ -232,6 +342,53 @@ - (instancetype)init } @end +@implementation CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousState = @(0); + + _newState = @(0); + + _reason = @(0); + + _targetSoftwareVersion = nil; + } + return self; +} +@end + +@implementation CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + + _productID = @(0); + } + return self; +} +@end + +@implementation CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + + _bytesDownloaded = @(0); + + _progressPercent = nil; + + _platformCode = nil; + } + return self; +} +@end + @implementation CHIPPowerSourceClusterBatChargeFaultChangeType - (instancetype)init { @@ -239,434 +396,915 @@ - (instancetype)init _current = [NSArray array]; - _previous = [NSArray array]; + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPPowerSourceClusterBatFaultChangeType +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPPowerSourceClusterWiredFaultChangeType +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralCommissioningClusterBasicCommissioningInfo +- (instancetype)init +{ + if (self = [super init]) { + + _failSafeExpiryLengthSeconds = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterNetworkInfo +- (instancetype)init +{ + if (self = [super init]) { + + _networkID = [NSData data]; + + _connected = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterThreadInterfaceScanResult +- (instancetype)init +{ + if (self = [super init]) { + + _panId = @(0); + + _extendedPanId = @(0); + + _networkName = @""; + + _channel = @(0); + + _version = @(0); + + _extendedAddress = [NSData data]; + + _rssi = @(0); + + _lqi = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterWiFiInterfaceScanResult +- (instancetype)init +{ + if (self = [super init]) { + + _security = @(0); + + _ssid = [NSData data]; + + _bssid = [NSData data]; + + _channel = @(0); + + _wiFiBand = @(0); + + _rssi = @(0); + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterNetworkInterfaceType +- (instancetype)init +{ + if (self = [super init]) { + + _name = @""; + + _isOperational = @(0); + + _offPremiseServicesReachableIPv4 = nil; + + _offPremiseServicesReachableIPv6 = nil; + + _hardwareAddress = [NSData data]; + + _iPv4Addresses = [NSArray array]; + + _iPv6Addresses = [NSArray array]; + + _type = @(0); + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterBootReasonEvent +- (instancetype)init +{ + if (self = [super init]) { + + _bootReason = @(0); + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct +- (instancetype)init +{ + if (self = [super init]) { + + _id = @(0); + + _name = @""; + + _faultRecording = [NSData data]; + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterThreadMetrics +- (instancetype)init +{ + if (self = [super init]) { + + _id = @(0); + + _name = @""; + + _stackFreeCurrent = @(0); + + _stackFreeMinimum = @(0); + + _stackSize = @(0); + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareFault = [CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct new]; + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterNeighborTable +- (instancetype)init +{ + if (self = [super init]) { + + _extAddress = @(0); + + _age = @(0); + + _rloc16 = @(0); + + _linkFrameCounter = @(0); + + _mleFrameCounter = @(0); + + _lqi = @(0); + + _averageRssi = @(0); + + _lastRssi = @(0); + + _frameErrorRate = @(0); + + _messageErrorRate = @(0); + + _rxOnWhenIdle = @(0); + + _fullThreadDevice = @(0); + + _fullNetworkData = @(0); + + _isChild = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents +- (instancetype)init +{ + if (self = [super init]) { + + _activeTimestampPresent = @(0); + + _pendingTimestampPresent = @(0); + + _masterKeyPresent = @(0); + + _networkNamePresent = @(0); + + _extendedPanIdPresent = @(0); + + _meshLocalPrefixPresent = @(0); + + _delayPresent = @(0); + + _panIdPresent = @(0); + + _channelPresent = @(0); + + _pskcPresent = @(0); + + _securityPolicyPresent = @(0); + + _channelMaskPresent = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterRouteTable +- (instancetype)init +{ + if (self = [super init]) { + + _extAddress = @(0); + + _rloc16 = @(0); + + _routerId = @(0); + + _nextHop = @(0); + + _pathCost = @(0); + + _lqiIn = @(0); + + _lqiOut = @(0); + + _age = @(0); + + _allocated = @(0); + + _linkEstablished = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterSecurityPolicy +- (instancetype)init +{ + if (self = [super init]) { + + _rotationTime = @(0); + + _flags = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent +- (instancetype)init +{ + if (self = [super init]) { + + _connectionStatus = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reasonCode = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent +- (instancetype)init +{ + if (self = [super init]) { + + _associationFailure = @(0); + + _status = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent +- (instancetype)init +{ + if (self = [super init]) { + + _connectionStatus = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterStartUpEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterShutDownEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterLeaveEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterReachableChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reachableNewValue = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterSwitchLatchedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterInitialPressEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterLongPressEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterShortReleaseEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterLongReleaseEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterMultiPressOngoingEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + + _currentNumberOfPressesCounted = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterMultiPressCompleteEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + + _totalNumberOfPressesCounted = @(0); + } + return self; +} +@end + +@implementation CHIPOperationalCredentialsClusterFabricDescriptor +- (instancetype)init +{ + if (self = [super init]) { + + _rootPublicKey = [NSData data]; + + _vendorId = @(0); + + _fabricId = @(0); + + _nodeId = @(0); + + _label = @""; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPOperationalCredentialsClusterNOCStruct +- (instancetype)init +{ + if (self = [super init]) { + + _noc = [NSData data]; + + _icac = nil; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupInfoMapStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupId = @(0); + + _endpoints = [NSArray array]; + + _groupName = nil; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupKeyMapStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupId = @(0); + + _groupKeySetID = @(0); + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupKeySetStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetID = @(0); + + _groupKeySecurityPolicy = @(0); + + _epochKey0 = nil; + + _epochStartTime0 = nil; + + _epochKey1 = nil; + + _epochStartTime1 = nil; + + _epochKey2 = nil; + + _epochStartTime2 = nil; + } + return self; +} +@end + +@implementation CHIPFixedLabelClusterLabelStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _value = @""; + } + return self; +} +@end + +@implementation CHIPUserLabelClusterLabelStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _value = @""; + } + return self; +} +@end + +@implementation CHIPBooleanStateClusterStateChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _stateValue = @(0); + } + return self; +} +@end + +@implementation CHIPModeSelectClusterModeOptionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _mode = @(0); + + _semanticTag = @(0); } return self; } @end -@implementation CHIPPowerSourceClusterBatFaultChangeType +@implementation CHIPModeSelectClusterSemanticTag - (instancetype)init { if (self = [super init]) { - _current = [NSArray array]; + _mfgCode = @(0); - _previous = [NSArray array]; + _value = @(0); } return self; } @end -@implementation CHIPPowerSourceClusterWiredFaultChangeType +@implementation CHIPDoorLockClusterDlCredential - (instancetype)init { if (self = [super init]) { - _current = [NSArray array]; + _credentialType = @(0); - _previous = [NSArray array]; + _credentialIndex = @(0); } return self; } @end -@implementation CHIPGeneralCommissioningClusterBasicCommissioningInfo +@implementation CHIPDoorLockClusterDoorLockAlarmEvent - (instancetype)init { if (self = [super init]) { - _failSafeExpiryLengthSeconds = @(0); + _alarmCode = @(0); } return self; } @end -@implementation CHIPNetworkCommissioningClusterNetworkInfo +@implementation CHIPDoorLockClusterDoorStateChangeEvent - (instancetype)init { if (self = [super init]) { - _networkID = [NSData data]; - - _connected = @(0); + _doorState = @(0); } return self; } @end -@implementation CHIPNetworkCommissioningClusterThreadInterfaceScanResult +@implementation CHIPDoorLockClusterLockOperationEvent - (instancetype)init { if (self = [super init]) { - _panId = @(0); - - _extendedPanId = @(0); - - _networkName = @""; + _lockOperationType = @(0); - _channel = @(0); + _operationSource = @(0); - _version = @(0); + _userIndex = nil; - _extendedAddress = [NSData data]; + _fabricIndex = nil; - _rssi = @(0); + _sourceNode = nil; - _lqi = @(0); + _credentials = nil; } return self; } @end -@implementation CHIPNetworkCommissioningClusterWiFiInterfaceScanResult +@implementation CHIPDoorLockClusterLockOperationErrorEvent - (instancetype)init { if (self = [super init]) { - _security = @(0); + _lockOperationType = @(0); - _ssid = [NSData data]; + _operationSource = @(0); - _bssid = [NSData data]; + _operationError = @(0); - _channel = @(0); + _userIndex = nil; - _wiFiBand = @(0); + _fabricIndex = nil; - _rssi = @(0); + _sourceNode = nil; + + _credentials = nil; } return self; } @end -@implementation CHIPGeneralDiagnosticsClusterNetworkInterfaceType +@implementation CHIPDoorLockClusterLockUserChangeEvent - (instancetype)init { if (self = [super init]) { - _name = @""; - - _isOperational = @(0); + _lockDataType = @(0); - _offPremiseServicesReachableIPv4 = nil; + _dataOperationType = @(0); - _offPremiseServicesReachableIPv6 = nil; + _operationSource = @(0); - _hardwareAddress = [NSData data]; + _userIndex = nil; - _iPv4Addresses = [NSArray array]; + _fabricIndex = nil; - _iPv6Addresses = [NSArray array]; + _sourceNode = nil; - _type = @(0); + _dataIndex = nil; } return self; } @end -@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct +@implementation CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent - (instancetype)init { if (self = [super init]) { - - _id = @(0); - - _name = @""; - - _faultRecording = [NSData data]; } return self; } @end -@implementation CHIPSoftwareDiagnosticsClusterThreadMetrics +@implementation CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent - (instancetype)init { if (self = [super init]) { - - _id = @(0); - - _name = @""; - - _stackFreeCurrent = @(0); - - _stackFreeMinimum = @(0); - - _stackSize = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterNeighborTable +@implementation CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent - (instancetype)init { if (self = [super init]) { - - _extAddress = @(0); - - _age = @(0); - - _rloc16 = @(0); - - _linkFrameCounter = @(0); - - _mleFrameCounter = @(0); - - _lqi = @(0); - - _averageRssi = @(0); - - _lastRssi = @(0); - - _frameErrorRate = @(0); - - _messageErrorRate = @(0); - - _rxOnWhenIdle = @(0); - - _fullThreadDevice = @(0); - - _fullNetworkData = @(0); - - _isChild = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents +@implementation CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent - (instancetype)init { if (self = [super init]) { - - _activeTimestampPresent = @(0); - - _pendingTimestampPresent = @(0); - - _masterKeyPresent = @(0); - - _networkNamePresent = @(0); - - _extendedPanIdPresent = @(0); - - _meshLocalPrefixPresent = @(0); - - _delayPresent = @(0); - - _panIdPresent = @(0); - - _channelPresent = @(0); - - _pskcPresent = @(0); - - _securityPolicyPresent = @(0); - - _channelMaskPresent = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterRouteTable +@implementation CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent - (instancetype)init { if (self = [super init]) { - - _extAddress = @(0); - - _rloc16 = @(0); - - _routerId = @(0); - - _nextHop = @(0); - - _pathCost = @(0); - - _lqiIn = @(0); - - _lqiOut = @(0); - - _age = @(0); - - _allocated = @(0); - - _linkEstablished = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterSecurityPolicy +@implementation CHIPPumpConfigurationAndControlClusterDryRunningEvent - (instancetype)init { if (self = [super init]) { - - _rotationTime = @(0); - - _flags = @(0); } return self; } @end -@implementation CHIPOperationalCredentialsClusterFabricDescriptor +@implementation CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent - (instancetype)init { if (self = [super init]) { - - _rootPublicKey = [NSData data]; - - _vendorId = @(0); - - _fabricId = @(0); - - _nodeId = @(0); - - _label = @""; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPOperationalCredentialsClusterNOCStruct +@implementation CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _noc = [NSData data]; - - _icac = nil; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupInfoMapStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent - (instancetype)init { if (self = [super init]) { - - _groupId = @(0); - - _endpoints = [NSArray array]; - - _groupName = nil; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupKeyMapStruct +@implementation CHIPPumpConfigurationAndControlClusterPumpBlockedEvent - (instancetype)init { if (self = [super init]) { - - _groupId = @(0); - - _groupKeySetID = @(0); - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupKeySetStruct +@implementation CHIPPumpConfigurationAndControlClusterSensorFailureEvent - (instancetype)init { if (self = [super init]) { - - _groupKeySetID = @(0); - - _groupKeySecurityPolicy = @(0); - - _epochKey0 = nil; - - _epochStartTime0 = nil; - - _epochKey1 = nil; - - _epochStartTime1 = nil; - - _epochKey2 = nil; - - _epochStartTime2 = nil; } return self; } @end -@implementation CHIPFixedLabelClusterLabelStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _value = @""; } return self; } @end -@implementation CHIPUserLabelClusterLabelStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _value = @""; } return self; } @end -@implementation CHIPModeSelectClusterModeOptionStruct +@implementation CHIPPumpConfigurationAndControlClusterGeneralFaultEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _mode = @(0); - - _semanticTag = @(0); } return self; } @end -@implementation CHIPModeSelectClusterSemanticTag +@implementation CHIPPumpConfigurationAndControlClusterLeakageEvent - (instancetype)init { if (self = [super init]) { - - _mfgCode = @(0); - - _value = @(0); } return self; } @end -@implementation CHIPDoorLockClusterDlCredential +@implementation CHIPPumpConfigurationAndControlClusterAirDetectionEvent - (instancetype)init { if (self = [super init]) { + } + return self; +} +@end - _credentialType = @(0); - - _credentialIndex = @(0); +@implementation CHIPPumpConfigurationAndControlClusterTurbineOperationEvent +- (instancetype)init +{ + if (self = [super init]) { } return self; } @@ -1053,4 +1691,36 @@ - (instancetype)init } @end +@implementation CHIPTestClusterClusterTestEventEvent +- (instancetype)init +{ + if (self = [super init]) { + + _arg1 = @(0); + + _arg2 = @(0); + + _arg3 = @(0); + + _arg4 = [CHIPTestClusterClusterSimpleStruct new]; + + _arg5 = [NSArray array]; + + _arg6 = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPTestClusterClusterTestFabricScopedEventEvent +- (instancetype)init +{ + if (self = [super init]) { + + _arg1 = @(0); + } + return self; +} +@end + NS_ASSUME_NONNULL_END